|
@@ -159,7 +159,6 @@ export default {
|
|
// 自动定位一次
|
|
// 自动定位一次
|
|
this.geolocation.getCurrentPosition()
|
|
this.geolocation.getCurrentPosition()
|
|
})
|
|
})
|
|
- // this.map.on('dragend', this.moveMapHandler)
|
|
|
|
},
|
|
},
|
|
|
|
|
|
// 调用高德
|
|
// 调用高德
|
|
@@ -180,28 +179,14 @@ export default {
|
|
// 获取定位
|
|
// 获取定位
|
|
getLocation(geolocation) {
|
|
getLocation(geolocation) {
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
- try {
|
|
|
|
- mapLocation.postMessage('获取定位')
|
|
|
|
- window['setMapLocation'] = res => {
|
|
|
|
- let e = JSON.parse(res)
|
|
|
|
|
|
+ this.AMap.plugin('AMap.Geolocation', function () {
|
|
|
|
+ geolocation.getCurrentPosition(function (status, res) {
|
|
resolve({
|
|
resolve({
|
|
- status: 'complete',
|
|
|
|
- data: {
|
|
|
|
- lng: e.longitude,
|
|
|
|
- lat: e.latitude
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- } catch {
|
|
|
|
- this.AMap.plugin('AMap.Geolocation', function () {
|
|
|
|
- geolocation.getCurrentPosition(function (status, res) {
|
|
|
|
- resolve({
|
|
|
|
- status: status,
|
|
|
|
- data: res.position
|
|
|
|
- })
|
|
|
|
|
|
+ status: status,
|
|
|
|
+ data: res.position
|
|
})
|
|
})
|
|
})
|
|
})
|
|
- }
|
|
|
|
|
|
+ })
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
@@ -250,14 +235,6 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
- // // 移动地图 中心坐标
|
|
|
|
- // moveMapHandler() {
|
|
|
|
- // const center = this.map.getCenter()
|
|
|
|
- // this.form.longitude = center.lng
|
|
|
|
- // this.form.latitude = center.lat
|
|
|
|
- // this.getGeocoder([center.lng, center.lat], 'complete')
|
|
|
|
- // },
|
|
|
|
-
|
|
|
|
// 添加标点
|
|
// 添加标点
|
|
getMarker(lng, lat) {
|
|
getMarker(lng, lat) {
|
|
const icon = new AMap.Icon({
|
|
const icon = new AMap.Icon({
|
|
@@ -282,17 +259,17 @@ export default {
|
|
openOtherApp.postMessage(`?page=${e.value}&longitude=${this.toLng}&latitude=${this.toLat}&name=${this.toName}`)
|
|
openOtherApp.postMessage(`?page=${e.value}&longitude=${this.toLng}&latitude=${this.toLat}&name=${this.toName}`)
|
|
} else {
|
|
} else {
|
|
// 腾讯地图
|
|
// 腾讯地图
|
|
- if (e.id === 1) {
|
|
|
|
|
|
+ if (e.id === 1) {
|
|
url = `https://apis.map.qq.com/uri/v1/routeplan?type=drive&from=我的位置&fromcoord=${this.form.latitude},${this.form.longitude}&to=${this.toName}&tocoord=${this.toLat},${this.toLng}&coord_type=2&referer=猫王妙播Pro`
|
|
url = `https://apis.map.qq.com/uri/v1/routeplan?type=drive&from=我的位置&fromcoord=${this.form.latitude},${this.form.longitude}&to=${this.toName}&tocoord=${this.toLat},${this.toLng}&coord_type=2&referer=猫王妙播Pro`
|
|
}
|
|
}
|
|
|
|
|
|
// 百度地图
|
|
// 百度地图
|
|
- if (e.id === 2) {
|
|
|
|
|
|
+ if (e.id === 2) {
|
|
url = `http://api.map.baidu.com/direction?origin=latlng:${this.form.latitude},${this.form.longitude}|name:我的位置&destination=latlng:${this.toLat},${this.toLng}|name:${this.toName}&mode=driving®ion=${this.province}&output=html&coord_type=gcj02&src=webapp.airsmart.猫王妙播Pro`
|
|
url = `http://api.map.baidu.com/direction?origin=latlng:${this.form.latitude},${this.form.longitude}|name:我的位置&destination=latlng:${this.toLat},${this.toLng}|name:${this.toName}&mode=driving®ion=${this.province}&output=html&coord_type=gcj02&src=webapp.airsmart.猫王妙播Pro`
|
|
}
|
|
}
|
|
|
|
|
|
// 高德地图
|
|
// 高德地图
|
|
- if (e.id === 3) {
|
|
|
|
|
|
+ if (e.id === 3) {
|
|
url = `https://uri.amap.com/navigation?from=${this.form.longitude},${this.form.latitude},我的位置&to=${this.toLng},${this.toLat},${this.toName}&callnative=1`
|
|
url = `https://uri.amap.com/navigation?from=${this.form.longitude},${this.form.latitude},我的位置&to=${this.toLng},${this.toLat},${this.toName}&callnative=1`
|
|
}
|
|
}
|
|
window.location.href = url
|
|
window.location.href = url
|