Commit 52470548 by zhangxw

冒烟 问题修改

1 parent 6aa77490
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
"pages/freqLogUserDetail/freqLogUserDetail", "pages/freqLogUserDetail/freqLogUserDetail",
"pages/map/findCar", "pages/map/findCar",
"pages/newFindCar/findCar", "pages/newFindCar/findCar",
"pages/newCarTrace/carTrace",
"pages/newFindSearch/findSearch", "pages/newFindSearch/findSearch",
"pages/newMonitor/monitor", "pages/newMonitor/monitor",
"pages/newTraReplay/traReplay" "pages/newTraReplay/traReplay"
......
...@@ -27,7 +27,8 @@ Component({ ...@@ -27,7 +27,8 @@ Component({
carInfoWindowObj: {}, carInfoWindowObj: {},
isGPS: true, isGPS: true,
scale: 16, scale: 16,
isCanClick: true isCanClick: true,
inPoints: []
}, },
ready() { ready() {
}, },
......
<view class="map-wrap"> <view class="map-wrap">
<!-- 地图组件 --> <!-- 地图组件 -->
<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 id="{{mapId}}" class="my-map" polyline="{{polyline}}" markers="{{markers}}" longitude="{{currentLo}}" latitude="{{currentLa}}" scale="{{scale}}" enable-satellite="{{enableSatellite}}" bindmarkertap="bindmarkertap" data-num="1" include-points="{{inPoints}}" 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">
......
Page({
/**
* 页面的初始数据
*/
data: {
url: '',
init: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.getLocation({
success: function(res) {
wx.openLocation({
latitude: Number(options.lat),
longitude: Number(options.lng)
});
},
fail(res){
console.log(res)
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if(this.data.init){
wx.navigateBack()
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
this.setData({
init: true
});
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
// onShareAppMessage: function () {
// }
})
\ No newline at end of file \ No newline at end of file
{
"navigationBarTitleText": "导航"
}
\ No newline at end of file \ No newline at end of file
...@@ -18,7 +18,8 @@ Page({ ...@@ -18,7 +18,8 @@ Page({
isSharePage: false, // 是否被分享者进入 isSharePage: false, // 是否被分享者进入
ShowShareModel: false, ShowShareModel: false,
includePoints: [], includePoints: [],
isUpdate: true isUpdate: true,
isOpenWechatMap: true
}, },
/** /**
...@@ -49,7 +50,7 @@ Page({ ...@@ -49,7 +50,7 @@ Page({
carInfoWindowObj: {}, // 当前点击的marker数据 carInfoWindowObj: {}, // 当前点击的marker数据
carInfoArr: [], // 车辆marker数据 carInfoArr: [], // 车辆marker数据
isShowCarInfoWindow: false, // 信息窗体 isShowCarInfoWindow: false, // 信息窗体
includePoints: [] includePoints: [],
}) })
setTimeout(() => { setTimeout(() => {
this.getData() this.getData()
...@@ -94,24 +95,27 @@ Page({ ...@@ -94,24 +95,27 @@ 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),
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,
padding: [60, 60, 60, 60] // padding: [60, 60, 60, 60]
// })
this.myMap.setData({ // 防止页面跳转回退页面未保留用户的操作 用mapContext.includePoints 会有问题
inPoints: includePoints
}) })
this.setData({ this.setData({
carInfoArr: res.data, carInfoArr: res.data,
...@@ -281,35 +285,28 @@ Page({ ...@@ -281,35 +285,28 @@ Page({
}, },
// 车辆追踪 // 车辆追踪
carInfoTrace() { carInfoTrace() {
wx.getSetting({ this.setData({
success: (res) => { isOpenWechatMap: false
let authSetting = res.authSetting })
if (authSetting['scope.userLocation']) { let lng = this.data.carInfoWindowObj['gpsLocation'].elng
// 已授权 let lat = this.data.carInfoWindowObj['gpsLocation'].elat
var lng,lat; wx.openLocation({
lng = this.data.carInfoWindowObj['gpsLocation'].elng latitude: Number(lat),
lat = this.data.carInfoWindowObj['gpsLocation'].elat longitude: Number(lng),
wx.navigateTo({ // 车辆追踪gps定位坐标 success: () => {
url: `../../pages/newCarTrace/carTrace?lat=${lat}&lng=${lng}` setTimeout(() => {
this.setData({
isOpenWechatMap: true
}) })
} else { }, 1000)
if (typeof(authSetting['scope.userLocation']) !== 'undefined') {
wx.showModal({
title: '您未开启地理位置授权',
content: '点击确定去开启地理位置授权',
success: res => {
if (res.confirm) {
wx.openSetting()
}
}
})
}
}
} }
}) })
}, },
// 轨迹回放 // 轨迹回放
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}`
}); });
...@@ -331,6 +328,9 @@ Page({ ...@@ -331,6 +328,9 @@ 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)}`
}); });
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</view> </view>
</view> </view>
<view class="cmd-list"> <view class="cmd-list">
<view bindtap="carInfoTrace">车辆追踪</view> <view bindtap="{{isOpenWechatMap ? 'carInfoTrace' : ''}}">车辆追踪</view>
<view bindtap="traReplay">轨迹回放</view> <view bindtap="traReplay">轨迹回放</view>
<view bindtap="monitor">实时监控</view> <view bindtap="monitor">实时监控</view>
<view bindtap="share" wx:if="{{!isSharePage}}">分享找车</view> <view bindtap="share" wx:if="{{!isSharePage}}">分享找车</view>
......
...@@ -180,7 +180,6 @@ Page({ ...@@ -180,7 +180,6 @@ Page({
width: 6, width: 6,
arrowLine: true arrowLine: true
}) })
this.myMap = this.selectComponent('#myMap')
this.myMap.getMapCtx().includePoints({ this.myMap.getMapCtx().includePoints({
points: arr, points: arr,
padding: [40, 40, 40, 40] padding: [40, 40, 40, 40]
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!