实训平台 综合演练 聊天代码调整
This commit is contained in:
parent
808236a6fa
commit
376662d96e
@ -144,7 +144,7 @@ function handleSimulationInfo(state, data) {
|
||||
voice: data.isAudio,
|
||||
src: data.isAudio ? `/jlcloud/audio/${data.audioPath}` : '',
|
||||
memberName:data.member.name,
|
||||
memberRole:data.member.name,
|
||||
memberRole:data.member.role,
|
||||
memberOnline:data.member.online,
|
||||
chatTime: data.chatTime,
|
||||
targetOnline:data.targetMember ? data.targetMember.online : null,
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div v-for="(chatContent,index) in chatContentList" :key="index" class="chatContentInClass">
|
||||
<div :class="chatContent.self?'rightUser':'leftUser'">
|
||||
<div class="userHeader">
|
||||
<div v-if="chatContent.group" class="userName">{{ chatContent.memberName }}</div>
|
||||
<div v-if="chatContent.group&& !chatContent.self" class="userName">{{ handle(chatContent) }}</div>
|
||||
<div :class="chatContent.self?'userChatTime textRight':'userChatTime'">{{ formatTime(chatContent.chatTime) }}</div>
|
||||
</div>
|
||||
<div class="userBubble" @click="playAudio('audio'+index)">
|
||||
@ -19,6 +19,8 @@
|
||||
</template>
|
||||
<script>
|
||||
import {getSimulationContextListNew} from '@/api/chat';
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
import Cookies from 'js-cookie';
|
||||
export default {
|
||||
props:{
|
||||
currentCoversition:{
|
||||
@ -65,6 +67,8 @@ export default {
|
||||
coversition.self = true;
|
||||
}
|
||||
coversition.src = coversition.isAudio ? `/jlcloud/audio/${coversition.audioPath}` : '';
|
||||
coversition.memberName = coversition.member.name;
|
||||
coversition.memberRole = coversition.member.role;
|
||||
return coversition;
|
||||
});
|
||||
this.chatContentList = coversitionList;
|
||||
@ -77,6 +81,19 @@ export default {
|
||||
formatTime(time) {
|
||||
return /\d{2}:\d{2}:\d{2}/.exec(time)[0] || time;
|
||||
},
|
||||
handle(chatContent) {
|
||||
let data = chatContent.memberRole;
|
||||
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);
|
||||
}
|
||||
});
|
||||
return data + '-' + chatContent.memberName;
|
||||
},
|
||||
playAudio(id) {
|
||||
document.querySelector('#' + id).play();
|
||||
}
|
||||
@ -110,8 +127,8 @@ export default {
|
||||
display: inline-block;
|
||||
}
|
||||
.userHeader{margin-bottom: 2px;}
|
||||
.userName{}
|
||||
.userChatTime{font-size: 12px;}
|
||||
.userName{font-size: 12px;display:inline-block;}
|
||||
.userChatTime{font-size: 12px;display:inline-block;}
|
||||
.userBubble{
|
||||
max-width: 200px;
|
||||
font-size: 12px;
|
||||
@ -124,7 +141,7 @@ export default {
|
||||
font-size: 20px;
|
||||
vertical-align: top;
|
||||
}
|
||||
.textRight{text-align: right;}
|
||||
.textRight{text-align: right;width: 100%;}
|
||||
.userMessage{}
|
||||
.messageText{line-height: 20px;}
|
||||
.chatContentInClass{
|
||||
|
Loading…
Reference in New Issue
Block a user