diff --git a/src/views/home.vue b/src/views/home.vue index 43fb6e7..e749165 100644 --- a/src/views/home.vue +++ b/src/views/home.vue @@ -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({