zhengyiming
6 天以前 5eb6e6bab29554390851bbed86615110e62efa48
apps/cMiniApp/src/hooks/user.ts
@@ -10,7 +10,7 @@
export function useUser() {
  const userStore = useUserStore();
  const { userDetail, userInfo, locationCity } = storeToRefs(userStore);
  const { userDetail, userInfo, locationCity, userId } = storeToRefs(userStore);
  function updateUserInfo() {
    return userStore.getCurrentUserInfo();
@@ -43,6 +43,7 @@
    isCompanyAudited,
    isCertified,
    locationCity,
    userId,
  };
}
@@ -67,20 +68,8 @@
  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({