剧本添加提示

This commit is contained in:
joylink_cuiweidong 2020-05-15 16:54:31 +08:00
parent f25a73c4e7
commit 901ab1a8bd
8 changed files with 94 additions and 67 deletions

View File

@ -13,7 +13,7 @@ export function getScriptPageListOnline(params) {
/** 分页查找上线的剧本(新版)*/
export function getScriptPageListOnlineNew(params) {
return request({
url: `/api/scirpt/v1/paging/online`,
url: `/api/script/v1/paging/online`,
method: 'get',
params: params
});
@ -30,7 +30,7 @@ export function getScriptById(id) {
/** 通过ID查询发布的剧本的详细信息(新版) */
export function getScriptByIdNew(id) {
return request({
url: `/api/scirpt/v1/${id}/detail`,
url: `/api/script/v1/${id}/detail`,
method: 'get'
});
}

View File

@ -371,7 +371,6 @@ export default {
},
//
reopenSignalByRoute(selectType) {
debugger;
commitOperate(menuOperate.Signal.reopenSignal, {signalCode:selectType.code}, 3).then(({valid, operate})=>{
}).catch(error=>{
this.$refs.noticeInfo.doShow({}, error.message);

View File

@ -26,6 +26,9 @@ function handle(state, data) {
case 'Simulation_User': // 仿真-聊天界面用户进出仿真消息
handleSimulationUserinfo(state, msg); // 用户进出仿真消息
break;
case 'Simulation_Script_Tip': // 仿真-聊天界面用户进出仿真消息
handleSimulationScriptTipInfo(state, msg); // 用户进出仿真消息
break;
case 'Simulation_RunFact': // 仿真-列车实际到发车站消息
// let runFactMsg = msg;
// if (runFactMsg.constructor !== Array ) {
@ -136,7 +139,6 @@ function handleSimulationInfo(state, data) {
if (data.member.userId == userId) {
isSelf = true;
}
const myDate = new Date();
const myDate1 = myDate.toLocaleDateString().replace(/\//g, '-');
const chatTime = /\d{2}:\d{2}:\d{2}/.exec(data.chatTime)[0] || data.chatTime;
@ -156,61 +158,11 @@ function handleSimulationInfo(state, data) {
date: +new Date(`${myDate1} ${chatTime}`)
};
state.simulationText = params;
// if (state.coversitionList[data.conversationId]) {
// state.coversitionList[data.conversationId].push(params);
// } else {
// state.coversitionList[data.conversationId] = [];
// state.coversitionList[data.conversationId].push(params);
// }
}
// switch (data.member.role) {
// case '01':
// role = '管理员';
// break;
// case '02':
// role = '教员';
// break;
// case '03':
// role = `调度员`;
// break;
// case '04':
// store.state.map.map.stationList.forEach(nor => {
// if (nor.code == data.member.deviceCode) {
// role = `${nor.name}`;
// }
// });
// break;
// }
// if (!data.member.userId && data.member.deviceName) {
// data.member.nickName = data.member.deviceName;
// }
// if (!data.targetMember.userId && data.targetMember.deviceName) {
// data.targetMember.nickName = data.targetMember.deviceName;
// }
// const param = {
// join: false,
// value: data.message,
// self: isSelf,
// voice: data.isAudio,
// src: data.isAudio ? `${process.env.process.env.VUE_VOICE_API}/jlcloud/audio/${data.audioPath}` : '',
// other: !isSelf,
// userName: '',
// id: data.member.id,
// chatTime: data.chatTime,
// date: +new Date(`${myDate1} ${chatTime}`),
// conversationId: data.conversationId,
// changeVO: data.changeVO || {},
// targetMember: data.targetMember,
// member: data.member,
// group: data.group
// };
// if (data.member.role) {
// param.userName = `${role}【${data.member.nickName}】`;
// } else {
// param.userName = `${data.member.nickName}`;
// }
// state.simulationText = param;
// 剧本提示
function handleSimulationScriptTipInfo(state, data) {
state.simulationScriptTip = data;
}
function handleUserinfo(state, data) {
@ -242,6 +194,7 @@ const socket = {
chatContent: {}, // 聊天室聊天内容
roleList: [], // 设置角色信息
simulationRoleList:[], // 设置仿真的聊天角色信息
simulationScriptTip:{}, // 剧本推送提示信息
jointRoomPrepare: false, // 演练房间准备状态
equipmentStatus: [], // 仿真-设备状态消息
trainStationList: [], // 仿真-列车实际到发车站消息

View File

@ -19,7 +19,7 @@
</div>
</div>
<div class="chat-box-content">
<chat-content ref="chatContent" :current-coversition="currentCoversition" @addCoversition="addCoversition" />
<chat-content ref="chatContent" :current-coversition="currentCoversition" @changeCoversition="changeCoversition" />
<div v-if="recordSending" class="chat_record_tip">
<div id="record_progress_bar" :style="'width:'+100/60*seconds+'%'" />
<div class="record_icon" />
@ -31,6 +31,7 @@
<div class="chat-box-footer">
<div class="chat-box-footer-tool" />
<div class="chat-box-footer-send" @click="startRecording()">发送语音</div>
<div v-if="scriptTip" class="scriptTip">{{ scriptTip }}</div>
</div>
</div>
</div>
@ -74,6 +75,7 @@ export default {
inter:null,
recorders: null,
microphone:null,
scriptTip:'',
form:{
language:'zh',
sex:'1'
@ -89,6 +91,17 @@ export default {
this.$refs.chatCoversitionList.setCoversitionStatus(val);
});
}
},
'$store.state.socket.simulationScriptTip':function(val, old) {
if (val) {
if (val.type == 'Conversation') {
const target = this.$refs.chatMemberList.getMember(val.targetId);
if (target && target.length > 0) {
this.scriptTip = '请对' + target[0].memberName + '说:' + val.reply;
}
}
}
}
},
mounted() {
@ -110,19 +123,24 @@ export default {
},
setCurrentCoversition(coversition) {
this.currentCoversition = coversition;
if (this.recordSending) {
this.cancleRecording();
}
},
setHeadTitle(headerTitle) {
this.headerTitle = headerTitle;
},
addCoversition({data, headerTitle}) {
this.$refs.chatCoversitionList.addCoversition(data, headerTitle);
if (headerTitle) {
this.currentCoversition = {id:data.id, group:data.group};
this.headerTitle = headerTitle;
}
},
changeCoversition(data) {
this.$refs.chatCoversitionList.changeCoversitionOther(data);
},
//
startRecording() {
this.scriptTip = '';
const that = this;
if (!this.recordSending && !this.recorders && !this.microphone) {
this.$refs.chatSetting.doClose();
@ -267,6 +285,7 @@ export default {
.chat-box-footer{
display: inline-block;
width: 100%;
position: relative;
}
.chat-window{
display: inline-block;
@ -322,6 +341,27 @@ export default {
.coversition-list{
}
.scriptTip{
position: absolute;
width: 260px;
padding: 10px;
background: #ccc;
right: 7px;
bottom:45px;
border-radius: 5px;
font-size: 14px;
}
.scriptTip::after{
content: '';
position: absolute;
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 8px solid #cccccc;
right: 16px;
bottom: -7px;
}
.showMembers{
float: right;

View File

@ -8,7 +8,8 @@
</div>
<div class="userBubble" @click="playAudio('audio'+index)">
<div class="userMessage">
<span v-if="chatContent.group&&!(chatContent.member && chatContent.member.robot)">@{{ covertName(chatContent.targetName) }}</span>
<!-- &&!(chatContent.self) -->
<span v-if="chatContent.group">@{{ covertName(chatContent.targetName) }}</span>
<span class="el-icon-video-play playicon" />
<span class="messageText">{{ chatContent.message }}</span>
<audio :id="'audio'+index" :src="baseUrl+chatContent.src" style="display:none" />
@ -42,7 +43,8 @@ export default {
if (this.currentCoversition.id == val.id) {
this.chatContentList.push(simulationText);
} else {
this.$emit('addCoversition', {data:simulationText, headerTitle:''});
this.$emit('changeCoversition', simulationText);
// this.$emit('addCoversition', {data:simulationText, headerTitle:''});
this.chatContentList.push(simulationText);
}
},

View File

@ -48,7 +48,6 @@ export default {
addCoversition(data, headerTitle) {
const index = this.coversitionList.findIndex(item=>{ return item.id == data.id; });
if (index < 0) {
debugger;
const objectCover = this.handleMemberName(data);
data.coverName = objectCover.coversitionName;
data.isOnline = objectCover.isOnline;
@ -64,6 +63,13 @@ export default {
this.$emit('setCurrentCoversition', coversition);
// this.$refs.chatContent.reloadData(this.currentCoversition);
},
changeCoversitionOther(coversition) {
const objectCover = this.handleMemberName(coversition);
coversition.coverName = objectCover.coversitionName;
coversition.isOnline = objectCover.isOnline;
this.coversitionList.push(coversition);
this.changeCoversition(coversition);
},
handleMemberName(conversition) {
if (conversition.group) {
return {coversitionName:conversition.name, isOnline:true};

View File

@ -78,6 +78,11 @@ export default {
this.memberList = lastData;
});
},
getMember(memberId) {
return this.memberList.filter(member=>{
return member.id == memberId;
});
},
doShow() {
if (this.showMembers) {
this.showMembers = false;

View File

@ -51,6 +51,8 @@
</template>
<script>
import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig';
import {getScriptPageListOnlineNew, getScriptByIdNew, getDraftScriptByGroupNew } from '@/api/script';
//
@ -152,6 +154,24 @@ export default {
},
async loadInitData() {
},
covert(data, roleTypeList) {
let lastData = data;
roleTypeList.forEach(function(element) {
const rolename = element.value;
if (Cookies.get('user_lang') == 'en') {
lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel);
} else {
lastData = lastData.replace(new RegExp(rolename, 'g'), element.label);
}
});
lastData = JSON.parse(lastData);
lastData.forEach(each=>{
const name = each.name == undefined ? '' : '-' + each.name;
const deviceName = each.deviceName == undefined ? '' : '-' + each.deviceName;
each.name = each.role + deviceName + name;
});
return lastData;
},
async handleLoad(index, row) {
this.row = row;
@ -159,7 +179,9 @@ export default {
let newMemberList = [];
if (res.code == 200) {
if (res.data.playerList && res.data.playerList.length > 0) {
newMemberList = res.data.playerList.filter(item => item.hasPlay === true);
const lastData = JSON.stringify(res.data.playerList);
const playerList = this.covert(lastData, ConstConfig.ConstSelect.roleTypeNew);
newMemberList = playerList.filter(item => item.hasPlay === true);
}
if (res.data.mapLocation) {
this.mapLocation = res.data.mapLocation;