Commit 9f91db55 by zhangxw

优化修改

1 parent 280269bb
This diff could not be displayed because it is too large.
.map-wrap{ .map-wrap{
position: fixed;
top: 0;
left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
......
const WXRequest = require('../../utils/wxrequest.js'); const WXRequest = require('../../utils/wxrequest.js');
const moment = require('../../utils/moment.min.js');
let _timeoutId
Page({ Page({
/** /**
...@@ -20,7 +18,6 @@ Page({ ...@@ -20,7 +18,6 @@ Page({
isSharePage: false, // 是否被分享者进入 isSharePage: false, // 是否被分享者进入
ShowShareModel: false, ShowShareModel: false,
includePoints: [], includePoints: [],
markerIds: [],
isUpdate: true isUpdate: true
}, },
...@@ -35,6 +32,7 @@ Page({ ...@@ -35,6 +32,7 @@ Page({
}) })
if (options.isSharePage) { if (options.isSharePage) {
wx.hideHomeButton() wx.hideHomeButton()
wx.hideShareMenu()
} }
}, },
onShow(options){ onShow(options){
...@@ -50,14 +48,10 @@ Page({ ...@@ -50,14 +48,10 @@ Page({
carInfoWindowObj: {}, // 当前点击的marker数据 carInfoWindowObj: {}, // 当前点击的marker数据
carInfoArr: [], // 车辆marker数据 carInfoArr: [], // 车辆marker数据
isShowCarInfoWindow: false, // 信息窗体 isShowCarInfoWindow: false, // 信息窗体
includePoints: [] includePoints: [],
markers: []
}) })
this.myMap.getMapCtx().removeMarkers({
markerIds: this.data.markerIds,
success: () => {
this.getData() this.getData()
}
})
}, },
// 获取定位 // 获取定位
locationCallback(e) { locationCallback(e) {
...@@ -77,80 +71,8 @@ Page({ ...@@ -77,80 +71,8 @@ Page({
}) })
}, },
getData() { getData() {
// 分享时效性上报分享记录暂时不做
// if (this.data.isSharePage) {
// WXRequest.get('/vehicleshare/getvehicleshare', {
// loginUserId: this.data.loginUserId,
// vehicleId: this.data.carInfo.vehicleid
// }).then(res => {
// if(res.returnCode == '0'){
// const data = res.data;
// vehicleShareDeadTime = data.endTime;
// if(data.status === 1){
// wx.showModal({
// content: '该分享无效,请启用后使用',
// showCancel: false
// });
// }else if(moment().isAfter(moment(vehicleShareDeadTime))){ //失效
// wx.showModal({
// content: '该分享已失效',
// showCancel: false
// });
// }else{
// this.setData({
// isShareDead: false
// })
// checkIsShareDead();
// createShareLog();
// getVehicleData();
// }
// }
// })
// } else {
// this.getVehicleData()
// }
this.getVehicleData() this.getVehicleData()
}, },
// checkIsShareDead(){
// if(_timeoutId){
// clearTimeout(_timeoutId)
// }
// _timeoutId = setTimeout(function(){
// WXRequest.get('/vehicleshare/getvehicleshare', {
// loginUserId: this.data.loginUserId,
// vehicleId: this.data.carInfo.vehicleid
// }).then(res => {
// if(res.returnCode == '0'){
// const data = res.data;
// vehicleShareDeadTime = data.endTime;
// this.setData({
// isLoading: false
// })
// if(data.status === 1 || moment().isAfter(moment(vehicleShareDeadTime))){
// this.setData({
// isShareDead: true
// })
// }else{
// checkIsShareDead()
// }
// }
// })
// }, 1000*60*5)
// },
// createShareLog(){
// if(this.data.isShareLogged) return;
// WXRequest.get('vehicleshare/saveshareduser', {
// loginUserId: this.data.loginUserId,
// vehicleId: this.data.carInfo.vehicleid
// }).then(res => {
// if(res.returnCode == '0'){
// this.setData({
// isLoading: false,
// isShareLogged: true
// })
// }
// })
// },
getVehicleData(){ getVehicleData(){
this.setData({ this.setData({
isLoading: false isLoading: false
...@@ -166,7 +88,7 @@ Page({ ...@@ -166,7 +88,7 @@ Page({
isLoading: false isLoading: false
}) })
if (res.code == 200) { if (res.code == 200) {
let [markers, includePoints, markerIds] = [[], [], []] let [markers, includePoints] = [[], []]
if (res.data.length > 0) { if (res.data.length > 0) {
res.data.forEach(item => { res.data.forEach(item => {
markers.push({ markers.push({
...@@ -182,22 +104,16 @@ Page({ ...@@ -182,22 +104,16 @@ Page({
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,
}) })
item.type = this.data.carInfoWindowObj['type'] || 'gpsLocation' // 默认显示GPS的定位类型 item.type = this.data.carInfoWindowObj['type'] || 'gpsLocation' // 默认显示GPS的定位类型
markerIds.push(Number(item.sn))
}) })
this.setData({ this.setData({
carInfoArr: res.data, carInfoArr: res.data,
includePoints: includePoints, includePoints: includePoints,
markerIds: markerIds markers: markers
}) })
this.myMap.getMapCtx().addMarkers({
markers: markers,
success: () => {
this.myMap.getMapCtx().includePoints({ this.myMap.getMapCtx().includePoints({
points: includePoints, points: includePoints,
padding: [60, 60, 60, 60] padding: [60, 60, 60, 60]
}) })
}
})
} else { } else {
wx.showModal({ wx.showModal({
content: '暂无数据', content: '暂无数据',
...@@ -213,7 +129,7 @@ Page({ ...@@ -213,7 +129,7 @@ Page({
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(data[data['type']].elat, data[data['type']].elng) _this.moveToLocation(Number(data[data['type']].elat), Number(data[data['type']].elng))
if (data[data['type']].transferAddress) { if (data[data['type']].transferAddress) {
_this.setData({ _this.setData({
isShowCarInfoWindow: true, isShowCarInfoWindow: true,
...@@ -224,12 +140,14 @@ Page({ ...@@ -224,12 +140,14 @@ Page({
wx.request({ wx.request({
url: `https://apis.map.qq.com/ws/geocoder/v1/?key=46XBZ-RVUCD-FI34X-H66JJ-HZ5FS-3YFID&location=`+ data[data['type']].elat + ',' + data[data['type']].elng, url: `https://apis.map.qq.com/ws/geocoder/v1/?key=46XBZ-RVUCD-FI34X-H66JJ-HZ5FS-3YFID&location=`+ data[data['type']].elat + ',' + data[data['type']].elng,
success: res => { success: res => {
if (res.statusCode === 200) {
data[data['type']].transferAddress = res.data && res.data.result.address_component.province === res.data.result.address_component.city ? (res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough) : (res.data.result.address_component.province + '' + res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough) data[data['type']].transferAddress = res.data && res.data.result.address_component.province === res.data.result.address_component.city ? (res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough) : (res.data.result.address_component.province + '' + res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough)
_this.setData({ _this.setData({
carInfoWindowObj: data, carInfoWindowObj: data,
isShowCarInfoWindow: true isShowCarInfoWindow: true
}) })
} }
}
}) })
}, },
findCarClick() { findCarClick() {
...@@ -267,17 +185,7 @@ Page({ ...@@ -267,17 +185,7 @@ Page({
}, },
duration: 100, duration: 100,
animationEnd: () => { animationEnd: () => {
this.setData({ this.moveToLocation(Number(this.data.carInfoWindowObj['gpsLocation'].elat), Number(this.data.carInfoWindowObj['gpsLocation'].elng))
markers: [{
id: Number(this.data.carInfoWindowObj.sn), // 设备号唯一 可作为markerid
width: 26,
height: 36,
latitude: Number(this.data.carInfoWindowObj['gpsLocation'].elat), // 默认显示GPS定位位置
longitude: Number(this.data.carInfoWindowObj['gpsLocation'].elng),
iconPath: this.data.carInfoWindowObj.source === '1' ? '../../images/oncar.png' : '../../images/offcar.png'
}]
})
this.moveToLocation(this.data.carInfoWindowObj['gpsLocation'].elat, this.data.carInfoWindowObj['gpsLocation'].elng)
} }
}) })
carInfoArr.forEach(val => { carInfoArr.forEach(val => {
...@@ -308,17 +216,7 @@ Page({ ...@@ -308,17 +216,7 @@ Page({
}, },
duration: 100, duration: 100,
animationEnd: () => { animationEnd: () => {
this.setData({ this.moveToLocation(Number(this.data.carInfoWindowObj['bsLocation'].elat), Number(this.data.carInfoWindowObj['bsLocation'].elng))
markers: [{
id: Number(this.data.carInfoWindowObj.sn), // 设备号唯一 可作为markerid
width: 26,
height: 36,
latitude: this.data.carInfoWindowObj['bsLocation'].elat, // 默认显示GPS定位位置
longitude: this.data.carInfoWindowObj['bsLocation'].elng,
iconPath: this.data.carInfoWindowObj.source === '1' ? '../../images/oncar.png' : '../../images/offcar.png'
}]
})
this.moveToLocation(this.data.carInfoWindowObj['bsLocation'].elat, this.data.carInfoWindowObj['bsLocation'].elng)
} }
}) })
carInfoArr.forEach(val => { carInfoArr.forEach(val => {
...@@ -334,6 +232,7 @@ Page({ ...@@ -334,6 +232,7 @@ Page({
wx.request({ wx.request({
url: `https://apis.map.qq.com/ws/geocoder/v1/?key=46XBZ-RVUCD-FI34X-H66JJ-HZ5FS-3YFID&location=`+ this.data.carInfoWindowObj['bsLocation'].elat + ',' + this.data.carInfoWindowObj['bsLocation'].elng, url: `https://apis.map.qq.com/ws/geocoder/v1/?key=46XBZ-RVUCD-FI34X-H66JJ-HZ5FS-3YFID&location=`+ this.data.carInfoWindowObj['bsLocation'].elat + ',' + this.data.carInfoWindowObj['bsLocation'].elng,
success: res => { success: res => {
if (res.statusCode === 200) {
let transferAddress = res.data && res.data.result.address_component.province === res.data.result.address_component.city ? (res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough) : (res.data.result.address_component.province + '' + res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough) let transferAddress = res.data && res.data.result.address_component.province === res.data.result.address_component.city ? (res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough) : (res.data.result.address_component.province + '' + res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough)
data['bsLocation'].transferAddress = transferAddress data['bsLocation'].transferAddress = transferAddress
carInfoArr.forEach(val => { carInfoArr.forEach(val => {
...@@ -347,6 +246,7 @@ Page({ ...@@ -347,6 +246,7 @@ Page({
carInfoArr: carInfoArr carInfoArr: carInfoArr
}) })
} }
}
}) })
break break
} }
...@@ -359,22 +259,15 @@ Page({ ...@@ -359,22 +259,15 @@ Page({
}, },
// 车辆追踪 // 车辆追踪
carInfoTrace() { carInfoTrace() {
// if (this.data.isSharePage && this.data.isShareDead) {
// wx.showModal({
// content: '该分享已失效',
// showCancel: false
// });
// return;
// }
wx.getSetting({ wx.getSetting({
success: (res) => { success: (res) => {
let authSetting = res.authSetting let authSetting = res.authSetting
if (authSetting['scope.userLocation']) { if (authSetting['scope.userLocation']) {
// 已授权 // 已授权
var lng,lat; var lng,lat;
lng = this.data.carInfoWindowObj[this.data.carInfoWindowObj['type']].elng lng = this.data.carInfoWindowObj['gpsLocation'].elng
lat = this.data.carInfoWindowObj[this.data.carInfoWindowObj['type']].elat lat = this.data.carInfoWindowObj['gpsLocation'].elat
wx.navigateTo({ wx.navigateTo({ // 车辆追踪gps定位坐标
url: `../../pages/newCarTrace/carTrace?lat=${lat}&lng=${lng}` url: `../../pages/newCarTrace/carTrace?lat=${lat}&lng=${lng}`
}) })
} else { } else {
...@@ -395,13 +288,6 @@ Page({ ...@@ -395,13 +288,6 @@ Page({
}, },
// 轨迹回放 // 轨迹回放
traReplay(e) { traReplay(e) {
// if (this.data.isSharePage && this.data.isShareDead) {
// wx.showModal({
// content: '该分享已失效',
// showCancel: false
// });
// return;
// }
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}`
}); });
...@@ -423,13 +309,6 @@ Page({ ...@@ -423,13 +309,6 @@ Page({
}, },
// 实时监控 // 实时监控
monitor() { monitor() {
// if (this.data.isSharePage && this.data.isShareDead) {
// wx.showModal({
// content: '该分享已失效',
// showCancel: false
// });
// return;
// }
wx.navigateTo({ wx.navigateTo({
url: `../../pages/newMonitor/monitor?sn=${encodeURIComponent(this.data.carInfoWindowObj.encryptSn)}` url: `../../pages/newMonitor/monitor?sn=${encodeURIComponent(this.data.carInfoWindowObj.encryptSn)}`
}); });
...@@ -488,44 +367,12 @@ Page({ ...@@ -488,44 +367,12 @@ Page({
*/ */
onShareAppMessage: function(options) { onShareAppMessage: function(options) {
var that = this; var that = this;
var return_url = options.webViewUrl;
/*await new Promise((resolve, reject)=>{
setTimeout(()=>{
resolve()
},1000)
})*/
const startTime = moment().format('YYYY-MM-DD HH:mm:ss');
// WXRequest.get('vehicleshare/savevehicleshare', {
// loginUserId: that.data.loginUserId,
// vehicleId: that.data.carInfo.vehicleid,
// source: 0,
// status: 0,
// startTime: startTime,
// endTime: moment(startTime).add(3, 'days').format('YYYY-MM-DD HH:mm:ss')
// }).then((res)=>{
// });
var opts = { var opts = {
title: that.data.title, title: that.data.title,
path: '/pages/loading/loading', path: '/pages/loading/loading',
success: function (res) { success: function (res) {
/*var shareTickets = res.shareTickets;
if (shareTickets.length == 0) {
return false;
}
wx.getShareInfo({
shareTicket: shareTickets[0],
success: function(res){
var encryptedData = res.encryptedData;
var iv = res.iv;
}
})*/
}, },
fail: function (res) { fail: function (res) {
// 转发失败
} }
} }
this.setData({ this.setData({
......
{ {
"usingComponents": { "usingComponents": {
"myMap": "../../components/myMap/myMap" "myMap": "../../components/myMap/myMap"
} },
"navigationBarTitleText": "找车"
} }
\ No newline at end of file \ No newline at end of file
<view class="content_page"> <view class="content_page">
<myMap class="my-map" id="myMap" bind:getCarInfoWindowObj="getCarInfoWindowObj" bind:refresh="refresh" includePoints="{{includePoints}}" bind:locationCallback="locationCallback"></myMap> <myMap class="my-map" id="myMap" 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>
<!-- 信息窗体内容 --> <!-- 信息窗体内容 -->
......
This diff could not be displayed because it is too large.
...@@ -11,10 +11,12 @@ Page({ ...@@ -11,10 +11,12 @@ Page({
},{ },{
label: '设备号', label: '设备号',
value: '1' value: '1'
},{ }
label: '姓名', // {
value: '3' // label: '姓名',
}], // value: '3'
// }
],
placeholders: [ placeholders: [
'请输入完整的申请单号', '请输入完整的申请单号',
'请输入完整的车架号', '请输入完整的车架号',
...@@ -143,14 +145,14 @@ Page({ ...@@ -143,14 +145,14 @@ Page({
if(inputVal.length<2){ if(inputVal.length<2){
wx.showToast({ wx.showToast({
title: '请输入正确的姓名,至少2个字', title: '请输入正确的姓名,至少2个字',
icon: none icon: 'none'
}); });
return false; return false;
} }
}else if(inputVal.length<6){ }else if(inputVal.length<6){
wx.showToast({ wx.showToast({
title: '请输入至少6位数', title: '请输入至少6位数',
icon: none icon: 'none'
}); });
return false; return false;
} }
......
...@@ -85,6 +85,7 @@ Page({ ...@@ -85,6 +85,7 @@ Page({
wx.request({ wx.request({
url: `https://apis.map.qq.com/ws/geocoder/v1/?key=46XBZ-RVUCD-FI34X-H66JJ-HZ5FS-3YFID&location=`+ e.data[0].gpsLocation.elat + ',' + e.data[0].gpsLocation.elng, url: `https://apis.map.qq.com/ws/geocoder/v1/?key=46XBZ-RVUCD-FI34X-H66JJ-HZ5FS-3YFID&location=`+ e.data[0].gpsLocation.elat + ',' + e.data[0].gpsLocation.elng,
success: res => { success: res => {
if (res.statusCode === 200) {
let transferAddress = res.data && res.data.result.address_component.province === res.data.result.address_component.city ? (res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough) : (res.data.result.address_component.province + '' + res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough) let transferAddress = res.data && res.data.result.address_component.province === res.data.result.address_component.city ? (res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough) : (res.data.result.address_component.province + '' + res.data.result.address_component.city + '' + res.data.result.formatted_addresses.rough)
listData.push({ listData.push({
transferAddress: transferAddress, transferAddress: transferAddress,
...@@ -154,7 +155,7 @@ Page({ ...@@ -154,7 +155,7 @@ Page({
}, },
duration: 500, duration: 500,
animationEnd: () => { animationEnd: () => {
this.moveToLocation(e.data[0].gpsLocation.elat, e.data[0].gpsLocation.elng) this.moveToLocation(Number(e.data[0].gpsLocation.elat), Number(e.data[0].gpsLocation.elng))
this.setData({ this.setData({
points: points.concat(arr), points: points.concat(arr),
polyline: [{ polyline: [{
...@@ -176,6 +177,7 @@ Page({ ...@@ -176,6 +177,7 @@ Page({
this.getPosition() this.getPosition()
}, 10*1000) }, 10*1000)
} }
}
}) })
} }
}) })
......
{ {
"usingComponents": {} "usingComponents": {
"myMap": "../../components/myMap/myMap"
},
"navigationBarTitleText": "实时监控"
} }
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
...@@ -29,12 +29,12 @@ Page({ ...@@ -29,12 +29,12 @@ Page({
isReplayIng: false, isReplayIng: false,
polyline: [], polyline: [],
markers: [], markers: [],
duration: 20000, // 回放速度
isShowModel: false, isShowModel: false,
clickItem: null, clickItem: null,
selectTime: '', selectTime: '',
sn: null, sn: null,
type: null type: null,
durationArr: [20000, 15000, 10000, 5000]
}, },
/** /**
...@@ -64,7 +64,6 @@ Page({ ...@@ -64,7 +64,6 @@ Page({
refresh() { refresh() {
if (this.data.polyline.length <= 0) return if (this.data.polyline.length <= 0) return
this.setData({ this.setData({
duration: 20000,
clickItem: null, clickItem: null,
selectTime: '', selectTime: '',
polyline: [], polyline: [],
...@@ -155,15 +154,25 @@ Page({ ...@@ -155,15 +154,25 @@ Page({
} }
let params = {sn: this.data.sn, startTime: _sTime, endTime: _eTime, locationType: this.data.locationType} let params = {sn: this.data.sn, startTime: _sTime, endTime: _eTime, locationType: this.data.locationType}
WXRequest.get('devicemonitor/api/track/playback', params, true).then(res => { WXRequest.get('devicemonitor/api/track/playback', params, true).then(res => {
// let params = {sn: '45111120466', sTime: _sTime, eTime: _eTime}
// WXRequest.get('Track/getTrackHistory', params).then(res => {
let arr = [] let arr = []
var polyline = [] var polyline = []
if (res.code == 200) { if (res.code == 200) {
// if (res.returnCode == 0) {
res.data.forEach(item => { res.data.forEach(item => {
arr.push({ arr.push({
latitude: Number(item.elat), latitude: Number(item.elat),
longitude: Number(item.elng) longitude: Number(item.elng)
}) })
}); });
let obj = {}
let removalArr = arr.reduce((curr, next) => {
/*判断对象中是否已经有该属性 没有的话 push 到 curr数组*/
obj[next.latitude + next.longitude] ? '' : obj[next.latitude + next.longitude] = curr.push(next);
return curr;
}, []);
this.distance(removalArr)
if (res.data.length) { if (res.data.length) {
polyline.push({ polyline.push({
points: arr, points: arr,
...@@ -189,12 +198,39 @@ Page({ ...@@ -189,12 +198,39 @@ Page({
} }
}) })
}, },
// 距离计算总和
distance(arr) {
var s, all = 0
arr.forEach((item, index) => {
if (arr[index + 1]) {
var La1 = arr[index].latitude * Math.PI / 180.0;
var La2 = arr[index + 1].latitude * Math.PI / 180.0;
var La3 = La1 - La2;
var Lb3 = arr[index].longitude * Math.PI / 180.0 - arr[index + 1].longitude * Math.PI / 180.0;
s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(La3 / 2), 2) + Math.cos(La1) * Math.cos(La2) * Math.pow(Math.sin(Lb3 / 2), 2)));
s = s * 6378.137;//地球半径
s = Math.round(s * 10000) / 10000;
all = all + s
}
})
if (all > 10 && all < 100) {
this.setData({
durationArr: [15*1000, 10*1000, 6*1000, 3*1000]
})
} else if (all <= 10) {
this.setData({
durationArr: [8*1000, 6*1000, 4*1000, 2*1000]
})
} else {
this.setData({
durationArr: [20*1000, 15*1000, 10*1000, 5*1000]
})
}
},
// 切换回放速度 // 切换回放速度
speedTypeChange(e) { speedTypeChange(e) {
let arr = [20000, 15000, 10000, 5000]
this.setData({ this.setData({
speedItemsIndex: Number(e.detail.value), speedItemsIndex: Number(e.detail.value)
duration: arr[Number(e.detail.value)]
}) })
this.beginTrack() this.beginTrack()
}, },
...@@ -219,7 +255,7 @@ Page({ ...@@ -219,7 +255,7 @@ Page({
this.myMap.getMapCtx().moveAlong({ this.myMap.getMapCtx().moveAlong({
markerId: 105, markerId: 105,
path: this.data.polyline[0].points, path: this.data.polyline[0].points,
duration: this.data.duration, duration: this.data.durationArr[this.data.speedItemsIndex],
fail: () => { fail: () => {
this.beginTrack() this.beginTrack()
} }
...@@ -250,6 +286,7 @@ Page({ ...@@ -250,6 +286,7 @@ Page({
wx.request({ wx.request({
url: `https://apis.map.qq.com/ws/geocoder/v1/?key=46XBZ-RVUCD-FI34X-H66JJ-HZ5FS-3YFID&location=`+ e.detail.detail.latitude + ',' + e.detail.detail.longitude, url: `https://apis.map.qq.com/ws/geocoder/v1/?key=46XBZ-RVUCD-FI34X-H66JJ-HZ5FS-3YFID&location=`+ e.detail.detail.latitude + ',' + e.detail.detail.longitude,
success: res => { success: res => {
if (res.statusCode === 200) {
transferAddress = res.data && res.data.result.address_component.province === res.data.result.address_component.city ? (res.data.result.address_component.city + '\n' + res.data.result.formatted_addresses.rough) : (res.data.result.address_component.province + '' + res.data.result.address_component.city + '\n' + res.data.result.formatted_addresses.rough) transferAddress = res.data && res.data.result.address_component.province === res.data.result.address_component.city ? (res.data.result.address_component.city + '\n' + res.data.result.formatted_addresses.rough) : (res.data.result.address_component.province + '' + res.data.result.address_component.city + '\n' + res.data.result.formatted_addresses.rough)
this.myMap.getMapCtx().addMarkers({ this.myMap.getMapCtx().addMarkers({
markers: [{ markers: [{
...@@ -267,6 +304,7 @@ Page({ ...@@ -267,6 +304,7 @@ Page({
}], }],
}) })
} }
}
}) })
}, },
/** /**
......
{ {
"usingComponents": { "usingComponents": {
"myMap": "../../components/myMap/myMap" "myMap": "../../components/myMap/myMap"
} },
"navigationBarTitleText": "轨迹回放"
} }
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!