Commit b4af936409d60264ac016beb41a20019cab0d070
1 parent
c8753517
消息管理修改
Showing
5 changed files
with
31 additions
and
11 deletions
src/api/system/message.js
| @@ -19,9 +19,10 @@ export function MessageAllRead() { | @@ -19,9 +19,10 @@ export function MessageAllRead() { | ||
| 19 | export function ReadInfo(id) { | 19 | export function ReadInfo(id) { |
| 20 | return request({ | 20 | return request({ |
| 21 | url: `/message/ReadInfo/${id}`, | 21 | url: `/message/ReadInfo/${id}`, |
| 22 | - method: 'get' | 22 | + method: 'GET' |
| 23 | }) | 23 | }) |
| 24 | } | 24 | } |
| 25 | + | ||
| 25 | // 删除消息 | 26 | // 删除消息 |
| 26 | export function MessageDeleteRecord(data) { | 27 | export function MessageDeleteRecord(data) { |
| 27 | return request({ | 28 | return request({ |
src/utils/define.js
| 1 | // 开发环境接口配置 | 1 | // 开发环境接口配置 |
| 2 | // JAVA Boot版本对应后端接口地址 | 2 | // JAVA Boot版本对应后端接口地址 |
| 3 | // JAVA Cloud对应网关地址 | 3 | // JAVA Cloud对应网关地址 |
| 4 | -const APIURl = 'http://8.130.38.56:8043' | 4 | +const APIURl = 'http://localhost:8080' |
| 5 | 5 | ||
| 6 | module.exports = { | 6 | module.exports = { |
| 7 | APIURl: APIURl, | 7 | APIURl: APIURl, |
| 8 | timeout: process.env.NODE_ENV === 'development' ? 10000 : 1000000, | 8 | timeout: process.env.NODE_ENV === 'development' ? 10000 : 1000000, |
| 9 | - WebSocketUrl: process.env.NODE_ENV === 'development' ? APIURl.replace('http', 'ws') + '/api/message/websocket' : process.env.VUE_APP_BASE_WSS, | 9 | + WebSocketUrl: process.env.NODE_ENV === 'development' ? APIURl.replace('http', 'ws') + '/websocket' : process.env.VUE_APP_BASE_WSS, |
| 10 | + // WebSocketUrl: process.env.NODE_ENV === 'development' ? APIURl.replace('http', 'ws') + '/api/message/websocket' : process.env.VUE_APP_BASE_WSS, | ||
| 10 | comUploadUrl: process.env.VUE_APP_BASE_API + '/api/file/Uploader', | 11 | comUploadUrl: process.env.VUE_APP_BASE_API + '/api/file/Uploader', |
| 11 | comUrl: process.env.VUE_APP_BASE_API, | 12 | comUrl: process.env.VUE_APP_BASE_API, |
| 12 | // 本地文件预览 | 13 | // 本地文件预览 |
src/views/homePage/components/news/NewsDialog.vue
| @@ -15,16 +15,19 @@ | @@ -15,16 +15,19 @@ | ||
| 15 | infinite-scroll-disabled="disabled" | 15 | infinite-scroll-disabled="disabled" |
| 16 | infinite-scroll-immediate | 16 | infinite-scroll-immediate |
| 17 | > | 17 | > |
| 18 | - <li class="list-item" v-for="v in messageList" :key="v.id"> | 18 | + <li class="list-item" v-for="(v, i) in messageList" :key="v.id"> |
| 19 | <div class="item-title">{{ v.title }}</div> | 19 | <div class="item-title">{{ v.title }}</div> |
| 20 | <!-- <p>这个应用应该归属到青羊区,不在金牛区的管辖范围内。</p> --> | 20 | <!-- <p>这个应用应该归属到青羊区,不在金牛区的管辖范围内。</p> --> |
| 21 | <div class="item-info"> | 21 | <div class="item-info"> |
| 22 | <div class="left">发送人:{{ v.creatorUser }}</div> | 22 | <div class="left">发送人:{{ v.creatorUser }}</div> |
| 23 | </div> | 23 | </div> |
| 24 | <div class="item-info"> | 24 | <div class="item-info"> |
| 25 | - <div class="right"> | 25 | + <div class="left"> |
| 26 | 时间:{{ ncc.dateFormat(v.lastModifyTime) }} | 26 | 时间:{{ ncc.dateFormat(v.lastModifyTime) }} |
| 27 | </div> | 27 | </div> |
| 28 | + <div class="right"> | ||
| 29 | + <el-button type="text" size="mini" @click="toReadInfo(v.id, i)">标记已读</el-button> | ||
| 30 | + </div> | ||
| 28 | </div> | 31 | </div> |
| 29 | </li> | 32 | </li> |
| 30 | </ul> | 33 | </ul> |
| @@ -35,7 +38,8 @@ | @@ -35,7 +38,8 @@ | ||
| 35 | </template> | 38 | </template> |
| 36 | 39 | ||
| 37 | <script> | 40 | <script> |
| 38 | -import { getMessageList } from "@/api/system/message"; | 41 | +import { getMessageList, ReadInfo } from "@/api/system/message"; |
| 42 | +import { message } from '@/utils/message'; | ||
| 39 | export default { | 43 | export default { |
| 40 | name: "NewsDialog", | 44 | name: "NewsDialog", |
| 41 | data() { | 45 | data() { |
| @@ -81,9 +85,19 @@ export default { | @@ -81,9 +85,19 @@ export default { | ||
| 81 | }, | 85 | }, |
| 82 | toReadAll() { | 86 | toReadAll() { |
| 83 | MessageAllRead().then(() => { | 87 | MessageAllRead().then(() => { |
| 84 | - this.load(); | 88 | + this.init(); |
| 85 | }); | 89 | }); |
| 86 | }, | 90 | }, |
| 91 | + toReadInfo(id, index) { | ||
| 92 | + ReadInfo(id).then(() => { | ||
| 93 | + this.$message({ | ||
| 94 | + showClose: true, | ||
| 95 | + message: '已读成功!', | ||
| 96 | + type: 'success' | ||
| 97 | + }); | ||
| 98 | + this.init(); | ||
| 99 | + }); | ||
| 100 | + } | ||
| 87 | }, | 101 | }, |
| 88 | }; | 102 | }; |
| 89 | </script> | 103 | </script> |
| @@ -114,7 +128,7 @@ export default { | @@ -114,7 +128,7 @@ export default { | ||
| 114 | padding: 8px; | 128 | padding: 8px; |
| 115 | border-radius: 5px; | 129 | border-radius: 5px; |
| 116 | background-color: rgb(243, 244, 246); | 130 | background-color: rgb(243, 244, 246); |
| 117 | - cursor: pointer; | 131 | + // cursor: pointer; |
| 118 | .item-title { | 132 | .item-title { |
| 119 | color: #000; | 133 | color: #000; |
| 120 | font-weight: 600; | 134 | font-weight: 600; |
| @@ -146,6 +160,7 @@ export default { | @@ -146,6 +160,7 @@ export default { | ||
| 146 | align-items: center; | 160 | align-items: center; |
| 147 | color: #ccc; | 161 | color: #ccc; |
| 148 | font-size: 12px; | 162 | font-size: 12px; |
| 163 | + line-height: 30px; | ||
| 149 | } | 164 | } |
| 150 | } | 165 | } |
| 151 | } | 166 | } |
src/views/homePage/components/news/index.vue
| @@ -50,12 +50,14 @@ export default { | @@ -50,12 +50,14 @@ export default { | ||
| 50 | this.socket = this.$store.getters.socket || null; | 50 | this.socket = this.$store.getters.socket || null; |
| 51 | if ("WebSocket" in window) { | 51 | if ("WebSocket" in window) { |
| 52 | if (!this.socket) { | 52 | if (!this.socket) { |
| 53 | + console.log(this.define.WebSocketUrl, 'this.define.WebSocketUrl'); | ||
| 53 | this.socket = new ReconnectingWebSocket(this.define.WebSocketUrl); | 54 | this.socket = new ReconnectingWebSocket(this.define.WebSocketUrl); |
| 54 | this.$store.commit("SET_SOCKET", this.socket); | 55 | this.$store.commit("SET_SOCKET", this.socket); |
| 55 | } | 56 | } |
| 56 | //添加事件监听 | 57 | //添加事件监听 |
| 57 | let socket = this.socket; | 58 | let socket = this.socket; |
| 58 | socket.onopen = () => { | 59 | socket.onopen = () => { |
| 60 | + console.log('连接成功') | ||
| 59 | var onConnection = { | 61 | var onConnection = { |
| 60 | method: "OnConnection", | 62 | method: "OnConnection", |
| 61 | token: this.$store.getters.token, | 63 | token: this.$store.getters.token, |
vue.config.js
| @@ -25,9 +25,10 @@ module.exports = defineConfig({ | @@ -25,9 +25,10 @@ module.exports = defineConfig({ | ||
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| 27 | }, | 27 | }, |
| 28 | - client: { | ||
| 29 | - overlay: false | ||
| 30 | - }, | 28 | + // client: { |
| 29 | + // webSocketURL: "http://localhost:8080" | ||
| 30 | + // // overlay: false | ||
| 31 | + // }, | ||
| 31 | }, | 32 | }, |
| 32 | configureWebpack: { | 33 | configureWebpack: { |
| 33 | name: '属地', | 34 | name: '属地', |