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