From 3a74cdc98b0bbb6f7d5b86d388a41ed7970b7a5f Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sun, 7 Jan 2024 14:26:42 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=B6=88=E6=81=AF=E7=BD=AE=E9=A1=B6?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/pages/manage/components/DialogWrapper.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index 9f4b39ac5..7f58a5839 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -2149,10 +2149,10 @@ export default { if (this.__markOffset === undefined) { return false } - this.onToOffset(scroller.getScrollSize() - this.__markOffset) + this.onToOffset(scroller.getScrollSize() - scroller.getClientSize() - this.__markOffset) this.__markOffset = undefined } else { - this.__markOffset = scroller.getScrollSize() - scroller.getOffset() + this.__markOffset = scroller.getScrollSize() - scroller.getClientSize() - scroller.getOffset() } return true }, @@ -3383,10 +3383,11 @@ export default { data: { msg_id: data.id }, - }).then(({ data, msg }) => { + }).then(async ({ data, msg }) => { resolve(msg) + this.onMarkOffset(false) // 取消置顶 - this.$store.dispatch("saveDialog", { + await this.$store.dispatch("saveDialog", { 'id' : this.dialogId, 'top_msg_id' : data.update?.top_msg_id || 0, 'top_userid' : data.update?.top_userid || 0 @@ -3395,9 +3396,10 @@ export default { if (data.update?.top_msg_id) { const index = this.dialogMsgs.findIndex(({ id }) => id == data.update.top_msg_id); if (index > -1) { - this.$store.dispatch("saveDialogMsgTop", Object.assign({}, this.dialogMsgs[index])) + await this.$store.dispatch("saveDialogMsgTop", Object.assign({}, this.dialogMsgs[index])) } } + this.onMarkOffset(true) }).catch(({ msg }) => { reject(msg); }).finally(_ => {