定位
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="map">
|
<div class="map">
|
||||||
<div class="build-btn">
|
<!-- <div class="build-btn">
|
||||||
<img src="./components/img/model-icon.png" alt="" @click="toDetail"> 楼栋<br/>模型
|
<img src="./components/img/model-icon.png" alt="" @click="toDetail"> 楼栋<br/>模型
|
||||||
</div>
|
</div> -->
|
||||||
<div class="build-btn locate">
|
<!-- <div class="build-btn locate">
|
||||||
<img src="https://cdn.cunwuyun.cn/dvcp/h5/Location2.png" alt="" @click="getLocale"/>
|
<img src="https://cdn.cunwuyun.cn/dvcp/h5/Location2.png" alt="" @click="getLocale"/>
|
||||||
当前<br>位置
|
当前<br>位置
|
||||||
</div>
|
</div> -->
|
||||||
<div class="map-content">
|
<div class="map-content">
|
||||||
<AiTMap v-if="user.areaId" :areaId="user.areaId" :map.sync="map" :lib.sync="lib" :ops="ops"
|
<AiTMap v-if="user.areaId" :areaId="user.areaId" :map.sync="map" :lib.sync="lib" :ops="ops"
|
||||||
:libraries="['service', 'tools']"/>
|
:libraries="['service', 'tools']"/>
|
||||||
@@ -92,15 +92,18 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getLocale() {
|
getLocale() {
|
||||||
|
|
||||||
wx.getLocation({
|
wx.getLocation({
|
||||||
type: 'gcj02',
|
type: 'gcj02',
|
||||||
success: res => {
|
success: res => {
|
||||||
|
console.log(res)
|
||||||
let {latitude: lat, longitude: lng} = res
|
let {latitude: lat, longitude: lng} = res
|
||||||
this.handleMapClick({latlng: {lat, lng}})
|
this.handleMapClick({latlng: {lat, lng}})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleMapClick(evt) {
|
handleMapClick(evt) {
|
||||||
|
console.log(evt.latLng)
|
||||||
let {lib: TMap, map} = this
|
let {lib: TMap, map} = this
|
||||||
if (this.markerLayer) {
|
if (this.markerLayer) {
|
||||||
this.markerLayer.setMap(null);
|
this.markerLayer.setMap(null);
|
||||||
@@ -109,7 +112,7 @@ export default {
|
|||||||
this.markerLayer.add({
|
this.markerLayer.add({
|
||||||
position: evt.latLng
|
position: evt.latLng
|
||||||
});
|
});
|
||||||
this.latLng = evt.latlng
|
this.latLng = evt.latLng
|
||||||
},
|
},
|
||||||
confirm() {
|
confirm() {
|
||||||
if (!this.latLng.lat) {
|
if (!this.latLng.lat) {
|
||||||
|
|||||||
Reference in New Issue
Block a user