diff --git a/resources/assets/js/pages/manage.vue b/resources/assets/js/pages/manage.vue index 4632c10b..df171026 100644 --- a/resources/assets/js/pages/manage.vue +++ b/resources/assets/js/pages/manage.vue @@ -337,6 +337,7 @@ export default { 'taskId', 'wsOpenNum', 'columnTemplate', + 'dialogOpenId', 'themeMode', 'themeList', @@ -449,7 +450,7 @@ export default { natificationHidden(val) { clearTimeout(this.notificationTimeout); - if (!val) { + if (!val && this.notificationClass) { this.notificationTimeout = setTimeout(() => { this.notificationClass.close(); }, 6000); @@ -674,39 +675,44 @@ export default { }, addDialogMsg(data) { - if (this.natificationHidden && this.natificationReady) { - const {id, dialog_id, type, msg} = data; - let body = ''; - switch (type) { - case 'text': - body = msg.text; - break; - case 'file': - body = '[' + this.$L(msg.type == 'img' ? '图片信息' : '文件信息') + ']' - break; - default: - return; - } - this._notificationId = id; - this.notificationClass.replaceOptions({ - icon: $A.originUrl('images/logo.png'), - body: body, - data: data, - tag: "dialog", - requireInteraction: true - }); - let dialog = this.cacheDialogs.find((item) => item.id == dialog_id); - if (dialog) { - this.notificationClass.replaceTitle(dialog.name); - this.notificationClass.userAgreed(); - } else { - this.$store.dispatch("getDialogOne", dialog_id).then(({data}) => { - if (this._notificationId === id) { - this.notificationClass.replaceTitle(data.name); - this.notificationClass.userAgreed(); - } - }).catch(() => {}) - } + if (!this.natificationReady) { + return; + } + if (!this.natificationHidden && this.curPath == "/manage/messenger" && this.dialogOpenId == data.dialog_id) { + return; + } + // + const {id, dialog_id, type, msg} = data; + let body = ''; + switch (type) { + case 'text': + body = msg.text; + break; + case 'file': + body = '[' + this.$L(msg.type == 'img' ? '图片信息' : '文件信息') + ']' + break; + default: + return; + } + this._notificationId = id; + this.notificationClass.replaceOptions({ + icon: $A.originUrl('images/logo.png'), + body: body, + data: data, + tag: "dialog", + requireInteraction: true + }); + let dialog = this.cacheDialogs.find((item) => item.id == dialog_id); + if (dialog) { + this.notificationClass.replaceTitle(dialog.name); + this.notificationClass.userAgreed(); + } else { + this.$store.dispatch("getDialogOne", dialog_id).then(({data}) => { + if (this._notificationId === id) { + this.notificationClass.replaceTitle(data.name); + this.notificationClass.userAgreed(); + } + }).catch(() => {}) } }, diff --git a/resources/assets/js/pages/manage/messenger.vue b/resources/assets/js/pages/manage/messenger.vue index 007f1d59..8d5b377b 100644 --- a/resources/assets/js/pages/manage/messenger.vue +++ b/resources/assets/js/pages/manage/messenger.vue @@ -199,6 +199,10 @@ export default { this.getContactsList(1); } }, + dialogId(id) { + $A.setStorage("messenger::dialogId", id); + this.$store.state.dialogOpenId = id; + }, dialogOpenId(id) { this.dialogId = id; }, @@ -247,11 +251,9 @@ export default { closeDialog() { this.dialogId = 0; - $A.setStorage("messenger::dialogId", 0) }, openDialog(dialog, smooth) { - $A.setStorage("messenger::dialogId", dialog.id) this.dialogId = dialog.id; this.scrollIntoActive(smooth); },