Commit 1a4257f9 by zhangxw

兼容性问题

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