优化无感刷新通知消息

main
HUOJIN\92525 2024-09-14 17:18:14 +08:00
parent f998cbdaa2
commit e5ec6bc20f
1 changed files with 9 additions and 5 deletions

View File

@ -48,16 +48,20 @@ export default {
handleSetLineChartData(type) {
this.lineChartData = lineChartData[type]
},
async pollMsg() {
//3
this.pollingTimer = setInterval(async () => {
const data = {msg:'友仓智慧物流,软件定义物流。',msgType:'INFO'}
this.createOrUpdateNotification(data)
}, 3000);
},
initWebSocket() {
stockUrl.stockMsg()
stockUrl.stockMsg();
const wsUri = (process.env.VUE_APP_WS_API === '/' ? '/' : (process.env.VUE_APP_WS_API + '/')) + 'webSocket/stock'
this.websock = new WebSocket(wsUri)
this.websock.onerror = this.webSocketOnError
this.websock.onmessage = this.webSocketOnMessage
//5
this.pollingTimer = setInterval(() => {
stockUrl.stockMsg()
}, 5000);
this.pollMsg()
},
webSocketOnError(e) {
this.$notify({