优化无感刷新通知消息
parent
f998cbdaa2
commit
e5ec6bc20f
|
|
@ -48,16 +48,20 @@ export default {
|
||||||
handleSetLineChartData(type) {
|
handleSetLineChartData(type) {
|
||||||
this.lineChartData = lineChartData[type]
|
this.lineChartData = lineChartData[type]
|
||||||
},
|
},
|
||||||
|
async pollMsg() {
|
||||||
|
//3秒轮询一次
|
||||||
|
this.pollingTimer = setInterval(async () => {
|
||||||
|
const data = {msg:'友仓智慧物流,软件定义物流。',msgType:'INFO'}
|
||||||
|
this.createOrUpdateNotification(data)
|
||||||
|
}, 3000);
|
||||||
|
},
|
||||||
initWebSocket() {
|
initWebSocket() {
|
||||||
stockUrl.stockMsg()
|
stockUrl.stockMsg();
|
||||||
const wsUri = (process.env.VUE_APP_WS_API === '/' ? '/' : (process.env.VUE_APP_WS_API + '/')) + 'webSocket/stock'
|
const wsUri = (process.env.VUE_APP_WS_API === '/' ? '/' : (process.env.VUE_APP_WS_API + '/')) + 'webSocket/stock'
|
||||||
this.websock = new WebSocket(wsUri)
|
this.websock = new WebSocket(wsUri)
|
||||||
this.websock.onerror = this.webSocketOnError
|
this.websock.onerror = this.webSocketOnError
|
||||||
this.websock.onmessage = this.webSocketOnMessage
|
this.websock.onmessage = this.webSocketOnMessage
|
||||||
//5秒轮询一次
|
this.pollMsg()
|
||||||
this.pollingTimer = setInterval(() => {
|
|
||||||
stockUrl.stockMsg()
|
|
||||||
}, 5000);
|
|
||||||
},
|
},
|
||||||
webSocketOnError(e) {
|
webSocketOnError(e) {
|
||||||
this.$notify({
|
this.$notify({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue