Commit b9f50c08 by zhangxw

修改

1 parent 29a41770
......@@ -9,7 +9,8 @@ Component({
markers: Array,
polyline: Array,
isLoading: Boolean,
includePoints: Array // 当前页面是否有marker或路径的左边点
includePoints: Array, // 当前页面是否有marker或路径的左边点
mapId: String
},
/**
......@@ -42,7 +43,7 @@ Component({
return this.mapCtx
}
// 创建 map 上下文 MapContext 对象
this.mapCtx = wx.createMapContext('Mymap', this)
this.mapCtx = wx.createMapContext(this.data.mapId, this)
return this.mapCtx
},
bindmarkertap(e) {
......
<view class="map-wrap">
<!-- 地图组件 -->
<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 id="{{mapId}}" 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>
<!-- 地图控件 -->
<text class="icon icon-locate map-cmd-icon" catchtap="locateClick">
......
......@@ -35,9 +35,9 @@ Page({
wx.hideShareMenu()
}
},
onShow(options){
onShow(){
if (this.data.isUpdate) {
this.myMap = this.selectComponent('#myMap')
this.myMap = this.selectComponent('#findcarMap')
this.getData()
}
},
......@@ -94,20 +94,20 @@ Page({
id: Number(item.sn), // 设备号唯一 可作为markerid
width: 28,
height: 36,
// latitude: (this.data.carInfoWindowObj['type'] && Number(this.data.carInfoWindowObj[this.data.carInfoWindowObj['type']].elat)) || Number(item['gpsLocation'].elat), // 默认显示GPS定位位置
// longitude: (this.data.carInfoWindowObj['type'] && Number(this.data.carInfoWindowObj[this.data.carInfoWindowObj['type']].elng)) || Number(item['gpsLocation'].elng),
latitude: Number(item['gpsLocation'].elat), // 默认显示GPS定位位置
longitude: Number(item['gpsLocation'].elng),
latitude: (this.data.carInfoWindowObj['type'] && Number(this.data.carInfoWindowObj[this.data.carInfoWindowObj['type']].elat)) || Number(item['gpsLocation'].elat), // 默认显示GPS定位位置
longitude: (this.data.carInfoWindowObj['type'] && Number(this.data.carInfoWindowObj[this.data.carInfoWindowObj['type']].elng)) || Number(item['gpsLocation'].elng),
// latitude: Number(item['gpsLocation'].elat), // 默认显示GPS定位位置
// longitude: Number(item['gpsLocation'].elng),
iconPath: item.source === 1 ? '../../images/oncar.png' : '../../images/offcar.png'
})
includePoints.push({
// latitude: (this.data.carInfoWindowObj['type'] && this.data.carInfoWindowObj[this.data.carInfoWindowObj['type']].elat) || item['gpsLocation'].elat,
// longitude: (this.data.carInfoWindowObj['type'] && this.data.carInfoWindowObj[this.data.carInfoWindowObj['type']].elng) || item['gpsLocation'].elng,
latitude: item['gpsLocation'].elat,
longitude: item['gpsLocation'].elng
latitude: (this.data.carInfoWindowObj['type'] && this.data.carInfoWindowObj[this.data.carInfoWindowObj['type']].elat) || item['gpsLocation'].elat,
longitude: (this.data.carInfoWindowObj['type'] && this.data.carInfoWindowObj[this.data.carInfoWindowObj['type']].elng) || item['gpsLocation'].elng,
// latitude: item['gpsLocation'].elat,
// longitude: item['gpsLocation'].elng
})
// item.type = this.data.carInfoWindowObj['type'] || 'gpsLocation'
item.type = 'gpsLocation' // 默认显示GPS的定位类型
item.type = this.data.carInfoWindowObj['type'] || 'gpsLocation'
// item.type = 'gpsLocation' // 默认显示GPS的定位类型
})
this.myMap.getMapCtx().includePoints({
points: includePoints,
......@@ -289,9 +289,6 @@ Page({
var lng,lat;
lng = this.data.carInfoWindowObj['gpsLocation'].elng
lat = this.data.carInfoWindowObj['gpsLocation'].elat
this.setData({
isUpdate: false
})
wx.navigateTo({ // 车辆追踪gps定位坐标
url: `../../pages/newCarTrace/carTrace?lat=${lat}&lng=${lng}`
})
......@@ -313,9 +310,6 @@ Page({
},
// 轨迹回放
traReplay(e) {
this.setData({
isUpdate: false
})
wx.navigateTo({
url: `../../pages/newTraReplay/traReplay?sn=${encodeURIComponent(this.data.carInfoWindowObj.encryptSn)}&locationType=${this.data.carInfoWindowObj.type}`
});
......@@ -337,9 +331,6 @@ Page({
},
// 实时监控
monitor() {
this.setData({
isUpdate: false
})
wx.navigateTo({
url: `../../pages/newMonitor/monitor?sn=${encodeURIComponent(this.data.carInfoWindowObj.encryptSn)}`
});
......
<view class="content_page">
<myMap class="my-map" id="myMap" bind:getCarInfoWindowObj="getCarInfoWindowObj" bind:refresh="refresh" markers="{{markers}}" includePoints="{{includePoints}}" bind:locationCallback="locationCallback"></myMap>
<view class="findCar_content">
<myMap class="my-map" id="findcarMap" mapId="findcarMap" bind:getCarInfoWindowObj="getCarInfoWindowObj" bind:refresh="refresh" markers="{{markers}}" includePoints="{{includePoints}}" bind:locationCallback="locationCallback"></myMap>
<!-- 找车按钮 -->
<view wx:if="{{!isSharePage}}" class="icon icon-findcar map-cmd-icon" bindtap="findCarClick"></view>
<!-- 信息窗体内容 -->
......
......@@ -39,7 +39,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.myMap = this.selectComponent('#myMap')
this.myMap = this.selectComponent('#monitorMap')
this.getPosition()
},
// 刷新
......
<view>
<myMap class="my-map" id="myMap" polyline="{{polyline}}" includePoints="{{includePoints}}" markers="{{markers}}" bind:refresh="refresh" bind:mapCallback="mapCallback" bind:locationCallback="locationCallback"></myMap>
<view class="monitor_content">
<myMap class="my-map" id="monitorMap" mapId="monitorMap" polyline="{{polyline}}" includePoints="{{includePoints}}" markers="{{markers}}" bind:refresh="refresh" bind:mapCallback="mapCallback" bind:locationCallback="locationCallback"></myMap>
<view class="toggle-bottom {{isShowList ? '' : 'hidden'}}" id="toggleBottom">
<icon class="toggle-btn active icon {{isShowList ? 'icon-toggle-down' : 'icon-toggle-up'}}" bindtap="listIconBatch"></icon>
<scroll-view class="toggle-list" scroll-y="true" scroll-into-view="{{scrollIntoViewIndex}}">
......
......@@ -58,7 +58,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.myMap = this.selectComponent('#myMap')
this.myMap = this.selectComponent('#traReplayMap')
},
// 刷新
refresh() {
......@@ -318,7 +318,6 @@ Page({
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
......
<view class="content_page">
<view class="traReplay_content">
<view class="tabbar">
<view class="tabbar-item" bindtap="showModel">轨迹时间</view>
<picker
......@@ -11,7 +11,7 @@
<view class="select-dropdown-icon"></view>
</picker>
</view>
<myMap class="my-map" id="myMap" polyline="{{polyline}}" includePoints="{{includePoints}}" markers="{{markers}}" bind:refresh="refresh" bind:mapCallback="mapCallback" bind:locationCallback="locationCallback"></myMap>
<myMap class="my-map" id="traReplayMap" mapId="traReplayMap" polyline="{{polyline}}" includePoints="{{includePoints}}" markers="{{markers}}" bind:refresh="refresh" bind:mapCallback="mapCallback" bind:locationCallback="locationCallback"></myMap>
<!-- 回放控制按钮 -->
<view class="btn-control" slot="bottomBox">
<view class="icon icon-replay-play play-btn {{isReplayIng? '' : 'active'}}" bindtap="play"></view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!