diff --git a/src/views/newMap/display/newChat/chatContent.vue b/src/views/newMap/display/newChat/chatContent.vue index 44d25cb52..128705f66 100644 --- a/src/views/newMap/display/newChat/chatContent.vue +++ b/src/views/newMap/display/newChat/chatContent.vue @@ -142,6 +142,7 @@ export default { }, methods: { stopNoReadPlay() { + this.play = false; this.currentAudioList = []; this.messageList.forEach(item => { this.$set(item, 'activeAuto', false); @@ -275,10 +276,6 @@ export default { }, // 停止录制 发送语音 stopRecording() { - if (this.seconds < 1) { - this.$message.info('录制语音时间太短!'); - return; - } this.audioPlay = true; clearInterval(this.inter); this.seconds = 0; @@ -407,6 +404,10 @@ export default { } }).catch(() => { console.error('操作失败!'); }); } else { + if (this.seconds < 1) { + this.$message.info('为保证语言质量,录制时长不能小于1秒!'); + return; + } this.stopRecording(); // 发送语音 } } diff --git a/src/views/newMap/display/newChat/chatDialog.vue b/src/views/newMap/display/newChat/chatDialog.vue index 45e029543..0fe6956c5 100644 --- a/src/views/newMap/display/newChat/chatDialog.vue +++ b/src/views/newMap/display/newChat/chatDialog.vue @@ -183,7 +183,10 @@ export default { return item.id == val.id; }); if (find) { - find.messageList.push(val.message); + const fMess = find.messageList.find(ii => ii.id == val.message.id); + if (!fMess) { + find.messageList.push(val.message); + } if (!this.id && this.privateChatId && this.privateChatId == this.getPrivateChatId(find)) { this.id = val.id; } @@ -556,6 +559,10 @@ export default { return objectIsEqual(m1.sort(), m2.sort()); }, groupClick(item) { + if (this.$refs.chatContentRef && this.$refs.chatContentRef.recordSending) { + this.$message.info('请结束正在录制的语音!'); + return; + } this.id = item.id || 0; if (item.type == 'GROUP_CHAT') { this.privateChatId = ''; @@ -580,19 +587,23 @@ export default { setReadGroup() { if (!this.id || !this.dialogVisible) { return; } const id = this.id; - setGroupReadMessage(this.groupId, {id}).then(res => { - res.data.forEach(item => { - const obj = { - id: id, - message: { - ...item - } - }; - this.getMessageStatus(obj); - }); - }); this.$nextTick(() => { this.$refs.chatContentRef && this.$refs.chatContentRef.playNoReadMessage(); + setGroupReadMessage(this.groupId, {id}).then(() => { + const findG = this.groupList.find(item => { + return item.id == this.id; + }); + if (findG) { + findG.messageList.forEach(ii => { + if (!ii.readerSet.includes(this.myMemberId)) { + ii.readerSet.push(this.myMemberId); + if (objectIsEqual(findG.memberList.sort(), ii.readerSet.sort())) { + ii.allRead = true; + } + } + }); + } + }); }); }, handleClose() {