|  |  | 
 |  |  | import { useUserStore } from '@/stores/modules/user'; | 
 |  |  | import Taro from '@tarojs/taro'; | 
 |  |  | import { object2query, LocationUtils } from '@12333/utils'; | 
 |  |  | import { ParkOrHRStatus, UserCertificationFrontStatus } from '@12333/constants'; | 
 |  |  | import * as userServices from '@12333/services/api/User'; | 
 |  |  | import { useQuery } from '@tanstack/vue-query'; | 
 |  |  | import { | 
 |  |  |   EnumUserBankCardAccess, | 
 |  |  |   ParkOrHRStatus, | 
 |  |  |   UserCertificationFrontStatus, | 
 |  |  | } from '@12333/constants'; | 
 |  |  | import { useQuery, useQueryClient } from '@tanstack/vue-query'; | 
 |  |  | import { MaybeRef } from 'vue'; | 
 |  |  | import { useRefeshDidShow } from '@12333/hooks/infiniteLoading'; | 
 |  |  | import * as userResumeServices from '@12333/services/apiV2/userResume'; | 
 |  |  | import { useUserResume as useUserResumeHook } from '@12333/hooks'; | 
 |  |  |  | 
 |  |  | export function useUser() { | 
 |  |  |   const userStore = useUserStore(); | 
 |  |  |  | 
 |  |  |   const { userDetail, userInfo, locationCity } = storeToRefs(userStore); | 
 |  |  |   const { userDetail, userInfo, locationCity, userId } = storeToRefs(userStore); | 
 |  |  |  | 
 |  |  |   function updateUserInfo() { | 
 |  |  |     return userStore.getCurrentUserInfo(); | 
 |  |  |   } | 
 |  |  |  | 
 |  |  |   const isCompanyAudited = computed(() => { | 
 |  |  |     return userDetail.value?.openHRSiteStatus === ParkOrHRStatus.Running; | 
 |  |  |   }); | 
 |  |  |  | 
 |  |  |   /** | 
 |  |  |    * 是否完善个人信息(企业名称,手机号) | 
 |  |  |    */ | 
 |  |  |   const isCompletePersonalInfo = computed(() => { | 
 |  |  |     return ( | 
 |  |  |       !!userDetail.value?.customerName && | 
 |  |  |       !!userDetail.value?.contacter && | 
 |  |  |       !!userDetail.value?.cityName | 
 |  |  |     ); | 
 |  |  |   }); | 
 |  |  |  | 
 |  |  |   const isCertified = computed(() => { | 
 |  |  |     return userDetail.value?.frontStatus === UserCertificationFrontStatus.Certified; | 
 |  |  |     return userDetail.value?.isReal; | 
 |  |  |   }); | 
 |  |  |  | 
 |  |  |   const isBindBank = computed(() => { | 
 |  |  |     return userDetail.value?.bankCardAAccesses?.includes(EnumUserBankCardAccess.Bank); | 
 |  |  |   }); | 
 |  |  |  | 
 |  |  |   const isBindAlipay = computed(() => { | 
 |  |  |     return userDetail.value?.bankCardAAccesses?.includes(EnumUserBankCardAccess.AliPay); | 
 |  |  |   }); | 
 |  |  |  | 
 |  |  |   const isBindWechat = computed(() => { | 
 |  |  |     return userDetail.value?.bankCardAAccesses?.includes(EnumUserBankCardAccess.WeChatPay); | 
 |  |  |   }); | 
 |  |  |  | 
 |  |  |   return { | 
 |  |  |     user: userInfo, | 
 |  |  |     userDetail: userDetail, | 
 |  |  |     updateUserInfo, | 
 |  |  |     isCompletePersonalInfo, | 
 |  |  |     isCompanyAudited, | 
 |  |  |     isCertified, | 
 |  |  |     locationCity, | 
 |  |  |     userId, | 
 |  |  |     isBindBank, | 
 |  |  |     isBindAlipay, | 
 |  |  |     isBindWechat, | 
 |  |  |   }; | 
 |  |  | } | 
 |  |  |  | 
 |  |  | 
 |  |  |   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({ | 
 |  |  | 
 |  |  |     goLoginFn, | 
 |  |  |   }; | 
 |  |  | } | 
 |  |  |  | 
 |  |  | export function useUserResume() { | 
 |  |  |   const { userId } = useUser(); | 
 |  |  |   return useUserResumeHook({ userId }); | 
 |  |  | } |