diff --git a/src/layout/components/TopNotice/index.vue b/src/layout/components/TopNotice/index.vue index 1b333e12..0d970434 100644 --- a/src/layout/components/TopNotice/index.vue +++ b/src/layout/components/TopNotice/index.vue @@ -91,6 +91,8 @@ export default { alertList:[], noReadNoticeCount:0, noticeList: [], + // 剔除重复消息 + filterMap:new Map(), xdNoticSdk:null, @@ -160,12 +162,20 @@ export default { return; } - this.playTone(); + + + // this.playTone(); var messageBody = evt.title; let noticeId= evt.noticeId; - // Notification.closeAll(); + // 如果有重复消息,则过滤 + if(this.filterMap.has(messageBody)) { // 如果有该key值 + return ; + } + this.filterMap.set(messageBody, true); + + // Notification.closeAll(); // this.speech.speak({ text: messageBody }).then(() => { // console.log("读取成功"); // });