From ce3679230340ca6287e8ecedbf84a7749ee5839b Mon Sep 17 00:00:00 2001 From: kuaifan Date: Thu, 24 Jun 2021 22:09:03 +0800 Subject: [PATCH] no message --- resources/assets/js/pages/manage.vue | 20 +++++++++++++++---- .../assets/js/pages/manage/messenger.vue | 1 - resources/assets/js/store/actions.js | 3 ++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/resources/assets/js/pages/manage.vue b/resources/assets/js/pages/manage.vue index 2d18a38f..928520e2 100644 --- a/resources/assets/js/pages/manage.vue +++ b/resources/assets/js/pages/manage.vue @@ -220,6 +220,8 @@ export default { this.notificationClass.replaceOptions({ icon: user.userimg, body: body, + data: data, + tag: "dialog", requireInteraction: true }); this.notificationClass.userAgreed(); @@ -320,11 +322,21 @@ export default { this.notificationClass = new notificationKoro(this.$L("打开通知成功")); if (this.notificationClass.support) { this.notificationClass.notificationEvent({ - onclick: () => { - window.focus(); + onclick: ({target}) => { this.notificationClass.close(); - this.goForward({path: '/manage/messenger'}); - this.$store.dispatch("openDialogUserid", this.dialogMsgPush.userid); + window.focus(); + // + const {tag, data} = target; + if (tag == 'dialog') { + if (!$A.isJson(data)) { + return; + } + this.goForward({path: '/manage/messenger'}); + if (data.dialog_id) { + this.$store.state.method.setStorage("messenger::dialogId", data.dialog_id) + this.$store.state.dialogOpenId = data.dialog_id; + } + } }, }); this.notificationPermission(); diff --git a/resources/assets/js/pages/manage/messenger.vue b/resources/assets/js/pages/manage/messenger.vue index c3f5bdb2..b80b6590 100644 --- a/resources/assets/js/pages/manage/messenger.vue +++ b/resources/assets/js/pages/manage/messenger.vue @@ -147,7 +147,6 @@ export default { } }, dialogOpenId(id) { - this.$store.state.method.setStorage("messenger::dialogId", id) this.dialogId = id; } }, diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index c97b51a1..fee947bf 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -1128,6 +1128,7 @@ export default { }, }).then(result => { dispatch("saveDialog", result.data); + state.method.setStorage("messenger::dialogId", result.data.id); state.dialogOpenId = result.data.id; resolve(result); }).catch(e => { @@ -1381,7 +1382,6 @@ export default { const {mode, data} = msg; const {dialog_id} = data; // 更新消息列表 - state.dialogMsgPush = data; dispatch("saveDialogMsg", data) if (mode === "add" || mode === "chat") { // 新增任务消息数量 @@ -1397,6 +1397,7 @@ export default { // 移动到首位 dispatch("moveDialogTop", dialog_id); } + state.dialogMsgPush = data; } // 更新最后消息 dispatch("updateDialogLastMsg", data);