Commit 1a4257f9 by zhangxw

兼容性问题

1 parent 2646a9de
...@@ -7,7 +7,6 @@ Component({ ...@@ -7,7 +7,6 @@ Component({
}, },
properties: { properties: {
markers: Array, markers: Array,
polyline: Array,
isLoading: Boolean, isLoading: Boolean,
includePoints: Array, // 当前页面是否有marker或路径的左边点 includePoints: Array, // 当前页面是否有marker或路径的左边点
mapId: String mapId: String
...@@ -28,7 +27,8 @@ Component({ ...@@ -28,7 +27,8 @@ Component({
isGPS: true, isGPS: true,
scale: 16, scale: 16,
isCanClick: true, isCanClick: true,
inPoints: [] inPoints: [],
polyline: []
}, },
ready() { ready() {
}, },
...@@ -48,7 +48,7 @@ Component({ ...@@ -48,7 +48,7 @@ Component({
return this.mapCtx return this.mapCtx
}, },
bindmarkertap(e) { bindmarkertap(e) {
this.triggerEvent('getCarInfoWindowObj', e) this.triggerEvent('bindmarkertap', e)
}, },
// 刷新 // 刷新
refreshClick() { refreshClick() {
......
...@@ -90,6 +90,7 @@ Page({ ...@@ -90,6 +90,7 @@ Page({
id: Number(res.data[i].sn), // 设备号唯一 可作为markerid id: Number(res.data[i].sn), // 设备号唯一 可作为markerid
width: 28, width: 28,
height: 36, height: 36,
zIndex: 1001,
latitude: Number(res.data[i]['gpsLocation'].elat), // 默认显示GPS定位位置 latitude: Number(res.data[i]['gpsLocation'].elat), // 默认显示GPS定位位置
longitude: Number(res.data[i]['gpsLocation'].elng), longitude: Number(res.data[i]['gpsLocation'].elng),
iconPath: res.data[i].source === 1 ? '../../images/oncar.png' : '../../images/offcar.png' iconPath: res.data[i].source === 1 ? '../../images/oncar.png' : '../../images/offcar.png'
...@@ -150,7 +151,7 @@ Page({ ...@@ -150,7 +151,7 @@ Page({
} }
}, },
// 显示对应marker详情 // 显示对应marker详情
getCarInfoWindowObj(e) { bindmarkertap(e) {
let data = this.data.carInfoArr.find(item => Number(item.sn) === e.detail.markerId) let data = this.data.carInfoArr.find(item => Number(item.sn) === e.detail.markerId)
let _this = this let _this = this
_this.moveToLocation(Number(data[data['type']].elat), Number(data[data['type']].elng)) _this.moveToLocation(Number(data[data['type']].elat), Number(data[data['type']].elng))
......
<view class="findCar_content"> <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> <myMap class="my-map" id="findcarMap" mapId="findcarMap" bind:bindmarkertap="bindmarkertap" 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>
<!-- 信息窗体内容 --> <!-- 信息窗体内容 -->
......
...@@ -26,7 +26,6 @@ Page({ ...@@ -26,7 +26,6 @@ Page({
], ],
speedItemsIndex: 0, speedItemsIndex: 0,
isReplayIng: false, isReplayIng: false,
polyline: [],
markers: [], markers: [],
isShowModel: false, isShowModel: false,
clickItem: null, clickItem: null,
...@@ -63,16 +62,16 @@ Page({ ...@@ -63,16 +62,16 @@ Page({
}, },
// 刷新 // 刷新
refresh() { refresh() {
if (this.data.polyline.length <= 0) return if (this.myMap.data.polyline.length <= 0) return
this.setData({ this.setData({
clickItem: null, clickItem: null,
selectTime: '', selectTime: '',
polyline: [],
includePoints: [], includePoints: [],
speedItemsIndex: 0, speedItemsIndex: 0,
isReplayIng: false, isReplayIng: false,
markers: [] markers: []
}) })
this.myMap.setData({polyline: []})
this.myMap.getMapCtx().removeMarkers({ this.myMap.getMapCtx().removeMarkers({
markerIds: [2] markerIds: [2]
}) })
...@@ -123,7 +122,6 @@ Page({ ...@@ -123,7 +122,6 @@ Page({
} else { } else {
this.setData({ this.setData({
isShowModel: false, isShowModel: false,
polyline: [],
includePoints: [], includePoints: [],
speedItemsIndex: 0, speedItemsIndex: 0,
isReplayIng: false, isReplayIng: false,
...@@ -183,9 +181,9 @@ Page({ ...@@ -183,9 +181,9 @@ Page({
padding: [40, 40, 40, 40] padding: [40, 40, 40, 40]
}) })
this.setData({ this.setData({
polyline: polyline,
includePoints: arr includePoints: arr
}) })
this.myMap.setData({polyline: polyline})
} else { } else {
wx.showModal({ wx.showModal({
content: '暂无数据', content: '暂无数据',
...@@ -240,8 +238,8 @@ Page({ ...@@ -240,8 +238,8 @@ Page({
id: 105, id: 105,
width: 15, width: 15,
height: 25, height: 25,
latitude: this.data.polyline[0].points[0].latitude, latitude: this.myMap.data.polyline[0].points[0].latitude,
longitude: this.data.polyline[0].points[0].longitude, longitude: this.myMap.data.polyline[0].points[0].longitude,
iconPath: '../../images/car.png' iconPath: '../../images/car.png'
}] }]
this.setData({ this.setData({
...@@ -253,7 +251,7 @@ Page({ ...@@ -253,7 +251,7 @@ Page({
if (this.myMap.getMapCtx().moveAlong) { if (this.myMap.getMapCtx().moveAlong) {
this.myMap.getMapCtx().moveAlong({ this.myMap.getMapCtx().moveAlong({
markerId: 105, markerId: 105,
path: this.data.polyline[0].points, path: this.myMap.data.polyline[0].points,
duration: this.data.durationArr[this.data.speedItemsIndex], duration: this.data.durationArr[this.data.speedItemsIndex],
fail: (res) => { // 真机上容易执行失败 fail: (res) => { // 真机上容易执行失败
if (res.errMsg === 'moveMapMarkerAlong:fail') { if (res.errMsg === 'moveMapMarkerAlong:fail') {
...@@ -272,8 +270,8 @@ Page({ ...@@ -272,8 +270,8 @@ Page({
} }
}, },
async beginTrack() { async beginTrack() {
if (this.data.polyline.length) { if (this.myMap.data.polyline.length) {
this.addmerker() await this.addmerker()
await this.move() await this.move()
} }
}, },
...@@ -294,7 +292,7 @@ Page({ ...@@ -294,7 +292,7 @@ Page({
}, },
// 点击地图回调 // 点击地图回调
mapCallback(e) { mapCallback(e) {
if (this.data.polyline.length <= 0) return if (this.myMap.data.polyline.length <= 0) return
let transferAddress let transferAddress
// 删除上一个marker // 删除上一个marker
this.myMap.getMapCtx().removeMarkers({ this.myMap.getMapCtx().removeMarkers({
......
...@@ -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="traReplayMap" mapId="traReplayMap" polyline="{{polyline}}" includePoints="{{includePoints}}" markers="{{markers}}" bind:refresh="refresh" bind:mapCallback="mapCallback" bind:locationCallback="locationCallback"></myMap> <myMap class="my-map" id="traReplayMap" mapId="traReplayMap" 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>
......
// const domain = 'https://e-shield.didihu.com.cn/otmini/'; //正式环境 const domain = 'https://e-shield.didihu.com.cn/otmini/'; //正式环境
const domain = 'https://devwx.glsx.com.cn/otmini/'; //开发环境 // const domain = 'https://devwx.glsx.com.cn/otmini/'; //开发环境
/* /*
新e盾找车 新e盾找车
*/ */
// 开发:https://eshield.dev.glsx.com.cn/ // 开发:https://eshield.dev.glsx.com.cn/
// 测试:https://eshield.test.glsx.com.cn/ // 测试:https://eshield.test.glsx.com.cn/
// 生产:https://eshield.didihu.com.cn/ // 生产:https://eshield.didihu.com.cn/
const newDomain = 'https://eshield.test.glsx.com.cn/' const newDomain = 'https://eshield.didihu.com.cn/'
function redirectToLogin(){console.log('redirectToLogin') function redirectToLogin(){console.log('redirectToLogin')
wx.redirectTo({ wx.redirectTo({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!