From e7f0a81e522574957b754623996553cb43ad58a5 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 11 八月 2025 18:44:18 +0800
Subject: [PATCH] fix: 修改登录
---
apps/cMiniApp/src/hooks/user.ts | 98 +++++++-----------------------------------------
1 files changed, 15 insertions(+), 83 deletions(-)
diff --git a/apps/cMiniApp/src/hooks/user.ts b/apps/cMiniApp/src/hooks/user.ts
index cb81e5e..4238c51 100644
--- a/apps/cMiniApp/src/hooks/user.ts
+++ b/apps/cMiniApp/src/hooks/user.ts
@@ -1,21 +1,16 @@
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 * as userServices from '@12333/services/api/User';
+import { ParkOrHRStatus, UserCertificationFrontStatus } from '@12333/constants';
import { useQuery } from '@tanstack/vue-query';
import { MaybeRef } from 'vue';
import { useRefeshDidShow } from '@12333/hooks/infiniteLoading';
+import * as userResumeServices from '@12333/services/apiV2/userResume';
export function useUser() {
const userStore = useUserStore();
- const { userDetail, userInfo, matchMakingIdentity, isSetMatchMakingIdentity, locationCity } =
- storeToRefs(userStore);
+ const { userDetail, userInfo, locationCity, userId } = storeToRefs(userStore);
function updateUserInfo() {
return userStore.getCurrentUserInfo();
@@ -47,9 +42,8 @@
isCompletePersonalInfo,
isCompanyAudited,
isCertified,
- matchMakingIdentity,
- isSetMatchMakingIdentity,
locationCity,
+ userId,
};
}
@@ -74,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({
@@ -113,75 +95,25 @@
};
}
-type UseUserTotalInfoOptions = {
- userId: MaybeRef<string>;
- enabled?: MaybeRef<boolean>;
-};
+export function useUserResume() {
+ const { userId } = useUser();
-export function useUserTotalInfo({ userId, enabled = true }: UseUserTotalInfoOptions) {
const { data, refetch } = useQuery({
- queryKey: ['userServices/getUserTotalInfo', userId],
+ queryKey: ['userResumeServices/getUserResume', userId],
queryFn: async () => {
- return await userServices.getUserTotalInfo(
+ return await userResumeServices.getUserResume(
+ { userId: userId.value },
{
- userId: unref(userId),
- },
- { showLoading: false }
+ showLoading: false,
+ }
);
},
- placeholderData: () => ({} as API.GetUserTotalInfoOutput),
- enabled: computed(() => unref(enabled) && !!unref(userId)),
+ placeholderData: () => ({} as API.GetUserResumeQueryResult),
+ enabled: computed(() => !!userId.value),
});
- useRefeshDidShow({ queryKey: ['userServices/getUserTotalInfo', userId] });
-
return {
- userTotalInfo: data,
+ userResumeInfo: 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