diff --git a/resources/assets/js/pages/manage/application.vue b/resources/assets/js/pages/manage/application.vue index bdfdadd55..5dc7e1fbc 100644 --- a/resources/assets/js/pages/manage/application.vue +++ b/resources/assets/js/pages/manage/application.vue @@ -542,8 +542,8 @@ export default { }, // 与我的机器人聊天 chatMybot(userid) { - this.$store.dispatch("openDialogUserid", userid).then(_ => { - this.mybotShow = false; + this.$store.dispatch("openDialogUserid", userid).then(route => { + route && (this.mybotShow = false) }).catch(({msg}) => { $A.modalError(msg || this.$L('打开会话失败')) }); @@ -635,8 +635,9 @@ export default { } }) if (dialogId) { - this.$store.dispatch("openDialog", dialogId) - this.aibotShow = false + this.$store.dispatch("openDialog", dialogId).then(route => { + route && (this.aibotShow = false) + }) return } // @@ -645,8 +646,8 @@ export default { url: 'users/search/ai', data: {type}, }).then(({data}) => { - this.$store.dispatch("openDialogUserid", data.userid).then(_ => { - this.aibotShow = false; + this.$store.dispatch("openDialogUserid", data.userid).then(route => { + route && (this.aibotShow = false) }).catch(({ msg }) => { $A.modalError(msg) }).finally(_ => { diff --git a/resources/assets/js/pages/manage/approve/details.vue b/resources/assets/js/pages/manage/approve/details.vue index 909b78195..b26f59570 100644 --- a/resources/assets/js/pages/manage/approve/details.vue +++ b/resources/assets/js/pages/manage/approve/details.vue @@ -516,11 +516,17 @@ export default { if (!/^\d+$/.test(userid)) { return } - this.$store.dispatch("openDialogUserid", userid).then(_ => { - if (this.$parent.$options.name === "DrawerOverlayView") { - this.$parent.onClose() - } else if (this.$parent.$options.name === "Modal") { - this.$parent.close() + this.$store.dispatch("openDialogUserid", userid).then(route => { + if (!route) { + return; + } + switch (this.$parent.$options.name) { + case "DrawerOverlayView": + this.$parent.onClose() + break; + case "Modal": + this.$parent.close() + break; } }).catch(({msg}) => { $A.modalError(msg) diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index e50f2e747..275532a91 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -3057,7 +3057,7 @@ export default { // if (single_window) { dispatch('openDialogNewWindow', dialog_id); - resolve() + resolve(false) return } // @@ -3065,10 +3065,9 @@ export default { state.dialogSearchMsgId = search_msg_id; state.dialogMsgId = dialog_msg_id; state.dialogId = dialog_id; - if (dialog_id > 0 && state.windowLandscape) { - $A.goForward({name: 'manage-messenger', params: {dialogAction: 'dialog'}}); - } - resolve() + const route = dialog_id > 0 && state.windowLandscape + route && $A.goForward({name: 'manage-messenger', params: {dialogAction: 'dialog'}}); + resolve(route) }) }) }, @@ -3102,7 +3101,7 @@ export default { * @param userid */ openDialogUserid({state, dispatch}, userid) { - return new Promise(function (resolve, reject) { + return new Promise(async (resolve, reject) => { const dialog = state.cacheDialogs.find(item => { if (item.type !== 'user' || !item.dialog_user) { return false @@ -3110,9 +3109,8 @@ export default { return item.dialog_user.userid === userid }); if (dialog) { - dispatch("openDialog", dialog.id); - resolve(dialog); - return; + const route = await dispatch("openDialog", dialog.id); + return resolve(route); } dispatch("call", { url: 'dialog/open/user', @@ -3120,10 +3118,10 @@ export default { userid, }, spinner: 600 - }).then(({data}) => { + }).then(async ({data}) => { dispatch("saveDialog", data); - dispatch("openDialog", data.id); - resolve(data); + const route = await dispatch("openDialog", data.id); + resolve(route); }).catch(e => { console.warn(e); reject(e);