mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-16 22:22:49 +00:00
perf: 优化消息窗口显示
This commit is contained in:
parent
0f250dbafd
commit
38b50a8a84
@ -542,8 +542,8 @@ export default {
|
|||||||
},
|
},
|
||||||
// 与我的机器人聊天
|
// 与我的机器人聊天
|
||||||
chatMybot(userid) {
|
chatMybot(userid) {
|
||||||
this.$store.dispatch("openDialogUserid", userid).then(_ => {
|
this.$store.dispatch("openDialogUserid", userid).then(route => {
|
||||||
this.mybotShow = false;
|
route && (this.mybotShow = false)
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg || this.$L('打开会话失败'))
|
$A.modalError(msg || this.$L('打开会话失败'))
|
||||||
});
|
});
|
||||||
@ -635,8 +635,9 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (dialogId) {
|
if (dialogId) {
|
||||||
this.$store.dispatch("openDialog", dialogId)
|
this.$store.dispatch("openDialog", dialogId).then(route => {
|
||||||
this.aibotShow = false
|
route && (this.aibotShow = false)
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -645,8 +646,8 @@ export default {
|
|||||||
url: 'users/search/ai',
|
url: 'users/search/ai',
|
||||||
data: {type},
|
data: {type},
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
this.$store.dispatch("openDialogUserid", data.userid).then(_ => {
|
this.$store.dispatch("openDialogUserid", data.userid).then(route => {
|
||||||
this.aibotShow = false;
|
route && (this.aibotShow = false)
|
||||||
}).catch(({ msg }) => {
|
}).catch(({ msg }) => {
|
||||||
$A.modalError(msg)
|
$A.modalError(msg)
|
||||||
}).finally(_ => {
|
}).finally(_ => {
|
||||||
|
|||||||
@ -516,11 +516,17 @@ export default {
|
|||||||
if (!/^\d+$/.test(userid)) {
|
if (!/^\d+$/.test(userid)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.$store.dispatch("openDialogUserid", userid).then(_ => {
|
this.$store.dispatch("openDialogUserid", userid).then(route => {
|
||||||
if (this.$parent.$options.name === "DrawerOverlayView") {
|
if (!route) {
|
||||||
this.$parent.onClose()
|
return;
|
||||||
} else if (this.$parent.$options.name === "Modal") {
|
}
|
||||||
this.$parent.close()
|
switch (this.$parent.$options.name) {
|
||||||
|
case "DrawerOverlayView":
|
||||||
|
this.$parent.onClose()
|
||||||
|
break;
|
||||||
|
case "Modal":
|
||||||
|
this.$parent.close()
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg)
|
$A.modalError(msg)
|
||||||
|
|||||||
22
resources/assets/js/store/actions.js
vendored
22
resources/assets/js/store/actions.js
vendored
@ -3057,7 +3057,7 @@ export default {
|
|||||||
//
|
//
|
||||||
if (single_window) {
|
if (single_window) {
|
||||||
dispatch('openDialogNewWindow', dialog_id);
|
dispatch('openDialogNewWindow', dialog_id);
|
||||||
resolve()
|
resolve(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
@ -3065,10 +3065,9 @@ export default {
|
|||||||
state.dialogSearchMsgId = search_msg_id;
|
state.dialogSearchMsgId = search_msg_id;
|
||||||
state.dialogMsgId = dialog_msg_id;
|
state.dialogMsgId = dialog_msg_id;
|
||||||
state.dialogId = dialog_id;
|
state.dialogId = dialog_id;
|
||||||
if (dialog_id > 0 && state.windowLandscape) {
|
const route = dialog_id > 0 && state.windowLandscape
|
||||||
$A.goForward({name: 'manage-messenger', params: {dialogAction: 'dialog'}});
|
route && $A.goForward({name: 'manage-messenger', params: {dialogAction: 'dialog'}});
|
||||||
}
|
resolve(route)
|
||||||
resolve()
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -3102,7 +3101,7 @@ export default {
|
|||||||
* @param userid
|
* @param userid
|
||||||
*/
|
*/
|
||||||
openDialogUserid({state, dispatch}, userid) {
|
openDialogUserid({state, dispatch}, userid) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(async (resolve, reject) => {
|
||||||
const dialog = state.cacheDialogs.find(item => {
|
const dialog = state.cacheDialogs.find(item => {
|
||||||
if (item.type !== 'user' || !item.dialog_user) {
|
if (item.type !== 'user' || !item.dialog_user) {
|
||||||
return false
|
return false
|
||||||
@ -3110,9 +3109,8 @@ export default {
|
|||||||
return item.dialog_user.userid === userid
|
return item.dialog_user.userid === userid
|
||||||
});
|
});
|
||||||
if (dialog) {
|
if (dialog) {
|
||||||
dispatch("openDialog", dialog.id);
|
const route = await dispatch("openDialog", dialog.id);
|
||||||
resolve(dialog);
|
return resolve(route);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
url: 'dialog/open/user',
|
url: 'dialog/open/user',
|
||||||
@ -3120,10 +3118,10 @@ export default {
|
|||||||
userid,
|
userid,
|
||||||
},
|
},
|
||||||
spinner: 600
|
spinner: 600
|
||||||
}).then(({data}) => {
|
}).then(async ({data}) => {
|
||||||
dispatch("saveDialog", data);
|
dispatch("saveDialog", data);
|
||||||
dispatch("openDialog", data.id);
|
const route = await dispatch("openDialog", data.id);
|
||||||
resolve(data);
|
resolve(route);
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
console.warn(e);
|
console.warn(e);
|
||||||
reject(e);
|
reject(e);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user