修改三维驾驶通信接口改post

This commit is contained in:
sunzhenyu 2020-06-18 18:40:47 +08:00
parent 47d77d6925
commit 8b2c0cc00a
5 changed files with 112 additions and 54 deletions

View File

@ -77,73 +77,73 @@ export function bindSimulationTrain(group,groupNumber) {
}) })
} }
//EB紧急制动 //EB紧急制动
export function trainSimulationEb(group,groupNumber) { export function trainSimulationEb(group,data) {
return request({ return request({
url: `/simulation/driving/${group}/train/${groupNumber}/eb`, url: `/simulation/${group}/operate/Driver_EB`,
method: 'put', method: 'post',
params: '' data: data
}) })
} }
//改变列车牵引/制动力 //改变列车牵引/制动力
export function trainSimulationForce(group,groupNumber,percent) { export function trainSimulationForce(group,data) {
return request({ return request({
url: `/simulation/driving/${group}/train/${groupNumber}/force/${percent}`, url: `/simulation/${group}/operate/Driver_Force_Change`,
method: 'put', method: 'post',
params: '' data: data
}) })
} }
//改变列车档位 //改变列车档位
export function trainSimulationGear(group,groupNumber,gear) { export function trainSimulationGear(group,data) {
return request({ return request({
url: `/simulation/driving/${group}/train/${groupNumber}/gear/${gear}`, url: `/simulation/${group}/operate/Driver_Gear_Change`,
method: 'put', method: 'post',
params: '' data: data
}) })
} }
//改变列车运行级别 //改变列车运行级别
export function trainSimulationDriveMode(group,groupNumber,driveMode) { export function trainSimulationDriveMode(group,data) {
return request({ return request({
url: `/simulation/driving/${group}/train/${groupNumber}/driveMode/${driveMode}`, url: `/simulation/${group}/operate/Driver_Drive_Mode_Change`,
method: 'put', method: 'post',
params: '' data: data
}) })
} }
//ATP切除 //ATP切除
//ATO //ATO
export function trainSimulationAtp(group,groupNumber) { export function trainSimulationAtp(group,data) {
return request({ return request({
url: `/simulation/driving/${group}/train/${groupNumber}/atp`, url: `/simulation/${group}/operate/Driver_ATP_Change`,
method: 'put', method: 'post',
params: '' data: data
}) })
} }
//ATO //ATO
export function trainSimulationAto(group,groupNumber) { export function trainSimulationAto(group,data) {
return request({ return request({
url: `/simulation/driving/${group}/train/${groupNumber}/openAto`, url: `/simulation/${group}/operate/Driver_ATO_Open`,
method: 'put', method: 'post',
params: '' data: data
}) })
} }
//换端 //换端
export function trainSimulationChangeHead(group,groupNumber) { export function trainSimulationChangeHead(group,data) {
return request({ return request({
url: `/simulation/driving/${group}/train/${groupNumber}/changeHead`, url: `/simulation/${group}/operate/Driver_Change_Head`,
method: 'put', method: 'post',
params: '' data: data
}) })
} }
// //
export function trainSimulationDoorControl(group,groupNumber,direct,open) { export function trainSimulationDoorControl(group,data) {
return request({ return request({
url: `/simulation/driving/${group}/train/${groupNumber}/onOrOffDoor?right=${direct}&open=${open}`, url: `/simulation/${group}/operate/Driver_Door_On_Off`,
method: 'put', method: 'post',
params: '' data: data
}) })
} }

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

@ -234,8 +234,17 @@
} }
} }
let param = {
throttle(trainSimulationForce(this.group,this.groupNum, this.move),200,true); groupNumber:this.groupNum,
percent:this.move
};
throttle(
trainSimulationForce(this.group,param).then(res => {
console.log(res);
}).catch((error) => {
console.log(error);
})
,200,true);
updatemmic1(this.move); updatemmic1(this.move);
}, },
speedend: function(event){ speedend: function(event){
@ -316,7 +325,12 @@
if(this.userRole == "DRIVER"){ if(this.userRole == "DRIVER"){
if(angle<63 && angle>46){ if(angle<63 && angle>46){
if(this.touchstate != "Drive"){ if(this.touchstate != "Drive"){
trainSimulationGear(this.group,this.groupNum,"Drive").then(netdata => { let data = {
groupNumber:this.groupNum,
gear:"Drive"
};
trainSimulationGear(this.group,data).then(netdata => {
console.log(netdata);
if(netdata.code == "200"){ if(netdata.code == "200"){
this.toutransform = "rotate(140deg)"; this.toutransform = "rotate(140deg)";
this.touchstate = "Drive"; this.touchstate = "Drive";
@ -328,7 +342,11 @@
}else if(angle<93 && angle>68){ }else if(angle<93 && angle>68){
if(this.touchstate != "Neutral"){ if(this.touchstate != "Neutral"){
trainSimulationGear(this.group,this.groupNum,"Neutral").then(netdata => { let data = {
groupNumber:this.groupNum,
gear:"Neutral"
};
trainSimulationGear(this.group,data).then(netdata => {
if(netdata.code == "200"){ if(netdata.code == "200"){
this.toutransform = "rotate(175deg)"; this.toutransform = "rotate(175deg)";
this.touchstate = "Neutral"; this.touchstate = "Neutral";
@ -340,7 +358,11 @@
}else if(angle<127 && angle>101){ }else if(angle<127 && angle>101){
if(this.touchstate != "Reverse"){ if(this.touchstate != "Reverse"){
trainSimulationGear(this.group,this.groupNum,"Reverse").then(netdata => { let data = {
groupNumber:this.groupNum,
gear:"Reverse"
};
trainSimulationGear(this.group,data).then(netdata => {
if(netdata.code == "200"){ if(netdata.code == "200"){
this.toutransform = "rotate(205deg)"; this.toutransform = "rotate(205deg)";
this.touchstate = "Reverse"; this.touchstate = "Reverse";

View File

@ -352,7 +352,11 @@
}, },
atpclick: function (e){ atpclick: function (e){
//console.log("atp"); //console.log("atp");
trainSimulationAtp(this.group,this.groupNum).then(netdata => { let data = {
groupNumber:this.groupNum,
cutOff:true,
};
trainSimulationAtp(this.group,data).then(netdata => {
// console.log(netdata); // console.log(netdata);
}); });
}, },
@ -361,17 +365,28 @@
}, },
changehead: function(e){ changehead: function(e){
trainSimulationChangeHead(this.group,this.groupNum).then(netdata => { let data = {
groupNumber:this.groupNum,
};
trainSimulationChangeHead(this.group,data).then(netdata => {
// console.log(netdata); // console.log(netdata);
}); });
}, },
bmcbtcclick: function (e){ bmcbtcclick: function (e){
trainSimulationDriveMode(this.group,this.groupNum,"CM").then(netdata => { let data = {
groupNumber:this.groupNum,
driveMode:"CM"
};
trainSimulationDriveMode(this.group,data).then(netdata => {
// console.log(netdata); // console.log(netdata);
}); });
}, },
rmclick: function (e){ rmclick: function (e){
trainSimulationDriveMode(this.group,this.groupNum,"RM").then(netdata => { let data = {
groupNumber:this.groupNum,
driveMode:"RM"
};
trainSimulationDriveMode(this.group,data).then(netdata => {
// console.log(netdata); // console.log(netdata);
}); });
}, },
@ -395,31 +410,53 @@
}, },
dloclick: function (e){ dloclick: function (e){
trainSimulationDoorControl(this.group,this.groupNum,false,true).then(netdata => { let data = {
groupNumber:this.groupNum,
right:false,
open:true,
};
trainSimulationDoorControl(this.group,data).then(netdata => {
// console.log(netdata); // console.log(netdata);
}); });
}, },
dlcclick: function (e){ dlcclick: function (e){
let data = {
trainSimulationDoorControl(this.group,this.groupNum,false,false).then(netdata => { groupNumber:this.groupNum,
right:false,
open:false,
};
trainSimulationDoorControl(this.group,data).then(netdata => {
// console.log(netdata); // console.log(netdata);
this.doorleftimg = this.greenimg; this.doorleftimg = this.greenimg;
}); });
}, },
droclick: function (e){ droclick: function (e){
trainSimulationDoorControl(this.group,this.groupNum,true,true).then(netdata => { let data = {
groupNumber:this.groupNum,
right:true,
open:true,
};
trainSimulationDoorControl(this.group,data).then(netdata => {
// console.log(netdata); // console.log(netdata);
}); });
}, },
drcclick: function (e){ drcclick: function (e){
trainSimulationDoorControl(this.group,this.groupNum,true,false).then(netdata => { let data = {
groupNumber:this.groupNum,
right:true,
open:false,
};
trainSimulationDoorControl(this.group,data).then(netdata => {
// console.log(netdata); // console.log(netdata);
this.doorrightimg = this.greenimg; this.doorrightimg = this.greenimg;
}); });
}, },
atoaclick: function (e){ atoaclick: function (e){
trainSimulationAto(this.group,this.groupNum).then(netdata => { let data = {
groupNumber:this.groupNum,
};
trainSimulationAto(this.group,data).then(netdata => {
// console.log(netdata); // console.log(netdata);
}); });
}, },
@ -427,7 +464,10 @@
}, },
ebstop: function (e){ ebstop: function (e){
trainSimulationEb(this.group,this.groupNum).then(netdata => { let data = {
groupNumber:this.groupNum,
};
trainSimulationEb(this.group,data).then(netdata => {
// console.log(netdata); // console.log(netdata);
}); });
}, },

View File

@ -211,7 +211,6 @@ export default {
}, },
updatetrainstatus(newdata){ updatetrainstatus(newdata){
// //
console.log(newdata);
this.updatemmispeedview(newdata.v,newdata.pv,newdata.tv); this.updatemmispeedview(newdata.v,newdata.pv,newdata.tv);
this.updatemmilen(newdata.maLen); this.updatemmilen(newdata.maLen);
@ -243,7 +242,6 @@ export default {
if(this.mmimodel.updateato){ if(this.mmimodel.updateato){
this.mmimodel.updateato(atospeed); this.mmimodel.updateato(atospeed);
} }
console.log(this.m9state1);
if(this.m9state1 == false){ if(this.m9state1 == false){
if(speed>atospeed){ if(speed>atospeed){
@ -261,8 +259,6 @@ export default {
}, },
updatedrivedata(drivedata){ updatedrivedata(drivedata){
// console.log(drivedata);
// // console.log(drivedata);
// if(drivedata == "breaker"){ // if(drivedata == "breaker"){
// //
// } // }