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" >