diff --git a/jero-web/src/components/tools/HeaderNotice.vue b/jero-web/src/components/tools/HeaderNotice.vue index ff05cf345..56f68d64a 100644 --- a/jero-web/src/components/tools/HeaderNotice.vue +++ b/jero-web/src/components/tools/HeaderNotice.vue @@ -45,7 +45,7 @@ export default { name: 'HeaderNotice', components: { - DynamicNotice, + DynamicNotice }, data() { return { @@ -54,14 +54,14 @@ listCementByUser: '/sys/sysAnnouncementSend/getMessageUnreadList', editCementSend: '/sys/sysAnnouncementSend/editByAnntIdAndUserId', queryById: '/sys/annountCement/queryById', - readAllMsg:'sys/sysAnnouncementSend/read', + readAllMsg: 'sys/sysAnnouncementSend/read' }, hovered: false, announcement1: [], announcement2: [], msg1Count: '0', msg2Count: '0', - msg1Title: this.$t('MessageNotification')+'(0)', + msg1Title: this.$t('MessageNotification') + '(0)', msg2Title: '', stopTimer: false, websock: null, @@ -86,17 +86,6 @@ this.websocketOnclose() }, methods: { - timerFun() { - this.stopTimer = false - let myTimer = setInterval(() => { - // 停止定时器 - if (this.stopTimer == true) { - clearInterval(myTimer) - return - } - this.loadData() - }, 6000) - }, loadData() { try { // 获取系统消息 @@ -104,7 +93,7 @@ if (res.success) { this.announcement1 = res.result this.msg1Count = res.result.length - this.msg1Title = this.$t('MessageNotification')+'(' + res.result.length + ')' + this.msg1Title = this.$t('MessageNotification') + '(' + res.result.length + ')' } }).catch(error => { this.stopTimer = true @@ -158,16 +147,9 @@ this.reconnect() }, websocketOnmessage: function(e) { - console.log(e) - console.log('-----接收消息-------', e.data) - var data = eval('(' + e.data + ')') //解析对象 - if (data.cmd == 'topic') { - //系统通知 - this.loadData() - } else if (data.cmd == 'user') { - //用户消息 - this.loadData() - } + console.log('-----接收消息-------', e) + //系统通知 + this.loadData() }, websocketOnclose: function(e) { console.log('connection closed (' + e + ')') @@ -198,6 +180,7 @@ heartCheckFun() { var that = this //心跳检测,每20s心跳一次 + console.log(123) that.heartCheck = { timeout: 20000, timeoutObj: null,