调整剧本会话@

This commit is contained in:
fan 2020-07-30 16:33:08 +08:00
parent 71d3ff5d87
commit 0a7d3d97bd
2 changed files with 11 additions and 47 deletions

View File

@ -47,38 +47,16 @@ export default {
formatTime(time) { formatTime(time) {
return /\d{2}:\d{2}:\d{2}/.exec(time)[0] || time; return /\d{2}:\d{2}:\d{2}/.exec(time)[0] || time;
}, },
covertName(data) { covertName(memberId) {
if (data != 'All') { let name = '';
if (data instanceof Array) { const member = this.$store.state.training.memberData[memberId];
let result = ''; if (member && member.userId) {
data.forEach(each=>{ const user = this.simulationUsers[member.userId];
result += this.covertEachName(each); name = member.label + '(' + user.nickName + ')';
}); } else if (member) {
return result; name = member.label;
} else {
const userInfoName = this.covertEachName(data);
return userInfoName.slice(0, userInfoName.length - 1);
}
} else {
return '@All';
} }
}, return name;
covertEachName(data) {
let deviceName = '';
if (data.deviceCode) {
const device = this.$store.getters['map/getDeviceByCode'](data.deviceCode);
if (device) {
if (device._type == 'Train') {
deviceName = device.groupNumber;
} else {
deviceName = device.name;
}
} else {
deviceName = data.deviceCode;
}
}
const memberName = data.name ? '-' + data.name : '';
return data.type + deviceName + memberName + ',';
}, },
playAudio(audioUrl) { playAudio(audioUrl) {
document.querySelector('#audioPlay').src = audioUrl; document.querySelector('#audioPlay').src = audioUrl;

View File

@ -4,7 +4,7 @@
<div v-for="(chatContent,index) in messageList" :key="index" class="chatContentInClass"> <div v-for="(chatContent,index) in messageList" :key="index" class="chatContentInClass">
<div :class="chatContent.self?'rightUser':'leftUser'"> <div :class="chatContent.self?'rightUser':'leftUser'">
<div class="userHeader"> <div class="userHeader">
<div v-if="!chatContent.self" class="userName">{{ covertName(chatContent,false) }}</div> <div v-if="!chatContent.self" class="userName">{{ covertName(chatContent.memberId) }}</div>
<div :class="chatContent.self?'userChatTime textRight':'userChatTime'">{{ chatContent.time }}</div> <div :class="chatContent.self?'userChatTime textRight':'userChatTime'">{{ chatContent.time }}</div>
</div> </div>
<div class="userBubble" @click="playAudio(baseUrl+chatContent.src)"> <div class="userBubble" @click="playAudio(baseUrl+chatContent.src)">
@ -122,21 +122,7 @@ export default {
}; };
}); });
}, },
covertName(data, status) { covertName(memberId) {
if (status) {
let result = '';
const members = data.members || this.conversitionMemberList;
(members || []).forEach(member => {
if (member.memberId != data.memberId) {
result += ('@' + this.covertEachName(member.memberId));
}
});
return result;
} else {
return this.covertEachName(data.memberId);
}
},
covertEachName(memberId) {
let name = ''; let name = '';
const member = this.$store.state.training.memberData[memberId]; const member = this.$store.state.training.memberData[memberId];
if (member && member.userId) { if (member && member.userId) {