Commit b9f50c08 by zhangxw

修改

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