修改三维驾驶通信接口改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紧急制动
export function trainSimulationEb(group,groupNumber) {
export function trainSimulationEb(group,data) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/eb`,
method: 'put',
params: ''
url: `/simulation/${group}/operate/Driver_EB`,
method: 'post',
data: data
})
}
//改变列车牵引/制动力
export function trainSimulationForce(group,groupNumber,percent) {
export function trainSimulationForce(group,data) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/force/${percent}`,
method: 'put',
params: ''
url: `/simulation/${group}/operate/Driver_Force_Change`,
method: 'post',
data: data
})
}
//改变列车档位
export function trainSimulationGear(group,groupNumber,gear) {
export function trainSimulationGear(group,data) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/gear/${gear}`,
method: 'put',
params: ''
url: `/simulation/${group}/operate/Driver_Gear_Change`,
method: 'post',
data: data
})
}
//改变列车运行级别
export function trainSimulationDriveMode(group,groupNumber,driveMode) {
export function trainSimulationDriveMode(group,data) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/driveMode/${driveMode}`,
method: 'put',
params: ''
url: `/simulation/${group}/operate/Driver_Drive_Mode_Change`,
method: 'post',
data: data
})
}
//ATP切除
//ATO
export function trainSimulationAtp(group,groupNumber) {
export function trainSimulationAtp(group,data) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/atp`,
method: 'put',
params: ''
url: `/simulation/${group}/operate/Driver_ATP_Change`,
method: 'post',
data: data
})
}
//ATO
export function trainSimulationAto(group,groupNumber) {
export function trainSimulationAto(group,data) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/openAto`,
method: 'put',
params: ''
url: `/simulation/${group}/operate/Driver_ATO_Open`,
method: 'post',
data: data
})
}
//换端
export function trainSimulationChangeHead(group,groupNumber) {
export function trainSimulationChangeHead(group,data) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/changeHead`,
method: 'put',
params: ''
url: `/simulation/${group}/operate/Driver_Change_Head`,
method: 'post',
data: data
})
}
//
export function trainSimulationDoorControl(group,groupNumber,direct,open) {
export function trainSimulationDoorControl(group,data) {
return request({
url: `/simulation/driving/${group}/train/${groupNumber}/onOrOffDoor?right=${direct}&open=${open}`,
method: 'put',
params: ''
url: `/simulation/${group}/operate/Driver_Door_On_Off`,
method: 'post',
data: data
})
}

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

@ -234,8 +234,17 @@
}
}
throttle(trainSimulationForce(this.group,this.groupNum, this.move),200,true);
let param = {
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);
},
speedend: function(event){
@ -316,7 +325,12 @@
if(this.userRole == "DRIVER"){
if(angle<63 && angle>46){
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"){
this.toutransform = "rotate(140deg)";
this.touchstate = "Drive";
@ -328,7 +342,11 @@
}else if(angle<93 && angle>68){
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"){
this.toutransform = "rotate(175deg)";
this.touchstate = "Neutral";
@ -340,7 +358,11 @@
}else if(angle<127 && angle>101){
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"){
this.toutransform = "rotate(205deg)";
this.touchstate = "Reverse";

View File

@ -352,7 +352,11 @@
},
atpclick: function (e){
//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);
});
},
@ -361,17 +365,28 @@
},
changehead: function(e){
trainSimulationChangeHead(this.group,this.groupNum).then(netdata => {
let data = {
groupNumber:this.groupNum,
};
trainSimulationChangeHead(this.group,data).then(netdata => {
// console.log(netdata);
});
},
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);
});
},
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);
});
},
@ -395,31 +410,53 @@
},
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);
});
},
dlcclick: function (e){
trainSimulationDoorControl(this.group,this.groupNum,false,false).then(netdata => {
let data = {
groupNumber:this.groupNum,
right:false,
open:false,
};
trainSimulationDoorControl(this.group,data).then(netdata => {
// console.log(netdata);
this.doorleftimg = this.greenimg;
});
},
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);
});
},
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);
this.doorrightimg = this.greenimg;
});
},
atoaclick: function (e){
trainSimulationAto(this.group,this.groupNum).then(netdata => {
let data = {
groupNumber:this.groupNum,
};
trainSimulationAto(this.group,data).then(netdata => {
// console.log(netdata);
});
},
@ -427,7 +464,10 @@
},
ebstop: function (e){
trainSimulationEb(this.group,this.groupNum).then(netdata => {
let data = {
groupNumber:this.groupNum,
};
trainSimulationEb(this.group,data).then(netdata => {
// console.log(netdata);
});
},

View File

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