|
@@ -20,7 +20,8 @@ export default {
|
|
longitude: 112.276527,
|
|
longitude: 112.276527,
|
|
latitude: 30.306427,
|
|
latitude: 30.306427,
|
|
show1: false,
|
|
show1: false,
|
|
- show2: false,
|
|
|
|
|
|
+ show2: false,
|
|
|
|
+ centerBl:false,
|
|
shiftInfo: {
|
|
shiftInfo: {
|
|
|
|
|
|
},
|
|
},
|
|
@@ -31,7 +32,8 @@ export default {
|
|
driverInfo:{}
|
|
driverInfo:{}
|
|
},
|
|
},
|
|
caritemBl:false,
|
|
caritemBl:false,
|
|
- stationList: [],
|
|
|
|
|
|
+ stationList: [],
|
|
|
|
+ routeTimeTableList:[],
|
|
dis:'',
|
|
dis:'',
|
|
//个人
|
|
//个人
|
|
info: {
|
|
info: {
|
|
@@ -81,26 +83,43 @@ export default {
|
|
console.log(e)
|
|
console.log(e)
|
|
},
|
|
},
|
|
vehicleStationDis(){
|
|
vehicleStationDis(){
|
|
- var obj={
|
|
|
|
- startStationId:this.stationList[0].id,
|
|
|
|
- currentStationId :this.downItem.id,
|
|
|
|
- routeId:this.routeInfo.id,
|
|
|
|
- }
|
|
|
|
- if(this.stationList[0].id==this.downItem.id&&this.routeInfo.interval){
|
|
|
|
|
|
+
|
|
|
|
+ if(this.stationList[0].id==this.downItem.id&&this.routeTimeTableList&&this.routeTimeTableList.length){
|
|
|
|
|
|
|
|
|
|
var nowDate =new Date();
|
|
var nowDate =new Date();
|
|
var curDay=nowDate.getFullYear()+"-"+(nowDate.getMonth()+1)+"-"+nowDate.getDate();
|
|
var curDay=nowDate.getFullYear()+"-"+(nowDate.getMonth()+1)+"-"+nowDate.getDate();
|
|
- var startDate =new Date(curDay+" "+this.routeInfo.startTime+":00");
|
|
|
|
- var endDate =new Date(curDay+" "+this.routeInfo.endTime+":00");
|
|
|
|
- if(nowDate.getTime()>endDate.getTime()){
|
|
|
|
|
|
+ var startDate =null;
|
|
|
|
+
|
|
|
|
+ for(var i in this.routeTimeTableList){
|
|
|
|
+ var obj=this.routeTimeTableList[i]
|
|
|
|
+ var objDate =new Date(curDay+" "+obj.startTime+":00");
|
|
|
|
+
|
|
|
|
+ if(nowDate.getTime()<objDate.getTime()){
|
|
|
|
+ if(startDate==null){
|
|
|
|
+ startDate=objDate;
|
|
|
|
+ }
|
|
|
|
+ if(objDate<startDate){
|
|
|
|
+ startDate=objDate;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(startDate==null){
|
|
this.dis="今日发车已经结束,明日发车时间"+this.routeInfo.startTime
|
|
this.dis="今日发车已经结束,明日发车时间"+this.routeInfo.startTime
|
|
}else{
|
|
}else{
|
|
- var d=this.routeInfo.interval - parseInt((nowDate.getTime()-startDate.getTime())/1000/60)%this.routeInfo.interval
|
|
|
|
|
|
+ console.log(startDate)
|
|
|
|
+ console.log(nowDate)
|
|
|
|
+ var d= parseInt((startDate.getTime()-nowDate.getTime())/1000/60)
|
|
this.dis="等待发车... 大约"+d+"分钟发车"
|
|
this.dis="等待发车... 大约"+d+"分钟发车"
|
|
}
|
|
}
|
|
|
|
|
|
}else{
|
|
}else{
|
|
|
|
+ var obj={
|
|
|
|
+ startStationId:this.stationList[0].id,
|
|
|
|
+ currentStationId :this.downItem.id,
|
|
|
|
+ routeId:this.routeInfo.id,
|
|
|
|
+ }
|
|
//this.$refs.common.showLoading();
|
|
//this.$refs.common.showLoading();
|
|
API.vehicleStationDis(obj).then((res) => {
|
|
API.vehicleStationDis(obj).then((res) => {
|
|
this.dis=res.data;
|
|
this.dis=res.data;
|
|
@@ -176,6 +195,24 @@ export default {
|
|
}
|
|
}
|
|
API.routeShiftList(obj).then((response) => {
|
|
API.routeShiftList(obj).then((response) => {
|
|
this.carList=response.data;
|
|
this.carList=response.data;
|
|
|
|
+ if(!this.centerBl&&this.carList.length){
|
|
|
|
+ this.centerBl=this.$refs.amap.setCenter(this.carList[0]);
|
|
|
|
+ //this.centerBl=true;
|
|
|
|
+ if(this.centerBl){
|
|
|
|
+ document.getElementById('map-route-main').scrollLeft = 0
|
|
|
|
+ this.$nextTick(function() {
|
|
|
|
+ const query = uni.createSelectorQuery().in(this);
|
|
|
|
+ query.select('.map-route-car').boundingClientRect(data => {
|
|
|
|
+ if(data){
|
|
|
|
+ document.getElementById('map-route-main').scrollLeft = data.left-20;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //this.downBtn()
|
|
|
|
+ }).exec();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
this.$refs.amap.setCarList(response.data);
|
|
this.$refs.amap.setCarList(response.data);
|
|
this.vehicleStationDis();
|
|
this.vehicleStationDis();
|
|
}).catch(error => {
|
|
}).catch(error => {
|
|
@@ -318,6 +355,7 @@ export default {
|
|
|
|
|
|
var point = [];
|
|
var point = [];
|
|
this.routeInfo=response.data.routeInfo;
|
|
this.routeInfo=response.data.routeInfo;
|
|
|
|
+ this.routeTimeTableList=response.data.routeTimeTableList;
|
|
this.title=this.routeInfo.name;
|
|
this.title=this.routeInfo.name;
|
|
if(!response.data.routeInfo.mapPath){
|
|
if(!response.data.routeInfo.mapPath){
|
|
this.$refs.common.showLoading(false,"路线加载失败!")
|
|
this.$refs.common.showLoading(false,"路线加载失败!")
|
|
@@ -365,6 +403,8 @@ export default {
|
|
|
|
|
|
if(this.downid=="null"){
|
|
if(this.downid=="null"){
|
|
this.downid="";
|
|
this.downid="";
|
|
|
|
+ }else{
|
|
|
|
+ this.centerBl=true;
|
|
}
|
|
}
|
|
if(this.downid){
|
|
if(this.downid){
|
|
this.downBtn(this.downItem)
|
|
this.downBtn(this.downItem)
|
|
@@ -372,10 +412,7 @@ export default {
|
|
|
|
|
|
},
|
|
},
|
|
getPoint() {
|
|
getPoint() {
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
if (!this.info.init) {
|
|
if (!this.info.init) {
|
|
WxJsApi.getWxConfig([ 'getLocation','getSetting']).then(() => {
|
|
WxJsApi.getWxConfig([ 'getLocation','getSetting']).then(() => {
|
|
// this.$refs.common.showLoading(false)
|
|
// this.$refs.common.showLoading(false)
|
|
@@ -405,7 +442,7 @@ export default {
|
|
this.info.latitude = latitude;
|
|
this.info.latitude = latitude;
|
|
this.info.longitude = longitude;
|
|
this.info.longitude = longitude;
|
|
|
|
|
|
- this.$refs.amap.setPerson(this.info);
|
|
|
|
|
|
+ this.$refs.amap.setPerson(this.info,true);
|
|
|
|
|
|
}).catch(error => {
|
|
}).catch(error => {
|
|
console.log(error)
|
|
console.log(error)
|