| | |
| | | const router = Taro.useRouter(); |
| | | |
| | | Taro.useReady(async () => { |
| | | let res; |
| | | try { |
| | | res = await LocationUtils.getLocation(); |
| | | } catch (error) {} |
| | | if (isLogin.value && userStore.firstGetUserDetail) { |
| | | userStore.firstGetUserDetail = false; |
| | | if (LocationUtils.isProvinceChange(userStore.locationProvince)) { |
| | | userStore.resetState(); |
| | | } else { |
| | | userStore.getCurrentUserInfo(); |
| | | } |
| | | } |
| | | if (res?.result?.ad_info?.city && userStore.firstSetLocation) { |
| | | userStore.setLocationCity(res.result.ad_info.city, res.result.ad_info.province); |
| | | } |
| | | if (needAuth && !isLogin.value) { |
| | | Taro.navigateTo({ |