This commit is contained in:
fan 2023-11-30 14:12:06 +08:00
commit 90a87a73e1
2 changed files with 28 additions and 16 deletions

View File

@ -142,6 +142,7 @@ export default {
}, },
methods: { methods: {
stopNoReadPlay() { stopNoReadPlay() {
this.play = false;
this.currentAudioList = []; this.currentAudioList = [];
this.messageList.forEach(item => { this.messageList.forEach(item => {
this.$set(item, 'activeAuto', false); this.$set(item, 'activeAuto', false);
@ -275,10 +276,6 @@ export default {
}, },
// //
stopRecording() { stopRecording() {
if (this.seconds < 1) {
this.$message.info('录制语音时间太短!');
return;
}
this.audioPlay = true; this.audioPlay = true;
clearInterval(this.inter); clearInterval(this.inter);
this.seconds = 0; this.seconds = 0;
@ -407,6 +404,10 @@ export default {
} }
}).catch(() => { console.error('操作失败!'); }); }).catch(() => { console.error('操作失败!'); });
} else { } else {
if (this.seconds < 1) {
this.$message.info('为保证语言质量录制时长不能小于1秒');
return;
}
this.stopRecording(); // this.stopRecording(); //
} }
} }

View File

@ -183,7 +183,10 @@ export default {
return item.id == val.id; return item.id == val.id;
}); });
if (find) { 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)) { if (!this.id && this.privateChatId && this.privateChatId == this.getPrivateChatId(find)) {
this.id = val.id; this.id = val.id;
} }
@ -556,6 +559,10 @@ export default {
return objectIsEqual(m1.sort(), m2.sort()); return objectIsEqual(m1.sort(), m2.sort());
}, },
groupClick(item) { groupClick(item) {
if (this.$refs.chatContentRef && this.$refs.chatContentRef.recordSending) {
this.$message.info('请结束正在录制的语音!');
return;
}
this.id = item.id || 0; this.id = item.id || 0;
if (item.type == 'GROUP_CHAT') { if (item.type == 'GROUP_CHAT') {
this.privateChatId = ''; this.privateChatId = '';
@ -580,19 +587,23 @@ export default {
setReadGroup() { setReadGroup() {
if (!this.id || !this.dialogVisible) { return; } if (!this.id || !this.dialogVisible) { return; }
const id = this.id; 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.$nextTick(() => {
this.$refs.chatContentRef && this.$refs.chatContentRef.playNoReadMessage(); 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() { handleClose() {