From b80953378c660a6e398c7273452b7a3ca5fbedbb Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Sun, 22 Aug 2021 15:30:26 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=B6=88=E6=81=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E6=98=BE=E7=A4=BA=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/notice/Notification.vue | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/frontend/src/business/components/notice/Notification.vue b/frontend/src/business/components/notice/Notification.vue index 940d4c228b..a6bce42d02 100644 --- a/frontend/src/business/components/notice/Notification.vue +++ b/frontend/src/business/components/notice/Notification.vue @@ -117,6 +117,9 @@ export default { let count = e.data; this.noticeCount = count; this.initIndex++; + if (count > 0) { + this.showNotification(); + } if (this.taskVisible && count > 0 && this.initEnd) { this.$refs.systemNotice.init(); this.$refs.mentionedMe.init(); @@ -144,6 +147,22 @@ export default { getNotifications() { this.initWebSocket(); }, + showNotification() { + this.result = this.$post('/notification/list/all/' + 1 + '/' + 10, {}, response => { + let data = response.data.listObject; + + data.filter(d => d.status === 'UNREAD').forEach(d => { + let title = d.type === 'MENTIONED_ME' ? '@提到我的' : '系统通知'; + setTimeout(() => { + this.$notify({ + title: title, + type: 'info', + message: d.content, + }); + }); + }); + }); + } } };