Conf(地图):使用天地图定位获取省市区

This commit is contained in:
lifizer
2026-01-05 11:03:48 +08:00
parent f4fcc7e8f5
commit 1780c4ff0a
12 changed files with 115 additions and 364 deletions
+9 -8
View File
@@ -901,17 +901,18 @@ export default {
})
},
async getMapData() {
let location = uni.getStorageSync('location')
const location = uni.getStorageSync('location')
if (location.length === 0) {
const map = await getLocation()
if (map.length > 1) {
const {latitude, longitude} = map[1]
let address = await getCurAddress(latitude, longitude)
address = address[1].data.result.ad_info
location = address.province + address.city + address.district
getCurAddress(latitude, longitude, address => {
this.postAddress = address.formattedAddress
})
}
} else {
this.postAddress = location
}
this.postAddress = location
},
// 获取当前位置经纬度
handleLoacation(toast) {
@@ -923,9 +924,9 @@ export default {
const map = await getLocation();
if (map.length > 1) {
const {latitude, longitude} = map[1]
let address = await getCurAddress(latitude, longitude)
address = address[1].data.result.ad_info
that.postAddress = address.province + address.city + address.district
getCurAddress(latitude, longitude, address => {
that.postAddress = address.formattedAddress
})
}
},
fail: err => {