修复bug
This commit is contained in:
@@ -55,37 +55,34 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getLocation () {
|
getLocation () {
|
||||||
alert(2)
|
this.injectJWeixin(['getLocation']).then(() => {
|
||||||
this.injectJWeixin(['getLocation']).then(() => {
|
wx.getLocation({
|
||||||
alert(232432)
|
type: 'wgs84',
|
||||||
wx.getLocation({
|
success: res => {
|
||||||
type: 'wgs84',
|
var lat = res.latitude
|
||||||
success: res => {
|
var lng = res.longitude
|
||||||
var lat = res.latitude
|
this.$http.post('/api/appdvcpconfig/apiForward', `https://apis.map.qq.com/ws/geocoder/v1/?location=${lat},${lng}&key=3RZBZ-LZUCF-CT6J5-NWKZH-FCWOQ-UUFKY&get_poi=1`).then(res => {
|
||||||
var lng = res.longitude
|
if (res.code === 0) {
|
||||||
this.$http.post('/api/appdvcpconfig/apiForward', `https://apis.map.qq.com/ws/geocoder/v1/?location=${lat},${lng}&key=3RZBZ-LZUCF-CT6J5-NWKZH-FCWOQ-UUFKY&get_poi=1`).then(res => {
|
const data = res.data.result
|
||||||
if (res.code === 0) {
|
uni.setStorageSync('address', {
|
||||||
const data = res.data.result
|
lat,
|
||||||
uni.setStorageSync('address', {
|
lng,
|
||||||
lat,
|
address: data.address,
|
||||||
lng,
|
cityCode: `${data.ad_info.adcode}`
|
||||||
address: data.address,
|
})
|
||||||
cityCode: `${data.ad_info.adcode}`
|
|
||||||
})
|
|
||||||
|
|
||||||
alert(JSON.stringify(data))
|
alert(JSON.stringify(data))
|
||||||
|
|
||||||
this.getWeather(`${data.ad_info.adcode}`)
|
this.getWeather(`${data.ad_info.adcode}`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
error: res => {
|
error: res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
}
|
}
|
||||||
})
|
|
||||||
}).catch(e => {
|
|
||||||
alert(JSON.stringify(e))
|
|
||||||
})
|
})
|
||||||
|
}).catch(e => {
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getWeather (code) {
|
getWeather (code) {
|
||||||
|
|||||||
Reference in New Issue
Block a user