会话问题调整

This commit is contained in:
fan 2022-12-02 17:53:10 +08:00
parent 4dff079c60
commit 2f5444e27f
2 changed files with 9 additions and 4 deletions

View File

@ -610,6 +610,7 @@ const socket = {
commit('setSimulationWorkParam', data); commit('setSimulationWorkParam', data);
}, },
setConversationMessage: ({ commit }, message) => { setConversationMessage: ({ commit }, message) => {
console.log('----------------');
commit('setConversationMessage', message); commit('setConversationMessage', message);
} }
} }

View File

@ -95,9 +95,11 @@ export default {
this.messageList = []; this.messageList = [];
}, },
'$store.state.socket.conversationMessage':function (val) { // 仿 '$store.state.socket.conversationMessage':function (val) { // 仿
this.messageList.push(val); const message = {...val};
this.messageList.push(message);
console.log(val, '----------');
if (val.memberId != this.myMemberId) { if (val.memberId != this.myMemberId) {
this.currentAudioList.push(val); this.currentAudioList.push(message);
if (!this.isPlay) { if (!this.isPlay) {
this.playAllAudio(); this.playAllAudio();
} }
@ -131,11 +133,12 @@ export default {
this.$set(this.currentMessage, 'activeAuto', true); this.$set(this.currentMessage, 'activeAuto', true);
this.play = true; this.play = true;
document.querySelector('#audioPlay').onended = () => { document.querySelector('#audioPlay').onended = () => {
this.$set(this.currentMessage, 'activeAuto', false);
if (!this.currentAudioList || !this.currentAudioList.length) { if (!this.currentAudioList || !this.currentAudioList.length) {
this.play = false; this.play = false;
} } else {
this.$set(this.currentMessage, 'activeAuto', false);
this.playAllAudio(); this.playAllAudio();
}
}; };
}); });
}, },
@ -425,6 +428,7 @@ export default {
margin-top: 10px; margin-top: 10px;
display: inline-block; display: inline-block;
max-width: 80%; max-width: 80%;
text-align: right;
} }
.userHeader{margin-bottom: 2px;} .userHeader{margin-bottom: 2px;}
.userName{font-size: 12px;display:inline-block;margin-right:10px;} .userName{font-size: 12px;display:inline-block;margin-right:10px;}