This commit is contained in:
2023-10-16 13:38:28 +08:00
parent a94dc0b6b8
commit d48b754b90

View File

@ -31,11 +31,47 @@
};
},
onShow() {
let location = uni.getStorageSync('location')
if (!location) {
this.getAddress()
}
this.phonecode = undefined
this.logincode = undefined
// this.scenenurseStationId = uni.getStorageSync('scenenurseStationId');
},
methods: {
//
getAddress() {
let that = this;
uni.getLocation({
type: 'wgs84',
success: (res) => {
let location = res.latitude + ',' + res.longitude
//
uni.request({
url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=location', //
data: {
location: location,
'key': "Q4DBZ-UIMC2-B63UX-CUZ6A-S3UT7-TBF3V", //Key
},
method: "GET",
success(res) {
uni.setStorageSync('location', res.data.result.address_component.city)
},
fail: res => {
console.log(res.errMsg, '解析失败返回的错误信息');
}
})
},
//
fail: (res) => {
uni.showToast({
icon: 'none',
title: '获取地址失败,请打开定位',
})
}
})
},
getPhoneNumberp(val) {
let that = this;
if (val.detail.code) {