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 | 19 | export function ReadInfo(id) { |
| 20 | 20 | return request({ |
| 21 | 21 | url: `/message/ReadInfo/${id}`, |
| 22 | - method: 'get' | |
| 22 | + method: 'GET' | |
| 23 | 23 | }) |
| 24 | 24 | } |
| 25 | + | |
| 25 | 26 | // 删除消息 |
| 26 | 27 | export function MessageDeleteRecord(data) { |
| 27 | 28 | return request({ | ... | ... |
src/utils/define.js
| 1 | 1 | // 开发环境接口配置 |
| 2 | 2 | // JAVA Boot版本对应后端接口地址 |
| 3 | 3 | // JAVA Cloud对应网关地址 |
| 4 | -const APIURl = 'http://8.130.38.56:8043' | |
| 4 | +const APIURl = 'http://localhost:8080' | |
| 5 | 5 | |
| 6 | 6 | module.exports = { |
| 7 | 7 | APIURl: APIURl, |
| 8 | 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 | 11 | comUploadUrl: process.env.VUE_APP_BASE_API + '/api/file/Uploader', |
| 11 | 12 | comUrl: process.env.VUE_APP_BASE_API, |
| 12 | 13 | // 本地文件预览 | ... | ... |
src/views/homePage/components/news/NewsDialog.vue
| ... | ... | @@ -15,16 +15,19 @@ |
| 15 | 15 | infinite-scroll-disabled="disabled" |
| 16 | 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 | 19 | <div class="item-title">{{ v.title }}</div> |
| 20 | 20 | <!-- <p>这个应用应该归属到青羊区,不在金牛区的管辖范围内。</p> --> |
| 21 | 21 | <div class="item-info"> |
| 22 | 22 | <div class="left">发送人:{{ v.creatorUser }}</div> |
| 23 | 23 | </div> |
| 24 | 24 | <div class="item-info"> |
| 25 | - <div class="right"> | |
| 25 | + <div class="left"> | |
| 26 | 26 | 时间:{{ ncc.dateFormat(v.lastModifyTime) }} |
| 27 | 27 | </div> |
| 28 | + <div class="right"> | |
| 29 | + <el-button type="text" size="mini" @click="toReadInfo(v.id, i)">标记已读</el-button> | |
| 30 | + </div> | |
| 28 | 31 | </div> |
| 29 | 32 | </li> |
| 30 | 33 | </ul> |
| ... | ... | @@ -35,7 +38,8 @@ |
| 35 | 38 | </template> |
| 36 | 39 | |
| 37 | 40 | <script> |
| 38 | -import { getMessageList } from "@/api/system/message"; | |
| 41 | +import { getMessageList, ReadInfo } from "@/api/system/message"; | |
| 42 | +import { message } from '@/utils/message'; | |
| 39 | 43 | export default { |
| 40 | 44 | name: "NewsDialog", |
| 41 | 45 | data() { |
| ... | ... | @@ -81,9 +85,19 @@ export default { |
| 81 | 85 | }, |
| 82 | 86 | toReadAll() { |
| 83 | 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 | 103 | </script> |
| ... | ... | @@ -114,7 +128,7 @@ export default { |
| 114 | 128 | padding: 8px; |
| 115 | 129 | border-radius: 5px; |
| 116 | 130 | background-color: rgb(243, 244, 246); |
| 117 | - cursor: pointer; | |
| 131 | + // cursor: pointer; | |
| 118 | 132 | .item-title { |
| 119 | 133 | color: #000; |
| 120 | 134 | font-weight: 600; |
| ... | ... | @@ -146,6 +160,7 @@ export default { |
| 146 | 160 | align-items: center; |
| 147 | 161 | color: #ccc; |
| 148 | 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 | 50 | this.socket = this.$store.getters.socket || null; |
| 51 | 51 | if ("WebSocket" in window) { |
| 52 | 52 | if (!this.socket) { |
| 53 | + console.log(this.define.WebSocketUrl, 'this.define.WebSocketUrl'); | |
| 53 | 54 | this.socket = new ReconnectingWebSocket(this.define.WebSocketUrl); |
| 54 | 55 | this.$store.commit("SET_SOCKET", this.socket); |
| 55 | 56 | } |
| 56 | 57 | //添加事件监听 |
| 57 | 58 | let socket = this.socket; |
| 58 | 59 | socket.onopen = () => { |
| 60 | + console.log('连接成功') | |
| 59 | 61 | var onConnection = { |
| 60 | 62 | method: "OnConnection", |
| 61 | 63 | token: this.$store.getters.token, | ... | ... |
vue.config.js