Commit 52470548 by zhangxw

冒烟 问题修改

1 parent 6aa77490
......@@ -25,7 +25,6 @@
"pages/freqLogUserDetail/freqLogUserDetail",
"pages/map/findCar",
"pages/newFindCar/findCar",
"pages/newCarTrace/carTrace",
"pages/newFindSearch/findSearch",
"pages/newMonitor/monitor",
"pages/newTraReplay/traReplay"
......
......@@ -27,7 +27,8 @@ Component({
carInfoWindowObj: {},
isGPS: true,
scale: 16,
isCanClick: true
isCanClick: true,
inPoints: []
},
ready() {
},
......
<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>
<!-- 地图控件 -->
<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
{
"navigationBarTitleText": "导航"
}
\ No newline at end of file
......@@ -18,7 +18,8 @@ Page({
isSharePage: false, // 是否被分享者进入
ShowShareModel: false,
includePoints: [],
isUpdate: true
isUpdate: true,
isOpenWechatMap: true
},
/**
......@@ -49,7 +50,7 @@ Page({
carInfoWindowObj: {}, // 当前点击的marker数据
carInfoArr: [], // 车辆marker数据
isShowCarInfoWindow: false, // 信息窗体
includePoints: []
includePoints: [],
})
setTimeout(() => {
this.getData()
......@@ -94,24 +95,27 @@ 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),
// 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,
padding: [60, 60, 60, 60]
// this.myMap.getMapCtx().includePoints({
// points: includePoints,
// padding: [60, 60, 60, 60]
// })
this.myMap.setData({ // 防止页面跳转回退页面未保留用户的操作 用mapContext.includePoints 会有问题
inPoints: includePoints
})
this.setData({
carInfoArr: res.data,
......@@ -281,35 +285,28 @@ Page({
},
// 车辆追踪
carInfoTrace() {
wx.getSetting({
success: (res) => {
let authSetting = res.authSetting
if (authSetting['scope.userLocation']) {
// 已授权
var lng,lat;
lng = this.data.carInfoWindowObj['gpsLocation'].elng
lat = this.data.carInfoWindowObj['gpsLocation'].elat
wx.navigateTo({ // 车辆追踪gps定位坐标
url: `../../pages/newCarTrace/carTrace?lat=${lat}&lng=${lng}`
this.setData({
isOpenWechatMap: false
})
let lng = this.data.carInfoWindowObj['gpsLocation'].elng
let lat = this.data.carInfoWindowObj['gpsLocation'].elat
wx.openLocation({
latitude: Number(lat),
longitude: Number(lng),
success: () => {
setTimeout(() => {
this.setData({
isOpenWechatMap: true
})
} else {
if (typeof(authSetting['scope.userLocation']) !== 'undefined') {
wx.showModal({
title: '您未开启地理位置授权',
content: '点击确定去开启地理位置授权',
success: res => {
if (res.confirm) {
wx.openSetting()
}
}
})
}
}
}, 1000)
}
})
},
// 轨迹回放
traReplay(e) {
this.setData({
isUpdate: false,
})
wx.navigateTo({
url: `../../pages/newTraReplay/traReplay?sn=${encodeURIComponent(this.data.carInfoWindowObj.encryptSn)}&locationType=${this.data.carInfoWindowObj.type}`
});
......@@ -331,6 +328,9 @@ Page({
},
// 实时监控
monitor() {
this.setData({
isUpdate: false,
})
wx.navigateTo({
url: `../../pages/newMonitor/monitor?sn=${encodeURIComponent(this.data.carInfoWindowObj.encryptSn)}`
});
......
......@@ -48,7 +48,7 @@
</view>
</view>
<view class="cmd-list">
<view bindtap="carInfoTrace">车辆追踪</view>
<view bindtap="{{isOpenWechatMap ? 'carInfoTrace' : ''}}">车辆追踪</view>
<view bindtap="traReplay">轨迹回放</view>
<view bindtap="monitor">实时监控</view>
<view bindtap="share" wx:if="{{!isSharePage}}">分享找车</view>
......
......@@ -180,7 +180,6 @@ Page({
width: 6,
arrowLine: true
})
this.myMap = this.selectComponent('#myMap')
this.myMap.getMapCtx().includePoints({
points: arr,
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!