diff --git a/resources/assets/js/pages/manage.vue b/resources/assets/js/pages/manage.vue index 129a594f..d0e2123c 100644 --- a/resources/assets/js/pages/manage.vue +++ b/resources/assets/js/pages/manage.vue @@ -345,7 +345,7 @@ export default { msgAllUnread() { let num = 0; - this.cacheDialogs.map(({unread}) => { + this.cacheDialogs.some(({unread}) => { if (unread) { num += unread; } diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index ddc17f13..2e653b03 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -329,7 +329,6 @@ export default { sendSuccess(data) { this.$store.dispatch("saveDialogMsg", data); this.$store.dispatch("increaseTaskMsgNum", this.dialogId); - this.$store.dispatch("moveDialogTop", this.dialogId); this.$store.dispatch("updateDialogLastMsg", data); this.onActive(); }, diff --git a/resources/assets/js/pages/manage/messenger.vue b/resources/assets/js/pages/manage/messenger.vue index fbdf9e32..6f01fd85 100644 --- a/resources/assets/js/pages/manage/messenger.vue +++ b/resources/assets/js/pages/manage/messenger.vue @@ -124,7 +124,14 @@ export default { dialogList() { const {dialogActive, dialogKey} = this; if (dialogActive == '' && dialogKey == '') { - return this.cacheDialogs.filter(({name}) => name !== undefined); + return this.cacheDialogs.filter(({name, last_at}) => { + if (name === undefined) { + return false; + } + return last_at; + }).sort((a, b) => { + return $A.Date(b.last_at) - $A.Date(a.last_at); + }); } return this.cacheDialogs.filter(({name, type, group_type, last_msg, last_at}) => { if (name === undefined) { @@ -159,14 +166,14 @@ export default { } return true; }).sort((a, b) => { - return $A.Date(a.last_at) - $A.Date(b.last_at); + return $A.Date(b.last_at) - $A.Date(a.last_at); }) }, msgUnread() { return function (type) { let num = 0; - this.cacheDialogs.map((dialog) => { + this.cacheDialogs.some((dialog) => { if (dialog.unread) { switch (type) { case 'project': @@ -231,10 +238,10 @@ export default { const dialog = this.dialogList.find(({unread}) => unread > 0) if (dialog) { try { - this.$refs[`dialog_${dialog.id}`][0].scrollIntoView({behavior: "smooth"}); + this.$refs[`dialog_${dialog.id}`][0].scrollIntoView(); } catch (e) { scrollIntoView(this.$refs[`dialog_${dialog.id}`][0], { - behavior: 'smooth', + behavior: 'instant', inline: 'end', }) } diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 24dec0a5..d8ce06e4 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -1749,22 +1749,6 @@ export default { }); }, - /** - * 将会话移动到首位 - * @param state - * @param dialog_id - */ - moveDialogTop({state}, dialog_id) { - $A.execMainDispatch("moveDialogTop", dialog_id) - // - const index = state.cacheDialogs.findIndex(({id}) => id == dialog_id); - if (index > -1) { - const tmp = $A.cloneJSON(state.cacheDialogs[index]); - state.cacheDialogs.splice(index, 1); - state.cacheDialogs.unshift(tmp); - } - }, - /** * 忘记对话数据 * @param state @@ -2026,8 +2010,6 @@ export default { if (dialog) { // 新增未读数 dialog.unread++; - // 移动到首位 - dispatch("moveDialogTop", dialog_id); } Store.set('dialogMsgPush', data); }