From 0470145fcd755d3f87bffc7a985bd3cc82c5f3f6 Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期一, 10 二月 2025 16:30:40 +0800 Subject: [PATCH] feat: init --- apps/cMiniApp/src/hooks/user.ts | 84 +----------------------------------------- 1 files changed, 2 insertions(+), 82 deletions(-) diff --git a/apps/cMiniApp/src/hooks/user.ts b/apps/cMiniApp/src/hooks/user.ts index cb81e5e..f104353 100644 --- a/apps/cMiniApp/src/hooks/user.ts +++ b/apps/cMiniApp/src/hooks/user.ts @@ -1,11 +1,7 @@ import { useUserStore } from '@/stores/modules/user'; import Taro from '@tarojs/taro'; import { object2query, LocationUtils } from '@12333/utils'; -import { - ParkOrHRStatus, - UserCertificationFrontStatus, - MatchMakingIdentityEnum, -} from '@12333/constants'; +import { ParkOrHRStatus, UserCertificationFrontStatus } from '@12333/constants'; import * as userServices from '@12333/services/api/User'; import { useQuery } from '@tanstack/vue-query'; import { MaybeRef } from 'vue'; @@ -14,8 +10,7 @@ export function useUser() { const userStore = useUserStore(); - const { userDetail, userInfo, matchMakingIdentity, isSetMatchMakingIdentity, locationCity } = - storeToRefs(userStore); + const { userDetail, userInfo, locationCity } = storeToRefs(userStore); function updateUserInfo() { return userStore.getCurrentUserInfo(); @@ -47,8 +42,6 @@ isCompletePersonalInfo, isCompanyAudited, isCertified, - matchMakingIdentity, - isSetMatchMakingIdentity, locationCity, }; } @@ -111,77 +104,4 @@ return { goLoginFn, }; -} - -type UseUserTotalInfoOptions = { - userId: MaybeRef<string>; - enabled?: MaybeRef<boolean>; -}; - -export function useUserTotalInfo({ userId, enabled = true }: UseUserTotalInfoOptions) { - const { data, refetch } = useQuery({ - queryKey: ['userServices/getUserTotalInfo', userId], - queryFn: async () => { - return await userServices.getUserTotalInfo( - { - userId: unref(userId), - }, - { showLoading: false } - ); - }, - placeholderData: () => ({} as API.GetUserTotalInfoOutput), - enabled: computed(() => unref(enabled) && !!unref(userId)), - }); - - useRefeshDidShow({ queryKey: ['userServices/getUserTotalInfo', userId] }); - - return { - userTotalInfo: data, - refetch, - }; -} - -export function useUserSimpleInfo({ userId }: UseUserTotalInfoOptions) { - const { data, refetch } = useQuery({ - queryKey: ['userServices/getUserSimpleInfo', userId], - queryFn: async () => { - return await userServices.getUserSimpleInfo( - { - userId: unref(userId), - }, - { showLoading: false } - ); - }, - placeholderData: () => ({} as API.UserSimpleInfo), - enabled: computed(() => !!unref(userId)), - }); - - return { - userSimpleInfo: data, - }; -} - -type UseToggleMatchMakingIdentityOnLaunchOptions = { - matchMakingIdentity: MatchMakingIdentityEnum; -}; - -export function useToggleMatchMakingIdentityOnLaunch({ - matchMakingIdentity, -}: UseToggleMatchMakingIdentityOnLaunchOptions) { - const launchOptions = Taro.getEnterOptionsSync(); - console.log('launchOptions: ', launchOptions); - - const userStore = useUserStore(); - const { userDetail } = useUser(); - - onMounted(async () => { - try { - if (launchOptions.scene === 1037) { - await userStore.setMatchMakingIdentity({ - matchMakingIdentity: matchMakingIdentity, - userId: userDetail.value?.userId, - }); - } - } catch (error) {} - }); } -- Gitblit v1.9.1