Commit 280269bb by zhangxw

自测 修改问题

1 parent 05b6902d
...@@ -6,6 +6,7 @@ Component({ ...@@ -6,6 +6,7 @@ Component({
multipleSlots: true multipleSlots: true
}, },
properties: { properties: {
markers: Array,
polyline: Array, polyline: Array,
isLoading: Boolean, isLoading: Boolean,
includePoints: Array // 当前页面是否有marker或路径的左边点 includePoints: Array // 当前页面是否有marker或路径的左边点
......
<view class="map-wrap"> <view class="map-wrap">
<!-- 地图组件 --> <!-- 地图组件 -->
<map id="Mymap" class="my-map" polyline="{{polyline}}" longitude="{{currentLo}}" latitude="{{currentLa}}" scale="{{scale}}" enable-satellite="{{enableSatellite}}" bindmarkertap="bindmarkertap" data-num="1" enable-traffic="{{enableTraffic}}" show-location bindtap="mapClick"> <map id="Mymap" class="my-map" polyline="{{polyline}}" markers="{{markers}}" longitude="{{currentLo}}" latitude="{{currentLa}}" scale="{{scale}}" enable-satellite="{{enableSatellite}}" bindmarkertap="bindmarkertap" data-num="1" enable-traffic="{{enableTraffic}}" show-location bindtap="mapClick">
</map> </map>
<!-- 地图控件 --> <!-- 地图控件 -->
<text class="icon icon-locate map-cmd-icon" catchtap="locateClick"> <text class="icon icon-locate map-cmd-icon" catchtap="locateClick">
......
...@@ -78,7 +78,7 @@ Page({ ...@@ -78,7 +78,7 @@ Page({
let points = this.data.points let points = this.data.points
WXRequest.get('trialdrive/api/vehicle/location', { WXRequest.get('trialdrive/api/vehicle/location', {
sns: this.data.sns sns: this.data.sns
}, true).then(e => { }, true, true).then(e => {
let includePoints = this.data.includePoints let includePoints = this.data.includePoints
if (e.code == 200 && e.data.length > 0) { if (e.code == 200 && e.data.length > 0) {
// 逆地址解析 // 逆地址解析
...@@ -168,6 +168,8 @@ Page({ ...@@ -168,6 +168,8 @@ Page({
}) })
} }
}) })
} else {
this.moveToLocation(Number(e.data[0].gpsLocation.elat), Number(e.data[0].gpsLocation.elng))
} }
} }
timeoutId = setTimeout(() => { timeoutId = setTimeout(() => {
......
...@@ -58,7 +58,7 @@ Page({ ...@@ -58,7 +58,7 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
this.myMap = this.selectComponent('#myMap')
}, },
// 刷新 // 刷新
refresh() { refresh() {
...@@ -70,10 +70,11 @@ Page({ ...@@ -70,10 +70,11 @@ Page({
polyline: [], polyline: [],
includePoints: [], includePoints: [],
speedItemsIndex: 0, speedItemsIndex: 0,
isReplayIng: false isReplayIng: false,
markers: []
}) })
this.myMap.getMapCtx().removeMarkers({ this.myMap.getMapCtx().removeMarkers({
markerIds: [1, 2] markerIds: [2]
}) })
}, },
// 获取定位 // 获取定位
...@@ -121,9 +122,19 @@ Page({ ...@@ -121,9 +122,19 @@ Page({
return false return false
} else { } else {
this.setData({ this.setData({
isShowModel: false isShowModel: false,
polyline: [],
includePoints: [],
speedItemsIndex: 0,
isReplayIng: false,
markers: []
})
this.myMap.getMapCtx().removeMarkers({
markerIds: [2],
complete: () => {
this.getData()
}
}) })
this.getData()
} }
}, },
// 选择固定时间段 // 选择固定时间段
...@@ -193,11 +204,8 @@ Page({ ...@@ -193,11 +204,8 @@ Page({
}, },
beginTrack() { beginTrack() {
if (this.data.polyline.length) { if (this.data.polyline.length) {
this.myMap.getMapCtx().removeMarkers({
markerIds: [1]
})
let marker = [{ let marker = [{
id: 1, id: 105,
width: 15, width: 15,
height: 25, height: 25,
latitude: this.data.polyline[0].points[0].latitude, latitude: this.data.polyline[0].points[0].latitude,
...@@ -205,19 +213,17 @@ Page({ ...@@ -205,19 +213,17 @@ Page({
iconPath: '../../images/car.png' iconPath: '../../images/car.png'
}] }]
this.setData({ this.setData({
isReplayIng: true isReplayIng: true,
markers: marker
}) })
this.myMap.getMapCtx().addMarkers({ this.myMap.getMapCtx().moveAlong({
markers: marker, markerId: 105,
success: () => { path: this.data.polyline[0].points,
this.myMap.getMapCtx().moveAlong({ duration: this.data.duration,
markerId: 1, fail: () => {
path: this.data.polyline[0].points, this.beginTrack()
duration: this.data.duration
})
} }
}) })
} }
}, },
// 暂停 // 暂停
......
...@@ -89,9 +89,11 @@ module.exports = { ...@@ -89,9 +89,11 @@ module.exports = {
}); });
}) })
}, },
get(url, data, isNewFindCar){ get(url, data, isNewFindCar, notShowLoading){
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){
wx.showLoading(); if (!notShowLoading) { // 实时监控不显示加载中
wx.showLoading();
}
//wx.setStorageSync('sessionid', 'JSESSIONID=node03r5y0xa3w4fh1jdk4e2q4oz860.node0;Path=/otmini') //wx.setStorageSync('sessionid', 'JSESSIONID=node03r5y0xa3w4fh1jdk4e2q4oz860.node0;Path=/otmini')
const params = { const params = {
header: { header: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!