Conf(地图):使用天地图定位获取省市区
This commit is contained in:
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user