From c696e93bc5e324392f894c4f3126ef845859d19e Mon Sep 17 00:00:00 2001 From: chashaobao Date: Wed, 17 Dec 2025 00:10:53 +0800 Subject: [PATCH] feat: --- src/components/login-button/index.tsx | 6 ++++-- src/pages/job-detail/index.tsx | 20 ++++++++++++++++++-- src/utils/group.ts | 5 ++++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/components/login-button/index.tsx b/src/components/login-button/index.tsx index 05c7d5f..b5c1697 100644 --- a/src/components/login-button/index.tsx +++ b/src/components/login-button/index.tsx @@ -19,13 +19,14 @@ export enum BindPhoneStatus { export interface ILoginButtonProps extends ButtonProps { needPhone?: boolean; needRefresh?: boolean; + onRefresh?: (() => void) | (() => Promise); needAssignment?: boolean; } const PREFIX = 'login-button'; function LoginButton(props: ILoginButtonProps) { - const { className, children, needPhone, onClick, needRefresh, ...otherProps } = props; + const { className, children, needPhone, onRefresh, onClick, needRefresh, ...otherProps } = props; const userInfo = useUserInfo(); const [loginVisible, setLoginVisible] = useState(false); const [assignVisible, setAssignVisible] = useState(false); @@ -69,10 +70,11 @@ function LoginButton(props: ILoginButtonProps) { }, []); const handleLoginSuccess = useCallback( - e => { + async e => { setLoginVisible(false); if (needRefresh) { requestUserInfo(); + onRefresh && (await onRefresh()); } onClick?.(e); }, diff --git a/src/pages/job-detail/index.tsx b/src/pages/job-detail/index.tsx index 10d2009..d0a3186 100644 --- a/src/pages/job-detail/index.tsx +++ b/src/pages/job-detail/index.tsx @@ -82,9 +82,16 @@ const AnchorFooter = (props: { data: JobDetails }) => { setProductRecord(result); }, [data.id]); - const getProductBalance = useCallback(async () => { + const getProductBalance = useCallback(async (loading?: boolean) => { + if (loading) { + Taro.showLoading(); + } const [, resp] = await requestProductBalance(ProductType.VIP); setProductInfo(resp); + console.log(resp); + if (loading) { + Taro.hideLoading(); + } return resp; }, []); @@ -179,6 +186,10 @@ const AnchorFooter = (props: { data: JobDetails }) => { // return productInfo?.isCreateResume? '升级会员即可查看': '创建模卡,免费查看'; // }, [productInfo, haveSeen]); + const handleRefresh = useCallback(async () => { + await getProductBalance(true); + }, [getProductBalance]); + useEffect(() => { Taro.eventCenter.on(EventName.CREATE_PROFILE, getProductBalance); return () => { @@ -200,7 +211,12 @@ const AnchorFooter = (props: { data: JobDetails }) => { - + {data.isAuthed ? '在线沟通' : '查看联系方式'} {needPhone ? (
登录后可免费报单
diff --git a/src/utils/group.ts b/src/utils/group.ts index b9a7db7..c3b5371 100644 --- a/src/utils/group.ts +++ b/src/utils/group.ts @@ -51,5 +51,8 @@ export const requestBatchPublishGroups = async () => { }; export const requestSimpleGroupList = async (cityCode?: string) => { - return http.post(API.SIMPLE_GROUP_LIST, { data: { cityCode } }); + return http.post(API.SIMPLE_GROUP_LIST, { + data: { cityCode }, + contentType: 'application/x-www-form-urlencoded', + }); };