From 865dc61cd11782d46f28e3bf8647de406c4843ec Mon Sep 17 00:00:00 2001 From: kuaifan Date: Mon, 25 Dec 2023 21:29:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B7=B2=E7=9F=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/manage/components/DialogWrapper.vue | 10 +----- resources/assets/js/store/actions.js | 32 +++++++++---------- resources/assets/sass/dark.scss | 4 --- .../sass/pages/components/dialog-wrapper.scss | 2 +- 4 files changed, 17 insertions(+), 31 deletions(-) diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index 36f866152..eef006cf1 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -137,7 +137,7 @@ -
+
@@ -733,7 +733,6 @@ export default { positionLoad: 0, // 定位跳转加载中 firstMsgLength: 0, // 首次加载消息数量 isFirstShowTag: false, // 是否首次显示标签 - positionStatus: false, // 定位跳转状态 msgPreparedStatus: false, // 消息准备完成 listPreparedStatus: false, // 消息准备完成 selectedTextStatus: false, // 是否选择文本 @@ -1091,7 +1090,6 @@ export default { this.searchShow = false this.unreadMsgId = 0 this.firstMsgLength = this.allMsgList.length || 1 - this.positionStatus = false this.listPreparedStatus = false this.scrollToBottomAndRefresh = false // @@ -1341,12 +1339,6 @@ export default { } } }, - - readEnabled(val) { - if (!this.positionStatus && val) { - this.positionStatus = true - } - }, }, methods: { diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 56a1a36c0..e9d8f924d 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -2767,23 +2767,12 @@ export default { dispatch("saveDialogMsg", msg) }); } else if ($A.isJson(data)) { - let delay = false - if (typeof data.__delay__ !== "undefined") { - delete data.__delay__ - delay = true - } const index = state.dialogMsgs.findIndex(({id}) => id == data.id); data = Object.assign({}, state.dialogMsgs[index], data) if (index > -1) { state.dialogMsgs.splice(index, 1, data); } else { - if (delay) { - setTimeout(_ => { - state.dialogMsgs.push(data); - }, 100) - } else { - state.dialogMsgs.push(data); - } + state.dialogMsgs.push(data); } $A.IDBSave("dialogMsgs", state.dialogMsgs, 600) // @@ -3317,16 +3306,25 @@ export default { Store.set('dialogMsgPush', data); } } - // 更新消息列表 - dispatch("saveDialogMsg", Object.assign(data, {__delay__: true})) - // 更新最后消息 - dispatch("updateDialogLastMsg", data); + const saveMsg = (data, count) => { + if (count > 5 || state.dialogMsgs.find(({id}) => id == data.id)) { + // 更新消息列表 + dispatch("saveDialogMsg", data) + // 更新最后消息 + dispatch("updateDialogLastMsg", data); + return; + } + setTimeout(_ => { + saveMsg(data, ++count) + }, 20); + } + saveMsg(data, 0); break; case 'update': case 'readed': const updateMsg = (data, count) => { if (state.dialogMsgs.find(({id}) => id == data.id)) { - dispatch("saveDialogMsg", Object.assign(data, {__delay__: true})) + dispatch("saveDialogMsg", data) // 更新待办 if (typeof data.todo !== "undefined") { dispatch("getDialogTodo", dialog_id) diff --git a/resources/assets/sass/dark.scss b/resources/assets/sass/dark.scss index 77cc6d13c..0b4ca7910 100644 --- a/resources/assets/sass/dark.scss +++ b/resources/assets/sass/dark.scss @@ -499,10 +499,6 @@ body.dark-mode-reverse { color: #333; } } - - .mention { - color: #333; - } } } diff --git a/resources/assets/sass/pages/components/dialog-wrapper.scss b/resources/assets/sass/pages/components/dialog-wrapper.scss index 1b2e1333c..e855a5613 100644 --- a/resources/assets/sass/pages/components/dialog-wrapper.scss +++ b/resources/assets/sass/pages/components/dialog-wrapper.scss @@ -1449,7 +1449,7 @@ opacity: 0; transform: translateX(100%); animation: position-in-animation 200ms ease-out forwards; - animation-delay: 300ms; + animation-delay: 600ms; .position-label { display: flex;