综合演练 仿真聊天代码调整
This commit is contained in:
parent
edcefeab07
commit
7449b6b2a3
@ -29,6 +29,9 @@ function handle(state, data) {
|
||||
case 'Simulation_Script_Tip': // 仿真-聊天界面用户进出仿真消息
|
||||
handleSimulationScriptTipInfo(state, msg); // 用户进出仿真消息
|
||||
break;
|
||||
case 'Simulation_Start_Conversation': // 综合演练仿真-聊天界面用户邀请其他人加入群聊
|
||||
state.inviteOtherIntoChat = msg;
|
||||
break;
|
||||
case 'Competition_Practical': // 竞赛裁判系统裁判员开始考试推送消息
|
||||
state.competitionStart++; // 竞赛裁判系统裁判员开始考试推送消息
|
||||
break;
|
||||
@ -213,7 +216,8 @@ const socket = {
|
||||
simulationStart: '', // 仿真-开始消息
|
||||
simulationOver:0, // 退出仿真推送消息
|
||||
simulationReset: '', // 仿真-异常消息
|
||||
simulationText: {}, // 仿真-用户交互消息(聊天/命令)
|
||||
simulationText: {}, // 仿真-用户交互消息(聊天/命令),
|
||||
inviteOtherIntoChat:{}, // 综合演练仿真-聊天界面用户邀请其他人加入群聊推送信息
|
||||
// coversitionList:{}, // 历史仿真-用户消息列表
|
||||
|
||||
message: {}, // 仿真聊天
|
||||
|
@ -43,6 +43,7 @@
|
||||
</div>
|
||||
<chat-setting ref="chatSetting" :form="form" @setSetting="setSetting" />
|
||||
<chat-create-group ref="createGroup" :group="group" @addCoversition="addCoversition" />
|
||||
<chat-tooltip />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -51,6 +52,7 @@ import ChatContent from './chatContent';
|
||||
import ChatMemberList from './chatMemberList';
|
||||
import ChatCoversitionList from './chatCoversitionList';
|
||||
import ChatCreateGroup from './chatCreateGroup';
|
||||
import ChatTooltip from './chatTooltip';
|
||||
import RecordRTC from 'recordrtc';
|
||||
import {uploadAudioFileNew} from '@/api/chat';
|
||||
export default {
|
||||
@ -60,7 +62,8 @@ export default {
|
||||
ChatContent,
|
||||
ChatMemberList,
|
||||
ChatCoversitionList,
|
||||
ChatCreateGroup
|
||||
ChatCreateGroup,
|
||||
ChatTooltip
|
||||
},
|
||||
props: {
|
||||
group: {
|
@ -12,8 +12,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
import Cookies from 'js-cookie';
|
||||
// import ConstConfig from '@/scripts/ConstConfig';
|
||||
// import Cookies from 'js-cookie';
|
||||
import {getSimulationConversationListNew} from '@/api/chat';
|
||||
export default {
|
||||
name:'ChatCoversitionList',
|
||||
@ -32,15 +32,15 @@ export default {
|
||||
if (resp.data) {
|
||||
const data = resp.data;
|
||||
data.map(coversition=>{
|
||||
if (coversition.name) {
|
||||
// if (coversition.name) {
|
||||
coversition.coverName = coversition.name;
|
||||
coversition.isOnline = true;
|
||||
} else {
|
||||
const objectCover = this.handleMemberName(coversition);
|
||||
coversition.coverName = objectCover.coversitionName;
|
||||
coversition.isOnline = objectCover.isOnline;
|
||||
}
|
||||
|
||||
// }
|
||||
// else {
|
||||
// const objectCover = this.handleMemberName(coversition);
|
||||
// coversition.coverName = objectCover.coversitionName;
|
||||
// coversition.isOnline = objectCover.isOnline;
|
||||
// }
|
||||
return coversition;
|
||||
});
|
||||
this.coversitionList = data;
|
||||
@ -54,14 +54,15 @@ export default {
|
||||
addCoversition(data) {
|
||||
const index = this.coversitionList.findIndex(item=>{ return item.id == data.id; });
|
||||
if (index < 0) {
|
||||
const objectCover = this.handleMemberName(data);
|
||||
if (data.name) {
|
||||
// const objectCover = this.handleMemberName(data);
|
||||
// if (data.name) {
|
||||
data.coverName = data.name;
|
||||
data.isOnline = true;
|
||||
} else {
|
||||
data.coverName = objectCover.coversitionName;
|
||||
data.isOnline = objectCover.isOnline;
|
||||
}
|
||||
// }
|
||||
// else {
|
||||
// data.coverName = objectCover.coversitionName;
|
||||
// data.isOnline = objectCover.isOnline;
|
||||
// }
|
||||
|
||||
this.coversitionList.push(data);
|
||||
this.currentCoversition = data;
|
||||
@ -74,62 +75,64 @@ export default {
|
||||
// this.$refs.chatContent.reloadData(this.currentCoversition);
|
||||
},
|
||||
changeCoversitionOther(coversition) {
|
||||
const objectCover = this.handleMemberName(coversition);
|
||||
coversition.coverName = objectCover.coversitionName;
|
||||
coversition.isOnline = objectCover.isOnline;
|
||||
// const objectCover = this.handleMemberName(coversition);
|
||||
// coversition.coverName = objectCover.coversitionName;
|
||||
// coversition.isOnline = objectCover.isOnline;
|
||||
coversition.coverName = coversition.name;
|
||||
coversition.isOnline = true;
|
||||
const index = this.coversitionList.findIndex(item=>{ return item.id == coversition.id; });
|
||||
if (index < 0) {
|
||||
this.coversitionList.push(coversition);
|
||||
}
|
||||
this.changeCoversition(coversition);
|
||||
},
|
||||
handleMemberName(conversition) {
|
||||
if (conversition.all) {
|
||||
return {coversitionName:conversition.name, isOnline:true};
|
||||
} else {
|
||||
let coversitionName = '';
|
||||
let isOnline = true;
|
||||
if (conversition.memberList) {
|
||||
conversition.memberList.forEach(member=>{
|
||||
if (member.userId != this.$store.state.user.id) {
|
||||
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
|
||||
let data = member.role;
|
||||
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 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 {
|
||||
coversitionName = conversition.name;
|
||||
}
|
||||
return {coversitionName:coversitionName, isOnline:isOnline};
|
||||
}
|
||||
}
|
||||
// handleMemberName(conversition) {
|
||||
// if (conversition.all) {
|
||||
// return {coversitionName:conversition.name, isOnline:true};
|
||||
// } else {
|
||||
// let coversitionName = '';
|
||||
// let isOnline = true;
|
||||
// if (conversition.memberList) {
|
||||
// conversition.memberList.forEach(member=>{
|
||||
// if (member.userId != this.$store.state.user.id) {
|
||||
// const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
|
||||
// let data = member.role;
|
||||
// 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 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 {
|
||||
// coversitionName = conversition.name;
|
||||
// }
|
||||
// return {coversitionName:coversitionName, isOnline:isOnline};
|
||||
// }
|
||||
// }
|
||||
}
|
||||
};
|
||||
</script>
|
@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div v-show="dialogVisible" class="chat-create-group">
|
||||
<div v-show="dialogVisible" class="chat-create-group-all">
|
||||
<div class="chat-create-group">
|
||||
<div class="create-group-header">
|
||||
<div class="create-group-title">添加会话对象</div>
|
||||
<div class="create-group-close">
|
||||
@ -35,6 +36,7 @@
|
||||
<el-button size="small" @click="doClose">取消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {getSimulationMembersNew, getSimulationConversationIdNew} from '@/api/chat';
|
||||
@ -102,7 +104,7 @@ export default {
|
||||
this.checkList = [];
|
||||
}
|
||||
}).catch(error=>{
|
||||
this.$messageBox('创建会话失败: ' + error.messagfe);
|
||||
this.$messageBox('创建会话失败: ' + error.message);
|
||||
this.loading = false;
|
||||
this.dialogVisible = false;
|
||||
this.checkList = [];
|
||||
@ -118,6 +120,14 @@ export default {
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.chat-create-group-all{
|
||||
position:absolute;
|
||||
width:100%;
|
||||
height:100%;
|
||||
left:0;
|
||||
top:0;
|
||||
z-index:10;
|
||||
}
|
||||
.chat-create-group{
|
||||
position: absolute;
|
||||
width: 70%;
|
94
src/views/newMap/jointTrainingNew/chatView/chatTooltip.vue
Normal file
94
src/views/newMap/jointTrainingNew/chatView/chatTooltip.vue
Normal file
@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<div v-show="dialogVisible" class="chatTooltipAll">
|
||||
<div class="chatTooltip">
|
||||
<div class="chatTooltipHeader">
|
||||
{{ userName }} 邀请您加入会话!
|
||||
</div>
|
||||
<div class="chatTooltipBootom">
|
||||
<div class="create-group-bottom">
|
||||
<el-button :loading="loading" size="small" type="primary" @click="doCreate">接受</el-button>
|
||||
<el-button size="small" @click="doClose">拒绝</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import ConstConfig from '@/scripts/ConstConfig';
|
||||
import Cookies from 'js-cookie';
|
||||
export default {
|
||||
name:'ChatTooltip',
|
||||
data() {
|
||||
return {
|
||||
userName:'',
|
||||
dialogVisible:false,
|
||||
loading:false
|
||||
};
|
||||
},
|
||||
watch:{
|
||||
'$store.state.socket.inviteOtherIntoChat':function(val) {
|
||||
this.userName = this.coverName(val);
|
||||
this.dialogVisible = true;
|
||||
}
|
||||
},
|
||||
// {"conversationId":"22e10b17-7a6c-4b1b-8724-f87fb2053b76","from":{"id":"17","userId":"75","name":"赵",
|
||||
// "role":"STATION_SUPERVISOR","deviceType":"STATION","deviceCode":"Station32955","deviceName":"世纪大道","online":true,"robot":false}
|
||||
methods:{
|
||||
coverName(inviteUser) {
|
||||
const member = inviteUser.from;
|
||||
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
|
||||
let data = member.role;
|
||||
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 : '';
|
||||
return data + deviceName + memberName;
|
||||
},
|
||||
doCreate() {
|
||||
|
||||
},
|
||||
doClose() {
|
||||
this.dialogVisible = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.chatTooltip{
|
||||
position: absolute;
|
||||
width: 290px;
|
||||
left: 32%;
|
||||
top: 42%;
|
||||
z-index: 5;
|
||||
background: #fff;
|
||||
padding: 15px;
|
||||
box-shadow: #969090 0px 0px 10px;
|
||||
border-radius: 4px;
|
||||
line-height: 20px;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
.chatTooltipHeader{
|
||||
margin-top:10px;
|
||||
font-size:14px;
|
||||
}
|
||||
.chatTooltipBootom{
|
||||
margin-top:10px;
|
||||
text-align: center;
|
||||
margin-bottom:10px;
|
||||
}
|
||||
.chatTooltipAll{
|
||||
position:absolute;
|
||||
width:100%;
|
||||
height:100%;
|
||||
left:0;
|
||||
top:0;
|
||||
z-index: 10;
|
||||
}
|
||||
</style>
|
@ -26,7 +26,7 @@
|
||||
|
||||
<script>
|
||||
import QrCode from '@/components/QrCode';
|
||||
import ChatBox from './chatBox';
|
||||
import ChatBox from './chatView/chatBox';
|
||||
import SetTime from '@/views/newMap/displayNew/demon/setTime';
|
||||
import { ranAsPlan, exitRunPlan } from '@/api/simulation';
|
||||
import { exitFullscreen } from '@/utils/screen';
|
||||
|
Loading…
Reference in New Issue
Block a user