剧本代码调整

This commit is contained in:
joylink_cuiweidong 2020-05-14 19:13:44 +08:00
parent 396dd0d899
commit ddbf334419
5 changed files with 35 additions and 17 deletions

View File

@ -141,14 +141,12 @@ function handleSimulationInfo(state, data) {
const myDate1 = myDate.toLocaleDateString().replace(/\//g, '-'); const myDate1 = myDate.toLocaleDateString().replace(/\//g, '-');
const chatTime = /\d{2}:\d{2}:\d{2}/.exec(data.chatTime)[0] || data.chatTime; const chatTime = /\d{2}:\d{2}:\d{2}/.exec(data.chatTime)[0] || data.chatTime;
const params = { const params = {
conversationId:data.conversationId, id:data.conversationId,
self: isSelf, self: isSelf,
message: data.message, message: data.message,
voice: data.isAudio, voice: data.isAudio,
src: data.isAudio ? `/jlcloud/audio/${data.audioPath}` : '', src: data.isAudio ? `/jlcloud/audio/${data.audioPath}` : '',
member:data.member, member:data.member,
memberName:data.member.name,
memberRole:data.member.role,
memberOnline:data.member.online, memberOnline:data.member.online,
chatTime: data.chatTime, chatTime: data.chatTime,
targetOnline:data.targetMember ? data.targetMember.online : null, targetOnline:data.targetMember ? data.targetMember.online : null,

View File

@ -19,7 +19,7 @@
</div> </div>
</div> </div>
<div class="chat-box-content"> <div class="chat-box-content">
<chat-content ref="chatContent" :current-coversition="currentCoversition" /> <chat-content ref="chatContent" :current-coversition="currentCoversition" @addCoversition="addCoversition" />
<div v-if="recordSending" class="chat_record_tip"> <div v-if="recordSending" class="chat_record_tip">
<div id="record_progress_bar" :style="'width:'+100/60*seconds+'%'" /> <div id="record_progress_bar" :style="'width:'+100/60*seconds+'%'" />
<div class="record_icon" /> <div class="record_icon" />
@ -115,9 +115,11 @@ export default {
this.headerTitle = headerTitle; this.headerTitle = headerTitle;
}, },
addCoversition({data, headerTitle}) { addCoversition({data, headerTitle}) {
this.$refs.chatCoversitionList.addCoversition(data); this.$refs.chatCoversitionList.addCoversition(data, headerTitle);
this.currentCoversition = {id:data.id, group:data.group}; if (headerTitle) {
this.headerTitle = headerTitle; this.currentCoversition = {id:data.id, group:data.group};
this.headerTitle = headerTitle;
}
}, },
// //
startRecording() { startRecording() {

View File

@ -8,7 +8,7 @@
</div> </div>
<div class="userBubble" @click="playAudio('audio'+index)"> <div class="userBubble" @click="playAudio('audio'+index)">
<div class="userMessage"> <div class="userMessage">
<span v-if="chatContent.group||!(chatContent.member && chatContent.member.robot)">@{{ covertName(chatContent.targetName) }}</span> <span v-if="chatContent.group&&!(chatContent.member && chatContent.member.robot)">@{{ covertName(chatContent.targetName) }}</span>
<span class="el-icon-video-play playicon" /> <span class="el-icon-video-play playicon" />
<span class="messageText">{{ chatContent.message }}</span> <span class="messageText">{{ chatContent.message }}</span>
<audio :id="'audio'+index" :src="baseUrl+chatContent.src" style="display:none" /> <audio :id="'audio'+index" :src="baseUrl+chatContent.src" style="display:none" />
@ -38,8 +38,11 @@ export default {
}, },
watch:{ watch:{
'$store.state.socket.simulationText':function (val, old) { // 仿 '$store.state.socket.simulationText':function (val, old) { // 仿
if (this.currentCoversition.id == val.conversationId) { const simulationText = this.$store.state.socket.simulationText;
const simulationText = this.$store.state.socket.simulationText; if (this.currentCoversition.id == val.id) {
this.chatContentList.push(simulationText);
} else {
this.$emit('addCoversition', {data:simulationText, headerTitle:''});
this.chatContentList.push(simulationText); this.chatContentList.push(simulationText);
} }
}, },
@ -68,9 +71,7 @@ export default {
coversition.self = true; coversition.self = true;
} }
coversition.src = coversition.isAudio ? `/jlcloud/audio/${coversition.audioPath}` : ''; coversition.src = coversition.isAudio ? `/jlcloud/audio/${coversition.audioPath}` : '';
coversition.memberName = coversition.member.name;
coversition.targetName = coversition.targetMember ? coversition.targetMember : 'All'; coversition.targetName = coversition.targetMember ? coversition.targetMember : 'All';
coversition.memberRole = coversition.member.role;
return coversition; return coversition;
}); });
this.chatContentList = coversitionList; this.chatContentList = coversitionList;

View File

@ -45,14 +45,17 @@ export default {
} }
}); });
}, },
addCoversition(data) { addCoversition(data, headerTitle) {
const index = this.coversitionList.findIndex(item=>{ return item.id == data.id; }); const index = this.coversitionList.findIndex(item=>{ return item.id == data.id; });
if (index < 0) { if (index < 0) {
debugger;
const objectCover = this.handleMemberName(data); const objectCover = this.handleMemberName(data);
data.coverName = objectCover.coversitionName; data.coverName = objectCover.coversitionName;
data.isOnline = objectCover.isOnline; data.isOnline = objectCover.isOnline;
this.coversitionList.push(data); this.coversitionList.push(data);
this.currentCoversition = data; if (headerTitle) {
this.currentCoversition = data;
}
} }
}, },
changeCoversition(coversition) { changeCoversition(coversition) {
@ -86,6 +89,22 @@ export default {
coversitionName = data + deviceName + memberName; coversitionName = data + deviceName + memberName;
} }
}); });
} else if (conversition.member) {
const member = conversition.member;
let data = member.role;
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
roleTypeList.forEach(function(element) {
const rolename = element.value;
if (Cookies.get('user_lang') == 'en') {
data = data.replace(rolename, element.enLabel);
} else {
data = data.replace(rolename, element.label);
}
});
const deviceName = member.deviceName ? '-' + member.deviceName : '';
const memberName = member.name ? '-' + member.name : '';
isOnline = member.online;
coversitionName = data + deviceName + memberName;
} else { } else {
coversitionName = conversition.name; coversitionName = conversition.name;
} }

View File

@ -8,7 +8,7 @@
</div> </div>
<div class="userBubble" @click="playAudio('audio'+index)"> <div class="userBubble" @click="playAudio('audio'+index)">
<div class="userMessage"> <div class="userMessage">
<span v-if="chatContent.group||!chatContent.member.robot">@{{ covertName(chatContent.targetName) }}</span> <span v-if="chatContent.group&&!chatContent.member.robot">@{{ covertName(chatContent.targetName) }}</span>
<span class="el-icon-video-play playicon" /> <span class="el-icon-video-play playicon" />
<span class="messageText">{{ chatContent.message }}</span> <span class="messageText">{{ chatContent.message }}</span>
<audio :id="'audio'+index" :src="baseUrl+chatContent.src" style="display:none" /> <audio :id="'audio'+index" :src="baseUrl+chatContent.src" style="display:none" />
@ -68,9 +68,7 @@ export default {
coversition.self = true; coversition.self = true;
} }
coversition.src = coversition.isAudio ? `/jlcloud/audio/${coversition.audioPath}` : ''; coversition.src = coversition.isAudio ? `/jlcloud/audio/${coversition.audioPath}` : '';
coversition.memberName = coversition.member.name;
coversition.targetName = coversition.targetMember ? coversition.targetMember : 'All'; coversition.targetName = coversition.targetMember ? coversition.targetMember : 'All';
coversition.memberRole = coversition.member.role;
return coversition; return coversition;
}); });
this.chatContentList = coversitionList; this.chatContentList = coversitionList;