This commit is contained in:
fan 2020-06-03 18:36:05 +08:00
commit bf07ea8e0a
23 changed files with 511 additions and 236 deletions

View File

@ -6,7 +6,7 @@ NODE_ENV = 'development'
# VUE_APP_BASE_API = 'https://joylink.club/jlcloud' # VUE_APP_BASE_API = 'https://joylink.club/jlcloud'
# VUE_APP_BASE_API = 'http://192.168.3.4:9000' # VUE_APP_BASE_API = 'http://192.168.3.4:9000'
VUE_APP_BASE_API = 'http://192.168.3.6:9000' VUE_APP_BASE_API = 'http://192.168.3.6:9000'
VUE_APP_VOICE_API = 'https://test.joylink.club' VUE_APP_VOICE_API = 'https://test.joylink.club/jlcloud'
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable, # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
# to control whether the babel-plugin-dynamic-import-node plugin is enabled. # to control whether the babel-plugin-dynamic-import-node plugin is enabled.

View File

@ -4,4 +4,4 @@ VUE_APP_PRO = 'local'
# base api # base api
VUE_APP_BASE_API = 'https://joylink.club/jlcloud' VUE_APP_BASE_API = 'https://joylink.club/jlcloud'
VUE_APP_VOICE_API = 'https://joylink.club' VUE_APP_VOICE_API = 'https://joylink.club/jlcloud'

View File

@ -3,4 +3,4 @@ NODE_ENV = 'production'
# base api # base api
VUE_APP_BASE_API = 'https://joylink.club/jlcloud' VUE_APP_BASE_API = 'https://joylink.club/jlcloud'
VUE_APP_VOICE_API = 'https://joylink.club' VUE_APP_VOICE_API = 'https://joylink.club/jlcloud'

View File

@ -3,4 +3,4 @@ NODE_ENV = 'production'
# base api # base api
VUE_APP_BASE_API = 'https://test.joylink.club/jlcloud' VUE_APP_BASE_API = 'https://test.joylink.club/jlcloud'
VUE_APP_VOICE_API = 'https://test.joylink.club' VUE_APP_VOICE_API = 'https://test.joylink.club/jlcloud'

View File

@ -76,6 +76,7 @@ export function bindSimulationTrain(group,groupNumber) {
params: '' params: ''
}) })
} }
//EB紧急制动
export function trainSimulationEb(group,groupNumber) { export function trainSimulationEb(group,groupNumber) {
return request({ return request({
url: `/simulation/driving/${group}/train/${groupNumber}/eb`, url: `/simulation/driving/${group}/train/${groupNumber}/eb`,
@ -83,6 +84,8 @@ export function trainSimulationEb(group,groupNumber) {
params: '' params: ''
}) })
} }
//改变列车牵引/制动力
export function trainSimulationForce(group,groupNumber,percent) { export function trainSimulationForce(group,groupNumber,percent) {
return request({ return request({
url: `/simulation/driving/${group}/train/${groupNumber}/force/${percent}`, url: `/simulation/driving/${group}/train/${groupNumber}/force/${percent}`,
@ -90,6 +93,8 @@ export function trainSimulationForce(group,groupNumber,percent) {
params: '' params: ''
}) })
} }
//改变列车档位
export function trainSimulationGear(group,groupNumber,gear) { export function trainSimulationGear(group,groupNumber,gear) {
return request({ return request({
url: `/simulation/driving/${group}/train/${groupNumber}/gear/${gear}`, url: `/simulation/driving/${group}/train/${groupNumber}/gear/${gear}`,
@ -97,3 +102,30 @@ export function trainSimulationGear(group,groupNumber,gear) {
params: '' params: ''
}) })
} }
//改变列车运行级别
export function trainSimulationDriveMode(group,groupNumber,driveMode) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/driveMode/${driveMode}`,
method: 'put',
params: ''
})
}
//ATP切除
//ATO
export function trainSimulationAtp(group,groupNumber) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/atp`,
method: 'put',
params: ''
})
}
//ATO
export function trainSimulationAto(group,groupNumber) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/openAto`,
method: 'put',
params: ''
})
}

View File

@ -94,6 +94,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,sta
// 对象化数据 // 对象化数据
let data = JSON.parse(Response.body); let data = JSON.parse(Response.body);
// 遍历后台数据 // 遍历后台数据
// console.log(data); // console.log(data);
if(data.type == "Train_Position"){ if(data.type == "Train_Position"){

View File

@ -3,14 +3,14 @@ import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
// 定于仿真socket接口 // 定于仿真socket接口
export function PassflowConnect(nowstation,deviceaction,lefttrain,righttrain,routegroup) { export function PassflowConnect(nowstation,deviceaction,toptrain,downtrain,routegroup) {
const scope = this; const scope = this;
this.controlstation = nowstation; this.controlstation = nowstation;
this.teststomp = new StompClient(); this.teststomp = new StompClient();
let trainleftnow = null; let traintopnow = null;
let trainrightnow = null; let traindownnow = null;
let topic = '/user/queue/simulation/jl3d/'+routegroup; let topic = '/user/queue/simulation/jl3d/'+routegroup;
let header = {'X-Token': getToken() }; let header = {'X-Token': getToken() };
@ -37,19 +37,7 @@ export function PassflowConnect(nowstation,deviceaction,lefttrain,righttrain,rou
if(data.body.type == "PSD"){ if(data.body.type == "PSD"){
if(data.body.code == nowstation.toppsd){ if(data.body.code == nowstation.toppsd){
if(data.body.open == 0){ if(data.body.open == 0){
deviceaction.down.action.reset();
deviceaction.down.action.time = deviceaction.down.action._clip.duration;
deviceaction.down.action.timeScale = -1;
deviceaction.down.action.play();
}else{
deviceaction.down.action.reset();
deviceaction.down.action.time = 0;
deviceaction.down.action.timeScale = 1;
deviceaction.down.action.play();
}
}
if(data.body.code == nowstation.downpsd){
if(data.body.open == 0){
deviceaction.top.action.reset(); deviceaction.top.action.reset();
deviceaction.top.action.time =deviceaction.top.action._clip.duration; deviceaction.top.action.time =deviceaction.top.action._clip.duration;
deviceaction.top.action.timeScale = -1; deviceaction.top.action.timeScale = -1;
@ -61,25 +49,133 @@ export function PassflowConnect(nowstation,deviceaction,lefttrain,righttrain,rou
deviceaction.top.action.play(); deviceaction.top.action.play();
} }
} }
if(data.body.code == nowstation.downpsd){
if(data.body.open == 0){
deviceaction.down.action.reset();
deviceaction.down.action.time = deviceaction.down.action._clip.duration;
deviceaction.down.action.timeScale = -1;
deviceaction.down.action.play();
}else{
deviceaction.down.action.reset();
deviceaction.down.action.time = 0;
deviceaction.down.action.timeScale = 1;
deviceaction.down.action.play();
}
}
} }
if(data.body.type == "TRAIN_DOOR"){ if(data.body.type == "TRAIN_DOOR"){
if(traintopnow == data.body.code){
if(data.body.open == "0"){
closetraindoor(toptrain,data.body.doorCode,"top");
}else{
opentraindoor(toptrain,data.body.doorCode,"top");
}
}
if(traindownnow == data.body.code){
// console.log(data.body);
if(data.body.open == "0"){
closetraindoor(downtrain,data.body.doorCode,"down");
}else{
opentraindoor(downtrain,data.body.doorCode,"down");
}
}
} }
} }
if(data.type == "TrainRun_3D"){ if(data.type == "TrainRun_3D"){
console.log(data.body);
console.log(nowstation);
for(let i=0,leni = data.body.length;i<leni;i++){ for(let i=0,leni = data.body.length;i<leni;i++){
if(data.body[i].section == scope.controlstation.topsection){ if(data.body[i].section == scope.controlstation.topsection){
console.log("top:"+data.body[i].offset);
if(traintopnow != data.body[i].code){
traintopnow = data.body[i].code;
} }
if(data.body[i].section == scope.controlstation.downsection){ toptrain.position.copy(toptrain.curve.getPointAt(data.body[i].offset));
// toptrain.position
// if(){
//
// }
}else{
if(traindownnow == data.body[i].code){
toptrain.position.x -= 1;
}
}
if(data.body[i].section == scope.controlstation.downsection){
console.log("down:"+data.body[i].offset);
if(traindownnow != data.body[i].code){
traindownnow = data.body[i].code;
}
downtrain.position.copy(downtrain.curve.getPointAt(data.body[i].offset));
}else{
if(traindownnow == data.body[i].code){
downtrain.position.x += 1;
}
} }
} }
} }
// console.log(data); // console.log(data);
} }
let actions;
function opentraindoor(train,doorcode,direct){
if(direct == "top"){
if(doorcode == "1"){
actions = train.action.down;
}
if(doorcode == "2"){
actions = train.action.top;
}
}else{
if(doorcode == "1"){
actions = train.action.top;
}
if(doorcode == "2"){
actions = train.action.down;
}
}
for(let an=actions.length-1;an>=0;an--){
actions[an].reset();
actions[an].time = 0;
actions[an].timeScale = 1;
actions[an].play();
}
}
function closetraindoor(train,doorcode,direct){
if(direct == "top"){
if(doorcode == "1"){
actions = train.action.down;
}
if(doorcode == "2"){
actions = train.action.top;
}
}else{
if(doorcode == "1"){
actions = train.action.top;
}
if(doorcode == "2"){
actions = train.action.down;
}
}
for(let an=actions.length-1;an>=0;an--){
actions[an].reset();
actions[an].time = actions[an]._clip.duration;
actions[an].timeScale = -1;
actions[an].play();
}
} }
}

View File

@ -41,8 +41,8 @@ let originhuman1 = null;
let originhuman2 = null; let originhuman2 = null;
let originanima1 = null; let originanima1 = null;
let originanima2 = null; let originanima2 = null;
let lefttrain = null; let toptrain = null;
let righttrain = null; let downtrain = null;
let zhajiin = []; let zhajiin = [];
let zhajiout = []; let zhajiout = [];
@ -395,9 +395,9 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
getPublishMapDetail(skinCode).then(netdata => { getPublishMapDetail(skinCode).then(netdata => {
console.log(netdata); // console.log(netdata);
initstationlist(netdata.data.stationList,netdata.data.stationStandList,netdata.data.psdList); initstationlist(netdata.data.stationList,netdata.data.stationStandList,netdata.data.psdList);
socktest = new PassflowConnect(nowstation,deviceaction,lefttrain,righttrain,routegroup); socktest = new PassflowConnect(nowstation,deviceaction,toptrain,downtrain,routegroup);
}); });
animate(); animate();
@ -815,7 +815,7 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
// console.log(humanlist.children.length); // console.log(humanlist.children.length);
} }
function initstationlist(stationdata,standdata,psddata){ function initstationlist(stationdata,standdata,psddata){
// console.log(standdata);
let list = []; let list = [];
for(let i=0,leni = standdata.length;i<leni;i++){ for(let i=0,leni = standdata.length;i<leni;i++){
for(let j=0,lenj = psddata.length;j<lenj;j++){ for(let j=0,lenj = psddata.length;j<lenj;j++){
@ -846,7 +846,7 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
topsection:null, topsection:null,
downsection:null, downsection:null,
}; };
if(list[k][0].position.y>list[k][1].position.y){ if(list[k][0].position.y<list[k][1].position.y){
stationobject.toppsd = list[k][0].name; stationobject.toppsd = list[k][0].name;
stationobject.downpsd = list[k][1].name; stationobject.downpsd = list[k][1].name;
stationobject.topsection = list[k][0].standTrackCode; stationobject.topsection = list[k][0].standTrackCode;
@ -864,7 +864,7 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
nowstation = stationlist[0]; nowstation = stationlist[0];
updatestationlist(stationlist); updatestationlist(stationlist);
console.log(nowstation); // console.log(nowstation);
} }
function inittrain(object){ function inittrain(object){
let ntracks1,ntracks2,tclip,fclip; let ntracks1,ntracks2,tclip,fclip;
@ -879,23 +879,40 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
lefttrain = object.clone(true); toptrain = object.clone(true);
lefttrain.action = { toptrain.action = {
top:[], top:[],
down:[] down:[]
}; };
let points1 = [];
points1.push(new THREE.Vector3(-71,0.06,-6.3));
points1.push(new THREE.Vector3(60.73,0.06,-6.3));
righttrain = object.clone(true);
righttrain.action = { toptrain.curve = new THREE.CatmullRomCurve3(points1);
downtrain = object.clone(true);
downtrain.action = {
top:[], top:[],
down:[] down:[]
}; };
inittrainanimation(lefttrain,tclip,fclip); let points2 = [];
inittrainanimation(righttrain,tclip,fclip); points2.push(new THREE.Vector3(-71,0.06,28.68));
lefttrain.position.z = 30; points2.push(new THREE.Vector3(60.73,0.06,28.68));
righttrain.position.z = -10; downtrain.curve = new THREE.CatmullRomCurve3(points2);
// scene.add(lefttrain);
// scene.add(righttrain);
inittrainanimation(toptrain,tclip,fclip);
inittrainanimation(downtrain,tclip,fclip);
toptrain.position.z = -20;
toptrain.position.y = -20000;
toptrain.rotation.y = Math.PI;
downtrain.position.z = 40;
downtrain.position.y = -20000;
scene.add(toptrain);
scene.add(downtrain);
} }
function inittrainanimation(train,tclip,fclip){ function inittrainanimation(train,tclip,fclip){
@ -960,6 +977,11 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
for(let j=0;j<object.children.length;j++){ for(let j=0;j<object.children.length;j++){
if(object.children[j].name == "top"){ if(object.children[j].name == "top"){
// var geometry = new THREE.BoxBufferGeometry( 50, 50, 50 );
// var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
// var cube = new THREE.Mesh( geometry, material );
// cube.position.copy(object.children[j].position);
// scene.add( cube );
object.children[j].animations = []; object.children[j].animations = [];
object.children[j].animations.push(newclip.clone()); object.children[j].animations.push(newclip.clone());

View File

@ -57,6 +57,30 @@ let standtop = {
type : "stand", type : "stand",
stage : "3", stage : "3",
randompoint : new THREE.Vector3(-64,1.77,0.38), randompoint : new THREE.Vector3(-64,1.77,0.38),
doorpoints:[
new THREE.Vector3(-62.84,1.77,-4.38),
new THREE.Vector3(-58.11,1.77,-4.38),
new THREE.Vector3(-53.47,1.77,-4.38),
new THREE.Vector3(-45.45,1.77,-4.38),
new THREE.Vector3(-41.1,1.77,-4.38),
new THREE.Vector3(-36.33,1.77,-4.38),
new THREE.Vector3(-31.5,1.77,-4.38),
new THREE.Vector3(-23.65,1.77,-4.38),
new THREE.Vector3(-18.98,1.77,-4.38),
new THREE.Vector3(-14.46,1.77,-4.38),
new THREE.Vector3(-10,1.77,-4.38),
new THREE.Vector3(-2.2,1.77,-4.38),
new THREE.Vector3(2.49,1.77,-4.38),
new THREE.Vector3(7.17,1.77,-4.38),
new THREE.Vector3(11.8,1.77,-4.38),
new THREE.Vector3(19.41,1.77,-4.38),
new THREE.Vector3(24.09,1.77,-4.38),
new THREE.Vector3(28.72,1.77,-4.38),
new THREE.Vector3(33.46,1.77,-4.38),
new THREE.Vector3(41.24,1.77,-4.38),
new THREE.Vector3(45.82,1.77,-4.38),
new THREE.Vector3(50.69,1.77,-4.38)
],
railpoints : [ railpoints : [
new THREE.Vector3(52.1,1.77,-1.8), new THREE.Vector3(52.1,1.77,-1.8),
new THREE.Vector3(-63.5,1.77,-1.8) new THREE.Vector3(-63.5,1.77,-1.8)
@ -69,6 +93,30 @@ let standdown = {
type : "stand", type : "stand",
stage : "3", stage : "3",
randompoint : new THREE.Vector3(-64,1.77,21), randompoint : new THREE.Vector3(-64,1.77,21),
doorpoints:[
new THREE.Vector3(-62.84,1.77,27),
new THREE.Vector3(-58.11,1.77,27),
new THREE.Vector3(-53.47,1.77,27),
new THREE.Vector3(-45.45,1.77,27),
new THREE.Vector3(-41.1,1.77,27),
new THREE.Vector3(-36.33,1.77,27),
new THREE.Vector3(-31.5,1.77,27),
new THREE.Vector3(-23.65,1.77,27),
new THREE.Vector3(-18.98,1.77,27),
new THREE.Vector3(-14.46,1.77,27),
new THREE.Vector3(-10,1.77,27),
new THREE.Vector3(-2.2,1.77,27),
new THREE.Vector3(2.49,1.77,27),
new THREE.Vector3(7.17,1.77,27),
new THREE.Vector3(11.8,1.77,27),
new THREE.Vector3(19.41,1.77,27),
new THREE.Vector3(24.09,1.77,27),
new THREE.Vector3(28.72,1.77,27),
new THREE.Vector3(33.46,1.77,27),
new THREE.Vector3(41.24,1.77,27),
new THREE.Vector3(45.82,1.77,27),
new THREE.Vector3(50.69,1.77,27)
],
railpoints : [ railpoints : [
new THREE.Vector3(52.1,1.77,24), new THREE.Vector3(52.1,1.77,24),
new THREE.Vector3(-64,1.77,24) new THREE.Vector3(-64,1.77,24)

View File

@ -2,10 +2,10 @@ export function getBaseUrl() {
let BASE_API; let BASE_API;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud'; // BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud'; BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪 // BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强 // BASE_API = 'http://192.168.3.6:9000'; // 旭强
BASE_API = 'http://192.168.3.41:9000'; // 张赛 // BASE_API = 'http://192.168.3.41:9000'; // 张赛
// BASE_API = 'http://192.168.3.82:9000'; // 杜康 // BASE_API = 'http://192.168.3.82:9000'; // 杜康
// BASE_API = 'http://b29z135112.zicp.vip'; // BASE_API = 'http://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康 // BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

@ -72,7 +72,6 @@ export default {
await this.$store.dispatch('socket/setRoomSubscribe', false); await this.$store.dispatch('socket/setRoomSubscribe', false);
}, },
async handleJoin() { async handleJoin() {
debugger;
try { try {
this.loading = true; this.loading = true;
const rest = await getPublishMapInfo(this.mapId); const rest = await getPublishMapInfo(this.mapId);

View File

@ -214,18 +214,18 @@
this.moveheight=159; this.moveheight=159;
this.movex=153+"px"; this.movex=153+"px";
} }
if(this.moveheight>85&&this.moveheight<76){ if(this.moveheight<82&&this.moveheight>73){
this.movex=73+"px"; this.movex=75+"px";
this.move = 0; this.move = 0;
}else if(this.moveheight<0&&this.moveheight>159){ }else if(this.moveheight<0&&this.moveheight>159){
}else{ }else{
if(this.moveheight>=85){ if(this.moveheight>=82){
this.move = -(this.moveheight-85)/65; this.move = -(this.moveheight-82)/65;
} }
if(this.moveheight<=75){ if(this.moveheight<=73){
this.move = (75 - this.moveheight)/75; this.move = (73 - this.moveheight)/75;
} }
this.movex=this.moveheight-7+"px"; this.movex=this.moveheight-7+"px";
if(this.moveheight>=145){ if(this.moveheight>=145){

View File

@ -20,7 +20,7 @@
<!-- <Right-Pane ref="rightcontrol" /> --> <!-- <Right-Pane ref="rightcontrol" /> -->
<TopRight-Pane ref="topcontrol" /> <TopRight-Pane ref="topcontrol" :group-num="groupnum" />
@ -118,9 +118,12 @@ import axios from 'axios';
// this.groupnum = selVal; // this.groupnum = selVal;
for(let i=0;i<this.trainlist.length;i++){ for(let i=0;i<this.trainlist.length;i++){
if(this.trainlist[i].groupNumber == this.groupnum){ if(this.trainlist[i].groupNumber == this.groupnum){
// console.log(this.trainlist[i].gear);
// this.groupnum
this.$refs.centercontrol.centerstate(this.trainlist[i].gear); this.$refs.centercontrol.centerstate(this.trainlist[i].gear);
} }
} }
this.nowdrive = this.groupnum; this.nowdrive = this.groupnum;
}).catch(error => { }).catch(error => {
this.groupnum = oldgroupnum; this.groupnum = oldgroupnum;
@ -152,6 +155,7 @@ import axios from 'axios';
option.disabled = false; option.disabled = false;
if(netdata.data[i].name){ if(netdata.data[i].name){
option.label = netdata.data[i].name+"正在驾驶"+netdata.data[i].groupNumber; option.label = netdata.data[i].name+"正在驾驶"+netdata.data[i].groupNumber;
this.groupNumber = netdata.data[i].groupNumber;
option.disabled = true; option.disabled = true;
} }
if(netdata.data[i].driverId){ if(netdata.data[i].driverId){

View File

@ -1,42 +1,42 @@
<template> <template>
<div style="width:100%;height:48%;position:absolute;top:0px;"> <div style="width:100%;height:48%;position:absolute;top:0px;">
<!-- ATB启动 --> <!-- ATB启动 -->
<div id="atb" class="panebutton" style="top:8%;left:3%;" @tap="atbclick"> <!-- <div id="atb" class="panebutton" style="top:8%;left:3%;" @click="atbclick">
<img class="buttonimg" :src="greenimg" /> <img class="buttonimg" :src="greenimg" />
<div class="buttontext">{{ $t('jlmap3d.ATBStart') }}</div> <div class="buttontext">{{ $t('jlmap3d.ATBStart') }}</div>
</div> </div>
<!-- BM/CBTC --> <!-- BM/CBTC -->
<div id="bmcbtc" class="panebutton" style="top:8%;left:17%;" @tap="bmcbtcclick"> <div id="bmcbtc" class="panebutton" style="top:8%;left:17%;" @click="bmcbtcclick">
<img class="buttonimg" :src="greenimg" /> <img class="buttonimg" :src="cbtcbuttonimg" />
<div class="buttontext">BM/CBTC</div> <div class="buttontext">BM/CBTC</div>
</div> </div> -->
<!-- RM --> <!-- RM -->
<div id="rm" class="panebutton" style="top:8%;left:31%;" @tap="rmclick"> <div id="rm" class="panebutton" style="top:8%;left:31%;" @click="rmclick">
<img class="buttonimg" :src="greenimg" /> <img class="buttonimg" :src="rmbuttonimg" />
<div class="buttontext">RM</div> <div class="buttontext">RM</div>
</div> </div>
<!-- 关左门 --> <!-- 关左门 -->
<div id="dlclose" class="panebutton" style="top:8%;left:45%;" @tap="dlcclick"> <div id="dlclose" class="panebutton" style="top:8%;left:45%;" @click="dlcclick">
<img class="buttonimg" :src="greenimg" /> <img class="buttonimg" :src="greenimg" />
<div class="buttontext">{{ $t('jlmap3d.closeLeftDoor') }}</div> <div class="buttontext">{{ $t('jlmap3d.closeLeftDoor') }}</div>
</div> </div>
<!-- 开左门A --> <!-- 开左门A -->
<div id="dlopen" class="panebutton" style="top:8%;left:59%;" @tap="dloclick"> <div id="dlopen" class="panebutton" style="top:8%;left:59%;" @click="dloclick">
<img class="buttonimg" :src="redimg" /> <img class="buttonimg" :src="redimg" />
<div class="buttontext">{{ $t('jlmap3d.openLeftDoor') }}</div> <div class="buttontext">{{ $t('jlmap3d.openLeftDoor') }}</div>
</div> </div>
<!-- ATO启动A --> <!-- ATO启动A -->
<div id="atoa" class="panebutton" style="top:8%;left:73%;" @tap="atoaclick"> <div id="atoa" class="panebutton" style="top:8%;left:73%;" @click="atoaclick">
<img class="buttonimg" :src="apoimg" /> <img class="buttonimg" :src="atobuttonimg" />
<div class="buttontext">{{ $t('jlmap3d.ATOStart') }}</div> <div class="buttontext">{{ $t('jlmap3d.ATOStart') }}</div>
</div> </div>
<!-- cbtc --> <!-- cbtc -->
<div id="cbtc" class="panebutton" style="top:8%;left:87%;" @tap="cbtcclick"> <!-- <div id="cbtc" class="panebutton" style="top:8%;left:87%;" @click="cbtcclick">
<img class="buttonimg" :src="greenimg" /> <img class="buttonimg" :src="cbtcbuttonimg" />
<div class="buttontext">CBTC</div> <div class="buttontext">CBTC</div>
</div> </div> -->
<!-- 电笛按钮 --> <!-- 电笛按钮 -->
<!-- <div id="elflute" class="panebutton" style="bottom:3%;left:84%;" @tap="elfluteclick"> <!-- <div id="elflute" class="panebutton" style="bottom:3%;left:84%;" @click="elfluteclick">
<img class="buttonimg" :src="grayimg" /> <img class="buttonimg" :src="grayimg" />
<div class="buttontext">{{ $t('jlmap3d.electricHornButton') }}</div> <div class="buttontext">{{ $t('jlmap3d.electricHornButton') }}</div>
</div> --> </div> -->
@ -75,22 +75,22 @@
</div> --> </div> -->
<!-- 受电弓升 --> <!-- 受电弓升 -->
<!-- <div id="sg" class="panebutton" style="bottom:6%;left:3%;" @tap="sgclink"> <!-- <div id="sg" class="panebutton" style="bottom:6%;left:3%;" @click="sgclink">
<img class="buttonimg" :src="sgimg" /> <img class="buttonimg" :src="sgimg" />
<div class="buttontext">{{ $t('jlmap3d.electricGongSheng') }}</div> <div class="buttontext">{{ $t('jlmap3d.electricGongSheng') }}</div>
</div> --> </div> -->
<!-- 受电弓降 --> <!-- 受电弓降 -->
<!-- <div id="jg" class="panebutton" style="bottom:6%;left:17%;" @tap="jgclick"> <!-- <div id="jg" class="panebutton" style="bottom:6%;left:17%;" @click="jgclick">
<img class="buttonimg" :src="jgimg" /> <img class="buttonimg" :src="jgimg" />
<div class="buttontext">{{ $t('jlmap3d.pantographFall') }}</div> <div class="buttontext">{{ $t('jlmap3d.pantographFall') }}</div>
</div> --> </div> -->
<!-- 试灯按钮 --> <!-- 试灯按钮 -->
<!-- <div id="sl" class="panebutton" style="bottom:6%;left:40%;" @tap="slclick"> <!-- <div id="sl" class="panebutton" style="bottom:6%;left:40%;" @click="slclick">
<img class="buttonimg" :src="slimg" /> <img class="buttonimg" :src="slimg" />
<div class="buttontext">{{ $t('jlmap3d.lampButton') }}</div> <div class="buttontext">{{ $t('jlmap3d.lampButton') }}</div>
</div> --> </div> -->
<!-- ATP切除 --> <!-- ATP切除 -->
<div id="atp" class="panebutton" style="bottom:6%;left:31%;" @tap="atpclick"> <div id="atp" class="panebutton" style="bottom:6%;left:31%;" @click="atpclick">
<img class="buttonimg" :src="atpimg" /> <img class="buttonimg" :src="atpimg" />
<div class="buttontext">{{ $t('jlmap3d.removalATP') }}</div> <div class="buttontext">{{ $t('jlmap3d.removalATP') }}</div>
</div> </div>
@ -103,11 +103,11 @@
<div class="tfbutton" style="top:25px;left:50px;">{{ $t('jlmap3d.remission') }}</div> <div class="tfbutton" style="top:25px;left:50px;">{{ $t('jlmap3d.remission') }}</div>
<div class="buttontext2">{{ $t('jlmap3d.parkingBrakeMode') }}</div> <div class="buttontext2">{{ $t('jlmap3d.parkingBrakeMode') }}</div>
</div> --> </div> -->
<div id="dropen" class="panebutton" style="bottom:6%;left:45%;" @tap="droclick"> <div id="dropen" class="panebutton" style="bottom:6%;left:45%;" @click="droclick">
<img class="buttonimg" :src="redlimg" /> <img class="buttonimg" :src="redlimg" />
<div class="buttontext">{{ $t('jlmap3d.openRightDoor') }}</div> <div class="buttontext">{{ $t('jlmap3d.openRightDoor') }}</div>
</div> </div>
<div id="drclose" class="panebutton" style="bottom:6%;left:59%;" @tap="drcclick"> <div id="drclose" class="panebutton" style="bottom:6%;left:59%;" @click="drcclick">
<img class="buttonimg" :src="greenimg" /> <img class="buttonimg" :src="greenimg" />
<div class="buttontext">{{ $t('jlmap3d.closeRightDoor') }}</div> <div class="buttontext">{{ $t('jlmap3d.closeRightDoor') }}</div>
</div> </div>
@ -132,6 +132,7 @@
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
// import { sendSimulationCommand } from '@/api/simulation.js'; // import { sendSimulationCommand } from '@/api/simulation.js';
import { trainSimulationDriveMode, trainSimulationAto ,trainSimulationAtp } from '@/jlmap3d/jl3ddrive/drivecontrol/simulation.js';
export default { export default {
name: 'TopRightPane', name: 'TopRightPane',
@ -169,24 +170,29 @@
sivtf:"rotate(0deg)", sivtf:"rotate(0deg)",
driverlighttf:"rotate(0deg)", driverlighttf:"rotate(0deg)",
headlighttf:"rotate(0deg)", headlighttf:"rotate(0deg)",
atobuttonimg:"/static/jl3d/control/green.png",
rmbuttonimg:"/static/jl3d/control/green.png",
cbtcbuttonimg:"/static/jl3d/control/green.png",
} }
}, },
watch: { watch: {
},
props: {
groupNum: {
type: String,
default: null
},
}, },
computed: { computed: {
group() { group() {
return this.$store.state.app.group; return this.$route.query.group;
}, },
code() {
return this.$store.state.app.code;
},
traincode() {
return this.$store.state.app.driverTrain;
}
}, },
mounted() { mounted() {
window.updatabuttonlight = this.updatabuttonlight;
}, },
beforeDestroy() { beforeDestroy() {
@ -329,16 +335,23 @@
}, },
atpclick: function (e){ atpclick: function (e){
//console.log("atp"); //console.log("atp");
trainSimulationAtp(this.group,this.groupNum).then(netdata => {
console.log(netdata);
});
}, },
atbclick: function (e){ atbclick: function (e){
}, },
bmcbtcclick: function (e){ bmcbtcclick: function (e){
trainSimulationDriveMode(this.group,this.groupNum,"CM").then(netdata => {
console.log(netdata);
});
}, },
rmclick: function (e){ rmclick: function (e){
trainSimulationDriveMode(this.group,this.groupNum,"RM").then(netdata => {
console.log(netdata);
});
}, },
dlcclick: function (e){ dlcclick: function (e){
@ -347,7 +360,9 @@
}, },
atoaclick: function (e){ atoaclick: function (e){
trainSimulationAto(this.group,this.groupNum).then(netdata => {
console.log(netdata);
});
}, },
cbtcclick: function (e){ cbtcclick: function (e){
@ -358,6 +373,27 @@
drcclick: function (e){ drcclick: function (e){
}, },
updatabuttonlight: function (data){
// console.log(data);
if(data.runLevel == "CBTC"){
this.cbtcbuttonimg = this.greenlimg;
}else{
this.cbtcbuttonimg = this.greenimg;
}
if(data.driveMode == "RM"){
this.rmbuttonimg = this.greenlimg;
}else{
this.rmbuttonimg = this.greenimg;
}
if(data.atoOn){
this.atobuttonimg = this.greenlimg;
}else{
this.atobuttonimg = this.greenimg;
}
}
}, },
} }
</script> </script>

View File

@ -265,6 +265,7 @@ export default {
updatestatus(newdata){ updatestatus(newdata){
this.trainnum = newdata.groupNumber; this.trainnum = newdata.groupNumber;
this.$refs.mmiui.updatetrainstatus(newdata); this.$refs.mmiui.updatetrainstatus(newdata);
updatabuttonlight(newdata);
}, },
warningmsg(nowmsg){ warningmsg(nowmsg){
this.controlmsg = nowmsg; this.controlmsg = nowmsg;

View File

@ -202,6 +202,7 @@ export default {
}, },
updatetrainstatus(newdata){ updatetrainstatus(newdata){
// //
// console.log(newdata);
this.updatespeed(newdata.v); this.updatespeed(newdata.v);
this.updateatpspeed(newdata.pv); this.updateatpspeed(newdata.pv);
@ -215,6 +216,8 @@ export default {
this.updatedrivemode(newdata.driveMode); this.updatedrivemode(newdata.driveMode);
this.updatestation(newdata.endStation,newdata.nextStation); this.updatestation(newdata.endStation,newdata.nextStation);
this.updateatoatp(newdata.atoOn,newdata.atpOn);
}, },
updatemmistate(aaa){ updatemmistate(aaa){
@ -239,7 +242,7 @@ export default {
} }
}, },
updatedrivedata(drivedata){ updatedrivedata(drivedata){
console.log(drivedata); // console.log(drivedata);
if(drivedata == "breaker"){ if(drivedata == "breaker"){
} }
@ -308,34 +311,68 @@ export default {
} }
}, },
updatarunlevel(drivedata){ updatarunlevel(drivedata){
if(drivedata == "cbtc"){ if(drivedata == "CBTC"){
if(this.m2state == "start"){
this.m2state = 'il';
this.m2image = this.images.m2[this.m2state];
}else if(this.m2state == "il"){
this.m2state = 'itc';
this.m2image = this.images.m2[this.m2state];
}else if(this.m2state == "itc"){
this.m2state = 'cbtc'; this.m2state = 'cbtc';
this.m2image = this.images.m2[this.m2state]; this.m2image = this.images.m2[this.m2state];
}else if(this.m2state == "cbtc"){ // if(this.m2state == "start"){
// this.m2state = 'il';
// this.m2image = this.images.m2[this.m2state];
// }else if(this.m2state == "il"){
// this.m2state = 'itc';
// this.m2image = this.images.m2[this.m2state];
// }else if(this.m2state == "itc"){
// }else if(this.m2state == "cbtc"){
// this.m2state = 'start';
// this.m2image = this.images.m2[this.m2state];
// }
}else if(drivedata == "IL"){
this.m2state = 'il';
this.m2image = this.images.m2[this.m2state];
}else{
this.m2state = 'start'; this.m2state = 'start';
this.m2image = this.images.m2[this.m2state]; this.m2image = this.images.m2[this.m2state];
} }
}
}, },
updatedrivemode(drivedata){ updatedrivemode(drivedata){
if(drivedata == "AA"){ if(drivedata == "CM"){
this.m7state = 'aoac'; this.m1state = 'cm';
this.m7image = this.images.m7[this.m7state]; this.m1image = this.images.m1[this.m1state];
}else if(drivedata == "RM"){
this.m1state = 'rm';
this.m1image = this.images.m1[this.m1state];
}else if(drivedata == "AM"){
this.m1state = 'am';
this.m1image = this.images.m1[this.m1state];
}else{
this.m1state = 'start';
this.m1image = this.images.m1[this.m1state];
} }
if(drivedata == "AM"){
this.m7state = 'aomc'; // if(this.m1state == "start"){
this.m7image = this.images.m7[this.m7state]; // this.m1state = 'rm';
// this.m1image = this.images.m1[this.m1state];
// }else if(this.m1state == "rm"){
// this.m1state = 'am';
// this.m1image = this.images.m1[this.m1state];
// }else if(this.m1state == "am"){
// this.m1state = 'cm';
// this.m1image = this.images.m1[this.m1state];
// }else if(this.m1state == "cm"){
// this.m1state = 'start';
// this.m1image = this.images.m1[this.m1state];
// }
},
updateatoatp(atoon,atpon){
if(!atoon){
this.m9state = "ato";
this.m9image = this.images.m9["ato"];
} }
if(drivedata == "MM"){ if(!atpon){
this.m7state = 'momc'; this.m9state = "atp";
this.m7image = this.images.m7[this.m7state]; this.m9image = this.images.m9["atp"];
} }
}, },
updatelen(len) { updatelen(len) {

View File

@ -85,7 +85,7 @@ export default {
} }
}, },
updatestationlist(list){ updatestationlist(list){
console.log(list); // console.log(list);
this.value = list[0].name this.value = list[0].name
this.stationlist = list; this.stationlist = list;
}, },

View File

@ -4,7 +4,7 @@
<div v-show="!minimize" class="chat-box"> <div v-show="!minimize" class="chat-box">
<chat-member-list ref="chatMemberList" :group="group" :current-coversition="currentCoversition" @addCoversition="addCoversition" /> <chat-member-list ref="chatMemberList" :group="group" :current-coversition="currentCoversition" @addCoversition="addCoversition" />
<div class="chat-box-main"> <div class="chat-box-main">
<chat-coversition-list ref="chatCoversitionList" @setCurrentCoversition="setCurrentCoversition" @setHeadTitle="setHeadTitle" /> <chat-coversition-list ref="chatCoversitionList" :user-role="userRole" @hideAddCoversition="hideAddCoversition" @setCurrentCoversition="setCurrentCoversition" @setHeadTitle="setHeadTitle" />
<div class="chat-window"> <div class="chat-window">
<div class="chat-box-header"> <div class="chat-box-header">
<div class="chat-box-header-title">{{ headerTitle }}</div> <div class="chat-box-header-title">{{ headerTitle }}</div>
@ -30,7 +30,8 @@
</div> </div>
<div class="chat-box-footer"> <div class="chat-box-footer">
<div class="chat-box-footer-tool" /> <div class="chat-box-footer-tool" />
<div class="chat-box-footer-send" @click="startRecording()">发送语音</div> <el-button v-if="isButtonShow" size="mini" type="danger" class="chat-box-footer-quit" :loading="quitLoading" @click="quitCoversition()">退出群聊</el-button>
<el-button v-if="currentCoversition.all||isButtonShow" class="chat-box-footer-send" size="mini" type="primary" :disabled="recordSending" @click="startRecording()">发送语音</el-button>
<div v-if="scriptTip" class="scriptTip">{{ scriptTip }}</div> <div v-if="scriptTip" class="scriptTip">{{ scriptTip }}</div>
</div> </div>
</div> </div>
@ -54,7 +55,7 @@ import ChatCreateGroup from './chatCreateGroup';
import ChatMemberList from './chatMemberList'; import ChatMemberList from './chatMemberList';
import ChatCoversitionList from './chatCoversitionList'; import ChatCoversitionList from './chatCoversitionList';
import RecordRTC from 'recordrtc'; import RecordRTC from 'recordrtc';
import {uploadAudioFileNew} from '@/api/chat'; import {uploadAudioFileNew, quitCoversition} from '@/api/chat';
export default { export default {
name: 'ChatBox', name: 'ChatBox',
components:{ components:{
@ -82,6 +83,8 @@ export default {
currentCoversition:{}, currentCoversition:{},
seconds:0, seconds:0,
inter:null, inter:null,
isHasCoversition:false,
quitLoading:false,
recorders: null, recorders: null,
microphone:null, microphone:null,
scriptTip:'', scriptTip:'',
@ -94,7 +97,10 @@ export default {
}, },
computed:{ computed:{
isShow() { isShow() {
return this.userRole != 'ADMIN' && this.userRole != 'AUDIENCE'; return this.userRole != 'ADMIN' && this.userRole != 'AUDIENCE' && !this.isHasCoversition;
},
isButtonShow() {
return this.userRole != 'ADMIN' && this.userRole != 'AUDIENCE' && this.isHasCoversition;
} }
}, },
watch: { watch: {
@ -144,21 +150,39 @@ export default {
setSetting(data) { setSetting(data) {
this.form = data; this.form = data;
}, },
hideAddCoversition() {
this.isHasCoversition = true;
},
setCurrentCoversition(coversition) { setCurrentCoversition(coversition) {
if (coversition && coversition.id) {
this.currentCoversition = coversition; this.currentCoversition = coversition;
if (coversition.all) {
this.headerTitle = coversition.name; this.headerTitle = coversition.name;
} else {
this.headerTitle = '';
} }
if (this.recordSending) { if (this.recordSending) {
this.cancleRecording(); this.cancleRecording();
} }
this.$refs.chatContent.scrollTop(); this.$refs.chatContent.scrollTop();
}, },
quitCoversition() {
this.quitLoading = true;
quitCoversition(this.group, this.currentCoversition.id).then(res=>{
this.quitLoading = false;
this.currentCoversition = {all:undefined, id:null};
this.$refs.chatCoversitionList.initPage(true);
this.isHasCoversition = false;
}).catch(error=>{
this.$messageBox('退出会话失败: ' + error.message);
this.quitLoading = false;
});
},
setHeadTitle(headerTitle) { setHeadTitle(headerTitle) {
this.headerTitle = headerTitle; this.headerTitle = headerTitle;
}, },
addCoversition({data, headerTitle}) { addCoversition({data, headerTitle}) {
this.$refs.chatCoversitionList.addCoversition(data, headerTitle); this.$refs.chatCoversitionList.addCoversition(data, headerTitle);
this.isHasCoversition = true;
this.currentCoversition = {id:data.id, all:data.all}; this.currentCoversition = {id:data.id, all:data.all};
this.headerTitle = headerTitle; this.headerTitle = headerTitle;
}, },
@ -281,6 +305,15 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.chat-box-footer-quit{
font-size: 12px;
padding: 5px 15px;
color: #fff;
float: left;
margin-left: 10px;
margin-bottom: 10px;
cursor: pointer;
}
.chatBox{ .chatBox{
width: 503px; width: 503px;
// height: 400px; // height: 400px;
@ -347,17 +380,13 @@ export default {
height: 30px; height: 30px;
} }
.chat-box-footer-send{ .chat-box-footer-send{
background: #36a2fd;
width: 65px;
font-size: 12px; font-size: 12px;
padding: 5px 0px 4px 0px;
text-align: center; text-align: center;
border-radius: 3px;
color: #fff;
float: right; float: right;
margin-right: 10px; margin-right: 10px;
margin-bottom: 10px; margin-bottom: 10px;
cursor: pointer; cursor: pointer;
padding: 5px 15px;
} }
.minimality { .minimality {
float: right; float: right;
@ -385,6 +414,10 @@ export default {
.coversition-list{ .coversition-list{
} }
.chat-box-footer-send.disbled{
cursor: no-drop;
}
.scriptTip{ .scriptTip{
position: absolute; position: absolute;
width: 260px; width: 260px;

View File

@ -70,6 +70,7 @@ export default {
}, },
methods:{ methods:{
inintData() { inintData() {
if (this.coversition.id) {
getSimulationContextListNew(this.$route.query.group, this.coversition.id).then(res=>{ getSimulationContextListNew(this.$route.query.group, this.coversition.id).then(res=>{
const userId = this.$store.state.user.id; const userId = this.$store.state.user.id;
const coversitionList = res.data.map(coversition=>{ const coversitionList = res.data.map(coversition=>{
@ -77,13 +78,14 @@ export default {
if (coversition.member.userId == userId) { if (coversition.member.userId == userId) {
coversition.self = true; coversition.self = true;
} }
coversition.src = coversition.isAudio ? `/jlcloud/audio/${coversition.audioPath}` : ''; coversition.src = coversition.isAudio ? `/audio/${coversition.audioPath}` : '';
coversition.targetUser = coversition.targetMember ? coversition.targetMember : 'All'; coversition.targetUser = coversition.targetMember ? coversition.targetMember : 'All';
return coversition; return coversition;
}); });
this.chatContentList = coversitionList; this.chatContentList = coversitionList;
this.scrollTop(); this.scrollTop();
}); });
}
// const coversitionListAll = Object.assign({}, this.$store.state.socket.coversitionList); // const coversitionListAll = Object.assign({}, this.$store.state.socket.coversitionList);
// const coversitionList = coversitionListAll[this.coversition.id] || []; // const coversitionList = coversitionListAll[this.coversition.id] || [];
// // console.log('inintData---coversitionList' + JSON.stringify(this.$store.state.socket.coversitionList[this.coversition.id])); // // console.log('inintData---coversitionList' + JSON.stringify(this.$store.state.socket.coversitionList[this.coversition.id]));

View File

@ -7,45 +7,63 @@
:key="coversition.id" :key="coversition.id"
:class="coversition.id==currentCoversition.id?'coversition-active each-coversition':'each-coversition'" :class="coversition.id==currentCoversition.id?'coversition-active each-coversition':'each-coversition'"
@click="changeCoversition(coversition)" @click="changeCoversition(coversition)"
>{{ coversition.coverName }}</div> >{{ coversition.name }}</div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
import {getSimulationConversationListNew} from '@/api/chat'; import {getSimulationConversationListNew} from '@/api/chat';
export default { export default {
name:'ChatCoversitionList', name:'ChatCoversitionList',
props: {
userRole: {
type: String,
required: true
}
},
data() { data() {
return { return {
coversitionList:[], coversitionList:[],
currentCoversition:{} currentCoversition:{}
}; };
}, },
mounted() { watch:{
'userRole':function(val) {
this.initPage(true); this.initPage(true);
}
},
mounted() {
}, },
methods:{ methods:{
initPage(status) { initPage(status) {
getSimulationConversationListNew(this.$route.query.group).then(resp=>{ getSimulationConversationListNew(this.$route.query.group).then(resp=>{
if (resp.data) { if (resp.data) {
const data = resp.data; const data = resp.data;
data.map(coversition=>{ if (this.userRole == 'ADMIN' || this.userRole == 'AUDIENCE') {
if (coversition.name) {
coversition.coverName = coversition.name;
coversition.isOnline = true;
} else {
const objectCover = this.handleMemberName(coversition);
coversition.coverName = objectCover.coversitionName;
coversition.isOnline = objectCover.isOnline;
}
return coversition;
});
this.coversitionList = data; this.coversitionList = data;
} else {
this.coversitionList = data.filter(coversition=>{ return coversition.all == false; });
if (this.coversitionList.length >= 1) {
this.$emit('hideAddCoversition');
}
}
if (resp.data && resp.data.length && resp.data.length > 0 && status) { if (resp.data && resp.data.length && resp.data.length > 0 && status) {
if (this.userRole == 'ADMIN' || this.userRole == 'AUDIENCE') {
this.currentCoversition = data[0]; this.currentCoversition = data[0];
this.$emit('setCurrentCoversition', resp.data[0]); this.$emit('setCurrentCoversition', resp.data[0]);
} else {
if (this.coversitionList.length >= 1) {
this.currentCoversition = data[0];
this.$emit('setCurrentCoversition', resp.data[0]);
} else {
this.currentCoversition = null;
this.$emit('setCurrentCoversition', this.currentCoversition);
}
}
} else if (resp.data && resp.data.length && resp.data.length > 0 && !status) {
const coversition = data.filter(coversition=>{ return coversition.all == false; });
this.currentCoversition = coversition[0];
this.$emit('setCurrentCoversition', coversition[0]);
} }
} }
}); });
@ -53,82 +71,22 @@ export default {
addCoversition(data, headerTitle) { 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) {
const objectCover = this.handleMemberName(data);
if (data.name) {
data.coverName = data.name;
data.isOnline = true;
} else {
data.coverName = objectCover.coversitionName;
data.isOnline = objectCover.isOnline;
}
this.coversitionList.push(data); this.coversitionList.push(data);
if (headerTitle) {
this.currentCoversition = data; this.currentCoversition = data;
} }
}
}, },
changeCoversition(coversition) { changeCoversition(coversition) {
this.$emit('setHeadTitle', coversition.coverName); this.$emit('setHeadTitle', coversition.name);
this.currentCoversition = {id:coversition.id, all:coversition.all}; this.currentCoversition = {id:coversition.id, all:coversition.all};
this.$emit('setCurrentCoversition', coversition); this.$emit('setCurrentCoversition', coversition);
// this.$refs.chatContent.reloadData(this.currentCoversition); // this.$refs.chatContent.reloadData(this.currentCoversition);
}, },
changeCoversitionOther(coversition) { changeCoversitionOther(coversition) {
const objectCover = this.handleMemberName(coversition);
coversition.coverName = objectCover.coversitionName;
coversition.isOnline = objectCover.isOnline;
const index = this.coversitionList.findIndex(item=>{ return item.id == coversition.id; }); const index = this.coversitionList.findIndex(item=>{ return item.id == coversition.id; });
if (index < 0) { if (index < 0) {
this.coversitionList.push(coversition); this.coversitionList.push(coversition);
} }
this.changeCoversition(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};
}
} }
} }
}; };

View File

@ -51,6 +51,8 @@ export default {
}, },
methods:{ methods:{
getSimulationMembers() { getSimulationMembers() {
this.memberList = [];
if (this.currentCoversition.id) {
getSimulationChatMemberNew(this.$route.query.group, this.currentCoversition.id).then(resp => { getSimulationChatMemberNew(this.$route.query.group, this.currentCoversition.id).then(resp => {
let lastData = JSON.stringify(resp.data); let lastData = JSON.stringify(resp.data);
const roleTypeList = ConstConfig.ConstSelect.roleTypeNew; const roleTypeList = ConstConfig.ConstSelect.roleTypeNew;
@ -71,6 +73,7 @@ export default {
}); });
this.memberList = lastData; this.memberList = lastData;
}); });
}
}, },
getMember(memberId) { getMember(memberId) {
return this.memberList.filter(member=>{ return this.memberList.filter(member=>{

View File

@ -4,7 +4,7 @@
<div v-show="!minimize" class="chat-box"> <div v-show="!minimize" class="chat-box">
<chat-member-list ref="chatMemberList" :group="group" :current-coversition="currentCoversition" /> <chat-member-list ref="chatMemberList" :group="group" :current-coversition="currentCoversition" />
<div class="chat-box-main"> <div class="chat-box-main">
<chat-coversition-list ref="chatCoversitionList" :group="group" :user-role="userRole" @hideAddCoversition="hideAddCoversition" @setCurrentCoversition="setCurrentCoversition" @setHeadTitle="setHeadTitle" /> <chat-coversition-list ref="chatCoversitionList" :user-role="userRole" @hideAddCoversition="hideAddCoversition" @setCurrentCoversition="setCurrentCoversition" @setHeadTitle="setHeadTitle" />
<div class="chat-window"> <div class="chat-window">
<div class="chat-box-header"> <div class="chat-box-header">
<div class="chat-box-header-title">{{ headerTitle }}</div> <div class="chat-box-header-title">{{ headerTitle }}</div>
@ -30,8 +30,8 @@
</div> </div>
<div class="chat-box-footer"> <div class="chat-box-footer">
<div class="chat-box-footer-tool" /> <div class="chat-box-footer-tool" />
<div v-if="isButtonShow" class="chat-box-footer-quit" @click="quitCoversition()">退出群聊</div> <el-button v-if="isButtonShow" size="mini" type="danger" class="chat-box-footer-quit" :loading="quitLoading" @click="quitCoversition()">退出群聊</el-button>
<div v-if="currentCoversition.all||isButtonShow" class="chat-box-footer-send" @click="startRecording()">发送语音</div> <el-button v-if="currentCoversition.all||isButtonShow" class="chat-box-footer-send" size="mini" type="primary" :disabled="recordSending" @click="startRecording()">发送语音</el-button>
</div> </div>
</div> </div>
</div> </div>
@ -87,6 +87,7 @@ export default {
recorders: null, recorders: null,
microphone:null, microphone:null,
isHasCoversition:false, isHasCoversition:false,
quitLoading:false,
form:{ form:{
language:'zh', language:'zh',
sex:'1' sex:'1'
@ -132,7 +133,7 @@ export default {
this.$refs.chatCoversitionList.initPage(false); this.$refs.chatCoversitionList.initPage(false);
}, },
setCurrentCoversition(coversition) { setCurrentCoversition(coversition) {
if (coversition) { if (coversition.id) {
this.currentCoversition = coversition; this.currentCoversition = coversition;
this.headerTitle = coversition.name; this.headerTitle = coversition.name;
} else { } else {
@ -150,12 +151,15 @@ export default {
this.isHasCoversition = true; this.isHasCoversition = true;
}, },
quitCoversition() { quitCoversition() {
this.quitLoading = true;
quitCoversition(this.group, this.currentCoversition.id).then(res=>{ quitCoversition(this.group, this.currentCoversition.id).then(res=>{
this.currentCoversition = {all:undefined, id:null}; this.currentCoversition = {all:undefined, id:null};
this.$refs.chatCoversitionList.initPage(true); this.$refs.chatCoversitionList.initPage(true);
this.isHasCoversition = false; this.isHasCoversition = false;
this.quitLoading = false;
}).catch(error=>{ }).catch(error=>{
this.$messageBox('退出会话失败: ' + error.message); this.$messageBox('退出会话失败: ' + error.message);
this.quitLoading = false;
}); });
}, },
addCoversition({data, headerTitle}) { addCoversition({data, headerTitle}) {
@ -461,6 +465,9 @@ export default {
background: #eeeeee; background: #eeeeee;
cursor: pointer; cursor: pointer;
} }
.chat-box-footer-send.disbled{
cursor: no-drop;
}
.minimize-box { .minimize-box {
width: 97.5%; width: 97.5%;

View File

@ -19,10 +19,6 @@ import {getSimulationConversationListNew} from '@/api/chat';
export default { export default {
name:'ChatCoversitionList', name:'ChatCoversitionList',
props: { props: {
group: {
type: String,
required: true
},
userRole: { userRole: {
type: String, type: String,
required: true required: true