From 3055eccb82d6b3670f7f7e5c505d90838ecfe4d5 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sun, 17 Jul 2022 13:56:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=9A=E4=BD=8D=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/manage/components/DialogWrapper.vue | 53 ++++++++++++++----- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index c05d4634b..e961df90e 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -383,7 +383,7 @@ @on-down-file="onDownFile" @on-emoji="onEmoji" simpleView/> - +
@@ -497,6 +497,7 @@ export default { }, todoViewLoad: false, + todoViewPosLoad: false, todoViewShow: false, todoViewData: {}, todoViewMid: 0, @@ -742,12 +743,13 @@ export default { handler(dialog_id) { if (dialog_id) { this.msgNew = 0 + this.msgType = '' + this.replyActiveId = 0 // if (this.allMsgList.length > 0) { this.allMsgs = this.allMsgList requestAnimationFrame(this.onToBottom) } - this.msgType = ''; this.$store.dispatch("getDialogMsgs", { dialog_id, msg_id: this.msgId, @@ -924,8 +926,8 @@ export default { setTimeout(_ => { this.tempMsgs.push(tempMsg) this.msgType = '' - this.replyActiveId = 0; - this.onActive(); + this.replyActiveId = 0 + this.onActive() this.$nextTick(this.onToBottom) // this.$store.dispatch("call", { @@ -963,6 +965,7 @@ export default { } this.tempMsgs.push(tempMsg) this.msgType = '' + this.replyActiveId = 0 this.onActive() this.$nextTick(this.onToBottom) // @@ -988,7 +991,6 @@ export default { sendFileMsg(row) { const files = $A.isArray(row) ? row : [row]; if (files.length > 0) { - this.msgType = ''; this.pasteFile = []; this.pasteItem = []; files.some(file => { @@ -1045,11 +1047,34 @@ export default { } }, - onPositionId(position_id, msg_id = 0) { - return new Promise(resolve => { + onPositionId(position_id, msg_id = 0, loop_num = 0) { + return new Promise((resolve, reject) => { if (position_id === 0) { + $A.modalError("查看失败:参数错误") + reject() return } + // + if (this.loadMsg || this.msgType != '') { + this.msgType = '' + if (loop_num === 0) { + this.$store.dispatch("showSpinner", 600) + } else if (loop_num > 20) { + this.$store.dispatch("hiddenSpinner") + $A.modalError("查看失败:请求超时") + reject() + return; + } + loop_num++ + setTimeout(_ => { + this.onPositionId(position_id, msg_id, loop_num).then(resolve).catch(reject) + }, Math.min(600, 100 * loop_num)) + return; + } + if (loop_num > 0) { + this.$store.dispatch("hiddenSpinner") + } + // const index = this.allMsgs.findIndex(item => item.id === position_id) if (index > -1) { this.onToIndex(index) @@ -1061,7 +1086,6 @@ export default { delay: 600 }) } - this.msgType = ''; this.preventToBottom = true; this.$store.dispatch("getDialogMsgs", { dialog_id: this.dialogId, @@ -1116,7 +1140,10 @@ export default { if (!this.todoViewMid) { return } - this.onPositionId(this.todoViewMid).then(this.onCloseTodo) + this.todoViewPosLoad = true + this.onPositionId(this.todoViewMid).then(this.onCloseTodo).finally(_ => { + this.todoViewPosLoad = false + }) }, onDoneTodo() { @@ -1229,15 +1256,17 @@ export default { chatFile(type, file) { switch (type) { case 'progress': - this.tempMsgs.push({ + const tempMsg = { id: file.tempId, dialog_id: this.dialogData.id, reply_id: this.replyId, type: 'loading', userid: this.userId, msg: { }, - }) - this.replyActiveId = 0; + } + this.tempMsgs.push(tempMsg) + this.msgType = '' + this.replyActiveId = 0 this.onActive() this.$nextTick(this.onToBottom) break;