This commit is contained in:
2023-10-27 14:26:51 +08:00
parent 8ed8cca8d7
commit 5d5dbdbdac
2 changed files with 11 additions and 4 deletions

View File

@ -100,7 +100,6 @@
}, },
onShow() { onShow() {
this.address = uni.getStorageSync('location') this.address = uni.getStorageSync('location')
console.log(this.address, '000')
if (this.address == '德州市') { if (this.address == '德州市') {
uni.setStorageSync("region", 1) uni.setStorageSync("region", 1)
} else if (this.address == '东营市') { } else if (this.address == '东营市') {

View File

@ -32,7 +32,8 @@
}, },
onShow() { onShow() {
let location = uni.getStorageSync('location') let location = uni.getStorageSync('location')
if (!location) { let region = uni.getStorageSync('region')
if (!location || !region) {
this.getAddress() this.getAddress()
} }
this.phonecode = undefined this.phonecode = undefined
@ -57,6 +58,14 @@
method: "GET", method: "GET",
success(res) { success(res) {
uni.setStorageSync('location', res.data.result.address_component.city) uni.setStorageSync('location', res.data.result.address_component.city)
var address = uni.getStorageSync('location')
if (address == '德州市') {
uni.setStorageSync("region", 1)
} else if (address == '东营市') {
uni.setStorageSync("region", 2)
} else if (address == '济南市') {
uni.setStorageSync("region", 3)
}
}, },
fail: res => { fail: res => {
console.log(res.errMsg, '解析失败返回的错误信息'); console.log(res.errMsg, '解析失败返回的错误信息');
@ -115,7 +124,6 @@
delta: 1 delta: 1
}) })
}, 500) }, 500)
console.log("9999")
} else { } else {
that.$refs.uToast.show({ that.$refs.uToast.show({
title: '登录失败', title: '登录失败',
@ -162,4 +170,4 @@
<style lang="scss"> <style lang="scss">
@import "./login.scss"; @import "./login.scss";
</style> </style>