From f9f7e6e45d2d086629bcef4cb7d53db08c77e898 Mon Sep 17 00:00:00 2001 From: wangyifeng <812766448@qq.com> Date: Wed, 26 Mar 2025 19:51:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=8A=E4=BC=A0=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=9D=A1=EF=BC=9B=E5=A4=84=E7=90=86=E5=A4=9A=E9=80=89?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=9A=84=E5=8F=96=E6=B6=88=EF=BC=9B=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=8F=91=E9=80=81=E5=9B=BE=E7=89=87=E5=AF=B9=E6=96=B9?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=9B=B4=E6=96=B0=EF=BC=9B=E5=A4=84=E7=90=86?= =?UTF-8?q?=E8=A7=A3=E6=95=A3=E7=BE=A4=E3=80=81=E8=B8=A2=E4=BA=BA=E5=9C=A8?= =?UTF-8?q?=E5=AF=B9=E6=96=B9=E4=BC=9A=E8=AF=9D=E5=88=97=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=AF=A5=E4=BC=9A=E8=AF=9D=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/event/talk.js | 15 +++++++- src/pages/dialog/components/filePanel.vue | 44 ++++++++++++++++++++-- src/pages/dialog/index.vue | 28 +++++++++++--- src/store/modules/dialogue.js | 2 +- src/store/modules/dialogueList.js | 2 + src/store/modules/uploads.ts | 45 ++++++++++++++++++----- src/utils/upload/request.js | 5 +++ 7 files changed, 121 insertions(+), 20 deletions(-) diff --git a/src/event/talk.js b/src/event/talk.js index 1a0879f..bc43672 100644 --- a/src/event/talk.js +++ b/src/event/talk.js @@ -109,7 +109,7 @@ class Talk extends Base { // useSettingsStore().isPromptTone && palyMusic() } - handle() { + async handle() { // 不是自己发送的消息则需要播放提示音 if (!this.isCurrSender()) { this.play() @@ -117,7 +117,18 @@ class Talk extends Base { // 判断会话列表是否存在,不存在则创建 if (useTalkStore().findTalkIndex(this.getIndexName()) == -1) { - return this.addTalkItem() + if (this.resource.msg_type == 1106) { + //群解散时,需要热更新会话列表 + await useTalkStore().loadTalkList() + } else if ( + this.resource.msg_type == 1104 || + this.resource.msg_type == 1115 + ) { + //群成员被移出时,需要热更新会话列表 + await useTalkStore().loadTalkList() + } else { + return this.addTalkItem() + } } // 判断当前是否正在和好友对话 diff --git a/src/pages/dialog/components/filePanel.vue b/src/pages/dialog/components/filePanel.vue index efb0d75..27470ad 100644 --- a/src/pages/dialog/components/filePanel.vue +++ b/src/pages/dialog/components/filePanel.vue @@ -206,6 +206,12 @@ const onUploadImageVideo = async (file, type = 'image', fileUrl) => { uploadImg(form, (e) => onProgressFn(e, randomId)).then( ({ status, data, msg }) => { if (status == 0) { + // 更新上传状态为成功 + const index = virtualList.value.findIndex(item => item.file_num === randomId) + if (index !== -1) { + virtualList.value[index].uploadStatus = 2 + virtualList.value[index].uploadCurrent = 100 + } resolve({ type: 'image', url: data.ori_url, @@ -215,6 +221,11 @@ const onUploadImageVideo = async (file, type = 'image', fileUrl) => { file_num: randomId, }) } else { + // 更新上传状态为失败 + const index = virtualList.value.findIndex(item => item.file_num === randomId) + if (index !== -1) { + virtualList.value[index].uploadStatus = 3 + } resolve('') message.error(msg) } @@ -261,6 +272,12 @@ const onUploadImageVideo = async (file, type = 'image', fileUrl) => { uploadImg(form, (e) => onProgressFn(e, randomId)).then( ({ status, data, msg }) => { if (status == 0) { + // 更新上传状态为成功 + const index = virtualList.value.findIndex(item => item.file_num === randomId) + if (index !== -1) { + virtualList.value[index].uploadStatus = 2 + virtualList.value[index].uploadCurrent = 100 + } console.log(data) resolve({ type: 'video', @@ -271,8 +288,13 @@ const onUploadImageVideo = async (file, type = 'image', fileUrl) => { file_num: randomId, }) } else { - // resolve('') - // message.error(msg) + // 更新上传状态为失败 + const index = virtualList.value.findIndex(item => item.file_num === randomId) + if (index !== -1) { + virtualList.value[index].uploadStatus = 3 + } + resolve('') + message.error(msg) } }, ) @@ -456,7 +478,23 @@ const chooseFile = () => { uploadStatus: 1, // 1 上传中 2 上传成功 3 上传失败 } virtualList.value.unshift(newItem) - uploadsStore.initUploadFile(res.tempFiles[0], props.talkParams, randomId) + uploadsStore.initUploadFile(res.tempFiles[0], props.talkParams, randomId, (status, data, msg) => { + if (status === 0) { + // 更新上传状态为成功 + const index = virtualList.value.findIndex(item => item.file_num === randomId) + if (index !== -1) { + virtualList.value[index].uploadStatus = 2 + virtualList.value[index].uploadCurrent = 100 + } + } else { + // 更新上传状态为失败 + const index = virtualList.value.findIndex(item => item.file_num === randomId) + if (index !== -1) { + virtualList.value[index].uploadStatus = 3 + } + message.error(msg) + } + }) }, }) } diff --git a/src/pages/dialog/index.vue b/src/pages/dialog/index.vue index 78dfce0..831a4c2 100644 --- a/src/pages/dialog/index.vue +++ b/src/pages/dialog/index.vue @@ -16,7 +16,14 @@ @scrolltoupper="onScrollToUpper" >