Commit 073faa0e by zhangxw

优化

1 parent ab8d93b7
...@@ -174,9 +174,15 @@ Page({ ...@@ -174,9 +174,15 @@ Page({
wx.setStorageSync("sessionid", res.header["Set-Cookie"]); wx.setStorageSync("sessionid", res.header["Set-Cookie"]);
wx.setStorageSync("userStatus", 1); wx.setStorageSync("userStatus", 1);
wx.setStorageSync("userinfo", data.data); wx.setStorageSync("userinfo", data.data);
wx.switchTab({ if (!this.data.isSharePage) {
url: '../../pages/findCar/findCar' wx.switchTab({
}); url: '../../pages/findCar/findCar'
});
} else { // 新e盾分享页
wx.reLaunch({
url: `../../pages/newFindCar/findCar?sns=${this.data.sns}&isSharePage=true`
});
}
}else{ }else{
wx.showModal({ wx.showModal({
content: data.message, content: data.message,
......
...@@ -74,7 +74,7 @@ Page({ ...@@ -74,7 +74,7 @@ Page({
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { // onShareAppMessage: function () {
} // }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -247,10 +247,18 @@ Page({ ...@@ -247,10 +247,18 @@ Page({
typeChange(e) { typeChange(e) {
let data = JSON.parse(JSON.stringify(this.data.carInfoWindowObj)) let data = JSON.parse(JSON.stringify(this.data.carInfoWindowObj))
let carInfoArr = JSON.parse(JSON.stringify(this.data.carInfoArr)) let carInfoArr = JSON.parse(JSON.stringify(this.data.carInfoArr))
let includePoints = JSON.parse(JSON.stringify(this.data.includePoints))
switch(Number(e.currentTarget.dataset.num)) { switch(Number(e.currentTarget.dataset.num)) {
case 1: // GPS case 1: // GPS
if (data['type'] === 'gpsLocation') return if (data['type'] === 'gpsLocation') return
data['type'] = "gpsLocation" data['type'] = "gpsLocation"
includePoints.push({
latitude: Number(this.data.carInfoWindowObj['gpsLocation'].elat),
longitude: Number(this.data.carInfoWindowObj['gpsLocation'].elng)
})
this.setData({
includePoints: includePoints
})
this.myMap.getMapCtx().translateMarker({ this.myMap.getMapCtx().translateMarker({
markerId: Number(this.data.carInfoWindowObj.sn), markerId: Number(this.data.carInfoWindowObj.sn),
destination: { destination: {
...@@ -285,6 +293,13 @@ Page({ ...@@ -285,6 +293,13 @@ Page({
case 2: // bsLocation case 2: // bsLocation
if (data['type'] === 'bsLocation') return if (data['type'] === 'bsLocation') return
data['type'] = "bsLocation" data['type'] = "bsLocation"
includePoints.push({
latitude: Number(this.data.carInfoWindowObj['bsLocation'].elat),
longitude: Number(this.data.carInfoWindowObj['bsLocation'].elng)
})
this.setData({
includePoints: includePoints
})
this.myMap.getMapCtx().translateMarker({ this.myMap.getMapCtx().translateMarker({
markerId: Number(this.data.carInfoWindowObj.sn), markerId: Number(this.data.carInfoWindowObj.sn),
destination: { destination: {
...@@ -519,6 +534,7 @@ Page({ ...@@ -519,6 +534,7 @@ Page({
if(that.data.sns){ if(that.data.sns){
opts.path = `${opts.path}?sns=${encodeURIComponent(this.data.sns)}&isSharePage=true`; opts.path = `${opts.path}?sns=${encodeURIComponent(this.data.sns)}&isSharePage=true`;
} }
console.log(opts)
return opts; return opts;
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -220,7 +220,7 @@ Page({ ...@@ -220,7 +220,7 @@ Page({
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { // onShareAppMessage: function () {
} // }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -69,7 +69,9 @@ Page({ ...@@ -69,7 +69,9 @@ Page({
selectTime: '', selectTime: '',
isReplayIng: false, isReplayIng: false,
polyline: [], polyline: [],
includePoints: [] includePoints: [],
speedItemsIndex: 0,
isReplayIng: false
}) })
this.myMap.getMapCtx().removeMarkers({ this.myMap.getMapCtx().removeMarkers({
markerIds: [1, 2] markerIds: [1, 2]
...@@ -188,6 +190,9 @@ Page({ ...@@ -188,6 +190,9 @@ Page({
}, },
// 播放 // 播放
play() { play() {
this.beginTrack()
},
beginTrack() {
if (this.data.polyline.length) { if (this.data.polyline.length) {
this.myMap.getMapCtx().removeMarkers({ this.myMap.getMapCtx().removeMarkers({
markerIds: [1] markerIds: [1]
...@@ -203,29 +208,26 @@ Page({ ...@@ -203,29 +208,26 @@ Page({
this.myMap.getMapCtx().addMarkers({ this.myMap.getMapCtx().addMarkers({
markers: marker, markers: marker,
success: () => { success: () => {
this.beginTrack() this.setData({
isReplayIng: true
})
this.myMap.getMapCtx().moveAlong({
markerId: 1,
path: this.data.polyline[0].points,
duration: this.data.duration,
success: (res) => {
this.setData({
isReplayIng: false
})
},
fail: () => {
this.beginTrack()
}
})
} }
}) })
} }
}, },
beginTrack() {
this.setData({
isReplayIng: true
})
this.myMap.getMapCtx().moveAlong({
markerId: 1,
path: this.data.polyline[0].points,
duration: this.data.duration,
success: (res) => {
this.setData({
isReplayIng: false
})
},
fail: () => {
this.beginTrack()
}
})
},
// 暂停 // 暂停
pause() { pause() {
}, },
...@@ -300,7 +302,7 @@ Page({ ...@@ -300,7 +302,7 @@ Page({
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { // onShareAppMessage: function () {
} // }
}) })
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!