From 77a33989c4326ec10cbafdabb275c0599b643b7a Mon Sep 17 00:00:00 2001 From: "eleanor.mao" Date: Wed, 2 Apr 2025 22:53:55 +0800 Subject: [PATCH] feat: get phone --- src/http/api.ts | 1 + src/pages/certification/index.less | 29 +++++++++------- src/pages/certification/index.tsx | 38 +++++++++++++-------- src/pages/job-publish/index.tsx | 2 +- src/pages/material-create-profile/index.tsx | 4 ++- src/utils/common.ts | 1 + src/utils/company.ts | 6 ++++ 7 files changed, 52 insertions(+), 29 deletions(-) diff --git a/src/http/api.ts b/src/http/api.ts index a54cc50..382acc9 100644 --- a/src/http/api.ts +++ b/src/http/api.ts @@ -59,6 +59,7 @@ export enum API { GET_VIDEO_INFO = '/file/url/get', // 企业 CERTIFICATION = '/boss/auth', + GET_PHONE = '/user/wx/phone', // 主播 GET_ANCHOR_LIST = '/resume/list', // message diff --git a/src/pages/certification/index.less b/src/pages/certification/index.less index 9aef449..a5d029c 100644 --- a/src/pages/certification/index.less +++ b/src/pages/certification/index.less @@ -42,24 +42,29 @@ } &__verify { - .flex-column(); + .flex-row(); &__input { flex: 1; height: 100px; } - &__code-container { - width: 100%; - .flex-row(); - } + &__update { + flex: 0 0 auto; - &__send { - font-size: 32px; - line-height: 32px; - font-weight: 400; - color: @blHighlightColor; - white-space: nowrap; + button { + font-size: 32px; + line-height: 32px; + font-weight: 400; + color: @blHighlightColor; + white-space: nowrap; + border: none; + background: none; + + &::after { + border: none; + } + } } } @@ -76,4 +81,4 @@ .button(@width: 100%; @height: 80px); margin-bottom: 56px; } -} \ No newline at end of file +} diff --git a/src/pages/certification/index.tsx b/src/pages/certification/index.tsx index 8600697..67e160b 100644 --- a/src/pages/certification/index.tsx +++ b/src/pages/certification/index.tsx @@ -1,4 +1,4 @@ -import { BaseEventOrig, Button, Image, InputProps } from '@tarojs/components'; +import { BaseEventOrig, Button, ButtonProps, Image, InputProps } from '@tarojs/components'; import Taro, { UploadTask } from '@tarojs/taro'; import { useCallback, useEffect, useState } from 'react'; @@ -13,7 +13,7 @@ import { CollectEventName, ReportEventId } from '@/constants/event'; import useUserInfo from '@/hooks/use-user-info'; import { ICertificationRequest } from '@/types/company'; import { isValidIdCard, isValidPhone, logWithPrefix } from '@/utils/common'; -import { postCertification } from '@/utils/company'; +import { postCertification, getPhone } from '@/utils/company'; import { collectEvent, reportEvent } from '@/utils/event'; import { chooseMedia } from '@/utils/material'; import { redirectTo } from '@/utils/route'; @@ -92,6 +92,7 @@ const uploadIdCard = async () => { export default function Certification() { const { phone } = useUserInfo(); + const [revisedPhone, setRevisedPhone] = useState('') const [leftIdCardUrl, setLeftIdCardUrl] = useState(''); const [rightIdCardUrl, setRightIdCardUrl] = useState(''); const [name, setName] = useState(''); @@ -137,7 +138,7 @@ export default function Certification() { const data: ICertificationRequest = { name, // code, - phone, + phone: revisedPhone || phone, idCardNo: idNumber, companyName: company, // idCardSideAUrl: leftIdCardUrl, @@ -164,9 +165,23 @@ export default function Certification() { } finally { setOpen(false); } - }, [name, idNumber, phone, company]); + }, [name, idNumber, phone, revisedPhone, company]); // }, [leftIdCardUrl, rightIdCardUrl, name, idNumber, phone, company]); + const handleGetPhoneNumber = async (e: BaseEventOrig) => { + if (e.detail.code) { + try { + + const { phoneNumber } = await getPhone(e.detail.code); + setRevisedPhone(phoneNumber) + } catch (e) { + Toast.error('获取手机号失败'); + } + } else { + Toast.error('获取手机号失败'); + } + }; + useEffect(() => { if (phone) { return; @@ -222,17 +237,10 @@ export default function Certification() { - - {/*
- -
获取验证码
-
*/} + +
+ +
diff --git a/src/pages/job-publish/index.tsx b/src/pages/job-publish/index.tsx index 66410ba..c25c5f0 100644 --- a/src/pages/job-publish/index.tsx +++ b/src/pages/job-publish/index.tsx @@ -19,7 +19,7 @@ import { EMPLOY_TYPE_TITLE_MAP, EmployType, JOB_TYPE_SELECT_OPTIONS, JobType } f import { CreateJobInfo, JobDetails } from '@/types/job'; import { logWithPrefix } from '@/utils/common'; import { collectEvent } from '@/utils/event'; -import { postCloseJob, postCreateJob, postUpdateJob, postPublishJob, requestJobDetail, isFullTimePriceRequired, isPartTimePriceRequired } from '@/utils/job'; +import { postCloseJob, postCreateJob, postUpdateJob, requestJobDetail, isFullTimePriceRequired, isPartTimePriceRequired } from '@/utils/job'; import { getCityValues } from '@/utils/location'; import { getPageQuery, navigateBack, navigateTo } from '@/utils/route'; import Toast from '@/utils/toast'; diff --git a/src/pages/material-create-profile/index.tsx b/src/pages/material-create-profile/index.tsx index 866cf8a..648bdbf 100644 --- a/src/pages/material-create-profile/index.tsx +++ b/src/pages/material-create-profile/index.tsx @@ -18,6 +18,7 @@ import { isFullTimePriceRequired, isPartTimePriceRequired } from '@/utils/job'; import { updateProfile, subscribeMaterialMessage } from '@/utils/material'; import { navigateBack } from '@/utils/route'; import Toast from '@/utils/toast'; +import useLocation from '@/hooks/use-location'; import './index.less'; @@ -73,6 +74,7 @@ const isValidFormData = (type: ProfileGroupType, data: Partial) }; export default function MaterialCreateProfile() { + const location = useLocation(); const [groupType, setGroupType] = useState(ProfileGroupType.Intention); const ref = useRef<{ getData: () => Partial } | null>(null); const ProfileFragment = @@ -121,7 +123,7 @@ export default function MaterialCreateProfile() { return (
- +