|
@@ -1,4 +1,5 @@
|
|
|
import * as API from '@/apis/route.js'
|
|
|
+ import * as API_index from '@/apis/index.js'
|
|
|
import * as WxJsApi from '@/utils/wxJsApi.js'
|
|
|
|
|
|
import Carmap from '@/components/Carmap.vue'
|
|
@@ -14,6 +15,7 @@ export default {
|
|
|
id: 0, // 使用 marker点击事件 需要填写id
|
|
|
upid:'',
|
|
|
downid:'',
|
|
|
+ downItem:{},
|
|
|
//地图居中后的位置
|
|
|
longitude: 112.276527,
|
|
|
latitude: 30.306427,
|
|
@@ -83,18 +85,43 @@ export default {
|
|
|
this.$refs.amap.setSite(item);
|
|
|
this.$refs.amap.setCenter(item);
|
|
|
this.downid=item.id;
|
|
|
+ this.downItem=item;
|
|
|
+ },
|
|
|
+ remindAdd(){
|
|
|
+ if(this.downItem.id){
|
|
|
+ var item= this.remindInfo
|
|
|
+ var obj={
|
|
|
+ startStationId:this.stationList[0].id,
|
|
|
+ remindStationId :this.downItem.id,
|
|
|
+ stopInAdvance:"1",
|
|
|
+ remindType:"1",
|
|
|
+ vehicleShiftId:this.routeInfo.id,
|
|
|
+ openId:this.carhelp.getOpenId()
|
|
|
+ }
|
|
|
+ API_index.saveRemind(obj).then((res) => {
|
|
|
+ this.downItem.remindId=res.data.id
|
|
|
+ this.$refs.common.alert( "设置成功");
|
|
|
+
|
|
|
+ }).catch(error => {
|
|
|
+ this.$refs.common.alert( error);
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
drawing(point, startend) {
|
|
|
if (this.$refs.amap) {
|
|
|
this.$refs.amap.initMap(point, this.stationList,startend);
|
|
|
}
|
|
|
},
|
|
|
- reverse(){
|
|
|
+ reverse(){
|
|
|
+ if(process.car.SIMPLE_RUN){
|
|
|
+ this.remindAdd();
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
this.stationList.reverse();
|
|
|
this.getCar()
|
|
|
- this.$refs.amap.setStartend(this.stationList);
|
|
|
+ this.$refs.amap.setStartend(this.stationList);
|
|
|
+
|
|
|
},
|
|
|
|
|
|
getPassengerInfo() {
|
|
@@ -102,7 +129,7 @@ export default {
|
|
|
this.$refs.common.showLoading()
|
|
|
|
|
|
API.routeDetail(this.id).then((response) => {
|
|
|
-
|
|
|
+
|
|
|
var list=response.data.stationInfoList;
|
|
|
if(this.upid&&list.length){
|
|
|
|
|
@@ -111,7 +138,13 @@ export default {
|
|
|
}
|
|
|
this.upid="";
|
|
|
}
|
|
|
- this.stationList=list;
|
|
|
+ this.stationList=list;
|
|
|
+ for(var i in list){
|
|
|
+ if(list[i].id==this.downid){
|
|
|
+ this.downItem=list[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
this.$refs.common.showLoading(false)
|
|
|
|
|
|
var point = [];
|
|
@@ -143,17 +176,36 @@ export default {
|
|
|
this.$refs.common.showLoading(false)
|
|
|
|
|
|
this.getPoint()
|
|
|
+
|
|
|
+ this.$nextTick(function() {
|
|
|
+ const query = uni.createSelectorQuery().in(this);
|
|
|
+ query.select('.map-down').boundingClientRect(data => {
|
|
|
+ if(data){
|
|
|
+ document.getElementById('map-route-main').scrollLeft = data.left-20;
|
|
|
+ }
|
|
|
+ this.$refs.common.showLoading(false);
|
|
|
+ //this.downBtn()
|
|
|
+ }).exec();
|
|
|
+ });
|
|
|
+
|
|
|
}).catch(error => {
|
|
|
this.$refs.common.showLoading(false,error)
|
|
|
})
|
|
|
},
|
|
|
+ mapdown(){
|
|
|
+
|
|
|
+ if(this.downid){
|
|
|
+ this.downBtn(this.downItem)
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
getPoint() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!this.info.init) {
|
|
|
- WxJsApi.getWxConfig(['addEventListener','getLocation','getSetting']).then(() => {
|
|
|
+ WxJsApi.getWxConfig([ 'getLocation','getSetting']).then(() => {
|
|
|
// this.$refs.common.showLoading(false)
|
|
|
this.getLocation()
|
|
|
});
|
|
@@ -192,6 +244,7 @@ export default {
|
|
|
onLoad(op) {
|
|
|
this.upid=op.upid;
|
|
|
this.id = op.id
|
|
|
+ this.downid=op.downid;
|
|
|
},
|
|
|
onUnload() {
|
|
|
if (this.myinterval) {
|
|
@@ -199,20 +252,10 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
onReady() {
|
|
|
- WxJsApi.getWxConfig(['addEventListener','getLocation','getSetting']).then(() => {
|
|
|
+ WxJsApi.getWxConfig([ 'getLocation','getSetting']).then(() => {
|
|
|
// this.$refs.common.showLoading(false)
|
|
|
this.wxinit=true;
|
|
|
- this.$nextTick(function() {
|
|
|
- var btn = document.getElementById('subscribe-btn');
|
|
|
- btn.addEventListener('success', function (e) {
|
|
|
- console.log('success', e.detail);
|
|
|
- alert("success")
|
|
|
- });
|
|
|
- btn.addEventListener('error',function (e) {
|
|
|
- console.log('fail', e.detail);
|
|
|
- alert("fail")
|
|
|
- });
|
|
|
- })
|
|
|
+
|
|
|
|
|
|
});
|
|
|
|