| | |
| | | export function useUser() { |
| | | const userStore = useUserStore(); |
| | | |
| | | const { userDetail, userInfo, locationCity } = storeToRefs(userStore); |
| | | const { userDetail, userInfo, locationCity, userId } = storeToRefs(userStore); |
| | | |
| | | function updateUserInfo() { |
| | | return userStore.getCurrentUserInfo(); |
| | |
| | | isCompanyAudited, |
| | | isCertified, |
| | | locationCity, |
| | | userId, |
| | | }; |
| | | } |
| | | |
| | |
| | | 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); |
| | | userStore.getCurrentUserInfo(); |
| | | } |
| | | if (needAuth && !isLogin.value) { |
| | | Taro.navigateTo({ |