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 = 'http://192.168.3.4: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,
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.

View File

@ -4,4 +4,4 @@ VUE_APP_PRO = 'local'
# base api
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
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
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: ''
})
}
//EB紧急制动
export function trainSimulationEb(group,groupNumber) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/eb`,
@ -83,6 +84,8 @@ export function trainSimulationEb(group,groupNumber) {
params: ''
})
}
//改变列车牵引/制动力
export function trainSimulationForce(group,groupNumber,percent) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/force/${percent}`,
@ -90,6 +93,8 @@ export function trainSimulationForce(group,groupNumber,percent) {
params: ''
})
}
//改变列车档位
export function trainSimulationGear(group,groupNumber,gear) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/gear/${gear}`,
@ -97,3 +102,30 @@ export function trainSimulationGear(group,groupNumber,gear) {
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);
// 遍历后台数据
// console.log(data);
if(data.type == "Train_Position"){

View File

@ -3,14 +3,14 @@ import { getBaseUrl } from '@/utils/baseUrl'
import { getToken } from '@/utils/auth';
// 定于仿真socket接口
export function PassflowConnect(nowstation,deviceaction,lefttrain,righttrain,routegroup) {
export function PassflowConnect(nowstation,deviceaction,toptrain,downtrain,routegroup) {
const scope = this;
this.controlstation = nowstation;
this.teststomp = new StompClient();
let trainleftnow = null;
let trainrightnow = null;
let traintopnow = null;
let traindownnow = null;
let topic = '/user/queue/simulation/jl3d/'+routegroup;
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.code == nowstation.toppsd){
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.time =deviceaction.top.action._clip.duration;
deviceaction.top.action.timeScale = -1;
@ -61,25 +49,133 @@ export function PassflowConnect(nowstation,deviceaction,lefttrain,righttrain,rou
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(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"){
console.log(data.body);
console.log(nowstation);
for(let i=0,leni = data.body.length;i<leni;i++){
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);
}
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 originanima1 = null;
let originanima2 = null;
let lefttrain = null;
let righttrain = null;
let toptrain = null;
let downtrain = null;
let zhajiin = [];
let zhajiout = [];
@ -395,9 +395,9 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
getPublishMapDetail(skinCode).then(netdata => {
console.log(netdata);
// console.log(netdata);
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();
@ -815,7 +815,7 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
// console.log(humanlist.children.length);
}
function initstationlist(stationdata,standdata,psddata){
// console.log(standdata);
let list = [];
for(let i=0,leni = standdata.length;i<leni;i++){
for(let j=0,lenj = psddata.length;j<lenj;j++){
@ -846,7 +846,7 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
topsection: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.downpsd = list[k][1].name;
stationobject.topsection = list[k][0].standTrackCode;
@ -864,7 +864,7 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
nowstation = stationlist[0];
updatestationlist(stationlist);
console.log(nowstation);
// console.log(nowstation);
}
function inittrain(object){
let ntracks1,ntracks2,tclip,fclip;
@ -879,23 +879,40 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
lefttrain = object.clone(true);
lefttrain.action = {
toptrain = object.clone(true);
toptrain.action = {
top:[],
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:[],
down:[]
};
inittrainanimation(lefttrain,tclip,fclip);
inittrainanimation(righttrain,tclip,fclip);
lefttrain.position.z = 30;
righttrain.position.z = -10;
// scene.add(lefttrain);
// scene.add(righttrain);
let points2 = [];
points2.push(new THREE.Vector3(-71,0.06,28.68));
points2.push(new THREE.Vector3(60.73,0.06,28.68));
downtrain.curve = new THREE.CatmullRomCurve3(points2);
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){
@ -960,6 +977,11 @@ export function Jl3dpassflow(dom,skinCode,routegroup) {
for(let j=0;j<object.children.length;j++){
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.push(newclip.clone());

View File

@ -57,6 +57,30 @@ let standtop = {
type : "stand",
stage : "3",
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 : [
new THREE.Vector3(52.1,1.77,-1.8),
new THREE.Vector3(-63.5,1.77,-1.8)
@ -69,6 +93,30 @@ let standdown = {
type : "stand",
stage : "3",
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 : [
new THREE.Vector3(52.1,1.77,24),
new THREE.Vector3(-64,1.77,24)

View File

@ -2,10 +2,10 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// 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.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://b29z135112.zicp.vip';
// BASE_API = 'http://2925963m2a.zicp.vip'; // 杜康

View File

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

View File

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

View File

@ -20,7 +20,7 @@
<!-- <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;
for(let i=0;i<this.trainlist.length;i++){
if(this.trainlist[i].groupNumber == this.groupnum){
// console.log(this.trainlist[i].gear);
// this.groupnum
this.$refs.centercontrol.centerstate(this.trainlist[i].gear);
}
}
this.nowdrive = this.groupnum;
}).catch(error => {
this.groupnum = oldgroupnum;
@ -152,6 +155,7 @@ import axios from 'axios';
option.disabled = false;
if(netdata.data[i].name){
option.label = netdata.data[i].name+"正在驾驶"+netdata.data[i].groupNumber;
this.groupNumber = netdata.data[i].groupNumber;
option.disabled = true;
}
if(netdata.data[i].driverId){

View File

@ -1,42 +1,42 @@
<template>
<div style="width:100%;height:48%;position:absolute;top:0px;">
<!-- 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" />
<div class="buttontext">{{ $t('jlmap3d.ATBStart') }}</div>
</div>
<!-- BM/CBTC -->
<div id="bmcbtc" class="panebutton" style="top:8%;left:17%;" @tap="bmcbtcclick">
<img class="buttonimg" :src="greenimg" />
<div id="bmcbtc" class="panebutton" style="top:8%;left:17%;" @click="bmcbtcclick">
<img class="buttonimg" :src="cbtcbuttonimg" />
<div class="buttontext">BM/CBTC</div>
</div>
</div> -->
<!-- RM -->
<div id="rm" class="panebutton" style="top:8%;left:31%;" @tap="rmclick">
<img class="buttonimg" :src="greenimg" />
<div id="rm" class="panebutton" style="top:8%;left:31%;" @click="rmclick">
<img class="buttonimg" :src="rmbuttonimg" />
<div class="buttontext">RM</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" />
<div class="buttontext">{{ $t('jlmap3d.closeLeftDoor') }}</div>
</div>
<!-- 开左门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" />
<div class="buttontext">{{ $t('jlmap3d.openLeftDoor') }}</div>
</div>
<!-- ATO启动A -->
<div id="atoa" class="panebutton" style="top:8%;left:73%;" @tap="atoaclick">
<img class="buttonimg" :src="apoimg" />
<div id="atoa" class="panebutton" style="top:8%;left:73%;" @click="atoaclick">
<img class="buttonimg" :src="atobuttonimg" />
<div class="buttontext">{{ $t('jlmap3d.ATOStart') }}</div>
</div>
<!-- cbtc -->
<div id="cbtc" class="panebutton" style="top:8%;left:87%;" @tap="cbtcclick">
<img class="buttonimg" :src="greenimg" />
<!-- <div id="cbtc" class="panebutton" style="top:8%;left:87%;" @click="cbtcclick">
<img class="buttonimg" :src="cbtcbuttonimg" />
<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" />
<div class="buttontext">{{ $t('jlmap3d.electricHornButton') }}</div>
</div> -->
@ -75,22 +75,22 @@
</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" />
<div class="buttontext">{{ $t('jlmap3d.electricGongSheng') }}</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" />
<div class="buttontext">{{ $t('jlmap3d.pantographFall') }}</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" />
<div class="buttontext">{{ $t('jlmap3d.lampButton') }}</div>
</div> -->
<!-- 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" />
<div class="buttontext">{{ $t('jlmap3d.removalATP') }}</div>
</div>
@ -103,11 +103,11 @@
<div class="tfbutton" style="top:25px;left:50px;">{{ $t('jlmap3d.remission') }}</div>
<div class="buttontext2">{{ $t('jlmap3d.parkingBrakeMode') }}</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" />
<div class="buttontext">{{ $t('jlmap3d.openRightDoor') }}</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" />
<div class="buttontext">{{ $t('jlmap3d.closeRightDoor') }}</div>
</div>
@ -132,6 +132,7 @@
<script>
import Vue from 'vue';
// import { sendSimulationCommand } from '@/api/simulation.js';
import { trainSimulationDriveMode, trainSimulationAto ,trainSimulationAtp } from '@/jlmap3d/jl3ddrive/drivecontrol/simulation.js';
export default {
name: 'TopRightPane',
@ -169,24 +170,29 @@
sivtf:"rotate(0deg)",
driverlighttf:"rotate(0deg)",
headlighttf:"rotate(0deg)",
atobuttonimg:"/static/jl3d/control/green.png",
rmbuttonimg:"/static/jl3d/control/green.png",
cbtcbuttonimg:"/static/jl3d/control/green.png",
}
},
watch: {
},
props: {
groupNum: {
type: String,
default: null
},
},
computed: {
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() {
window.updatabuttonlight = this.updatabuttonlight;
},
beforeDestroy() {
@ -329,16 +335,23 @@
},
atpclick: function (e){
//console.log("atp");
trainSimulationAtp(this.group,this.groupNum).then(netdata => {
console.log(netdata);
});
},
atbclick: function (e){
},
bmcbtcclick: function (e){
trainSimulationDriveMode(this.group,this.groupNum,"CM").then(netdata => {
console.log(netdata);
});
},
rmclick: function (e){
trainSimulationDriveMode(this.group,this.groupNum,"RM").then(netdata => {
console.log(netdata);
});
},
dlcclick: function (e){
@ -347,7 +360,9 @@
},
atoaclick: function (e){
trainSimulationAto(this.group,this.groupNum).then(netdata => {
console.log(netdata);
});
},
cbtcclick: function (e){
@ -358,6 +373,27 @@
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>

View File

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

View File

@ -202,6 +202,7 @@ export default {
},
updatetrainstatus(newdata){
//
// console.log(newdata);
this.updatespeed(newdata.v);
this.updateatpspeed(newdata.pv);
@ -215,6 +216,8 @@ export default {
this.updatedrivemode(newdata.driveMode);
this.updatestation(newdata.endStation,newdata.nextStation);
this.updateatoatp(newdata.atoOn,newdata.atpOn);
},
updatemmistate(aaa){
@ -239,7 +242,7 @@ export default {
}
},
updatedrivedata(drivedata){
console.log(drivedata);
// console.log(drivedata);
if(drivedata == "breaker"){
}
@ -308,34 +311,68 @@ export default {
}
},
updatarunlevel(drivedata){
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"){
if(drivedata == "CBTC"){
this.m2state = 'cbtc';
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.m2image = this.images.m2[this.m2state];
}
}
},
updatedrivemode(drivedata){
if(drivedata == "AA"){
this.m7state = 'aoac';
this.m7image = this.images.m7[this.m7state];
if(drivedata == "CM"){
this.m1state = 'cm';
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';
this.m7image = this.images.m7[this.m7state];
// if(this.m1state == "start"){
// 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"){
this.m7state = 'momc';
this.m7image = this.images.m7[this.m7state];
if(!atpon){
this.m9state = "atp";
this.m9image = this.images.m9["atp"];
}
},
updatelen(len) {

View File

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

View File

@ -4,7 +4,7 @@
<div v-show="!minimize" class="chat-box">
<chat-member-list ref="chatMemberList" :group="group" :current-coversition="currentCoversition" @addCoversition="addCoversition" />
<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-box-header">
<div class="chat-box-header-title">{{ headerTitle }}</div>
@ -30,7 +30,8 @@
</div>
<div class="chat-box-footer">
<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>
</div>
@ -54,7 +55,7 @@ import ChatCreateGroup from './chatCreateGroup';
import ChatMemberList from './chatMemberList';
import ChatCoversitionList from './chatCoversitionList';
import RecordRTC from 'recordrtc';
import {uploadAudioFileNew} from '@/api/chat';
import {uploadAudioFileNew, quitCoversition} from '@/api/chat';
export default {
name: 'ChatBox',
components:{
@ -82,6 +83,8 @@ export default {
currentCoversition:{},
seconds:0,
inter:null,
isHasCoversition:false,
quitLoading:false,
recorders: null,
microphone:null,
scriptTip:'',
@ -94,7 +97,10 @@ export default {
},
computed:{
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: {
@ -144,21 +150,39 @@ export default {
setSetting(data) {
this.form = data;
},
hideAddCoversition() {
this.isHasCoversition = true;
},
setCurrentCoversition(coversition) {
if (coversition && coversition.id) {
this.currentCoversition = coversition;
if (coversition.all) {
this.headerTitle = coversition.name;
} else {
this.headerTitle = '';
}
if (this.recordSending) {
this.cancleRecording();
}
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) {
this.headerTitle = headerTitle;
},
addCoversition({data, headerTitle}) {
this.$refs.chatCoversitionList.addCoversition(data, headerTitle);
this.isHasCoversition = true;
this.currentCoversition = {id:data.id, all:data.all};
this.headerTitle = headerTitle;
},
@ -281,6 +305,15 @@ export default {
};
</script>
<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{
width: 503px;
// height: 400px;
@ -347,17 +380,13 @@ export default {
height: 30px;
}
.chat-box-footer-send{
background: #36a2fd;
width: 65px;
font-size: 12px;
padding: 5px 0px 4px 0px;
text-align: center;
border-radius: 3px;
color: #fff;
float: right;
margin-right: 10px;
margin-bottom: 10px;
cursor: pointer;
padding: 5px 15px;
}
.minimality {
float: right;
@ -385,6 +414,10 @@ export default {
.coversition-list{
}
.chat-box-footer-send.disbled{
cursor: no-drop;
}
.scriptTip{
position: absolute;
width: 260px;

View File

@ -70,6 +70,7 @@ export default {
},
methods:{
inintData() {
if (this.coversition.id) {
getSimulationContextListNew(this.$route.query.group, this.coversition.id).then(res=>{
const userId = this.$store.state.user.id;
const coversitionList = res.data.map(coversition=>{
@ -77,13 +78,14 @@ export default {
if (coversition.member.userId == userId) {
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';
return coversition;
});
this.chatContentList = coversitionList;
this.scrollTop();
});
}
// const coversitionListAll = Object.assign({}, this.$store.state.socket.coversitionList);
// const coversitionList = coversitionListAll[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"
:class="coversition.id==currentCoversition.id?'coversition-active each-coversition':'each-coversition'"
@click="changeCoversition(coversition)"
>{{ coversition.coverName }}</div>
>{{ coversition.name }}</div>
</div>
</div>
</template>
<script>
import ConstConfig from '@/scripts/ConstConfig';
import Cookies from 'js-cookie';
import {getSimulationConversationListNew} from '@/api/chat';
export default {
name:'ChatCoversitionList',
props: {
userRole: {
type: String,
required: true
}
},
data() {
return {
coversitionList:[],
currentCoversition:{}
};
},
mounted() {
watch:{
'userRole':function(val) {
this.initPage(true);
}
},
mounted() {
},
methods:{
initPage(status) {
getSimulationConversationListNew(this.$route.query.group).then(resp=>{
if (resp.data) {
const data = resp.data;
data.map(coversition=>{
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;
});
if (this.userRole == 'ADMIN' || this.userRole == 'AUDIENCE') {
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 (this.userRole == 'ADMIN' || this.userRole == 'AUDIENCE') {
this.currentCoversition = 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) {
const index = this.coversitionList.findIndex(item=>{ return item.id == data.id; });
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);
if (headerTitle) {
this.currentCoversition = data;
}
}
},
changeCoversition(coversition) {
this.$emit('setHeadTitle', coversition.coverName);
this.$emit('setHeadTitle', coversition.name);
this.currentCoversition = {id:coversition.id, all:coversition.all};
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;
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};
}
}
}
};

View File

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

View File

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

View File

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