feat: get phone
This commit is contained in:
parent
d25187c9c8
commit
77a33989c4
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<ButtonProps.onGetRealTimePhoneNumberEventDetail>) => {
|
||||
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() {
|
||||
<BlFormInput value={idNumber} onInput={handleInputIdNumber} type="idcard" maxlength={18} />
|
||||
</BlFormItem>
|
||||
<BlFormItem title="手机号" subTitle="请使用本人名下的手机号" contentClassName={`${PREFIX}__verify`} dynamicHeight>
|
||||
<BlFormInput className={`${PREFIX}__verify__input`} value={phone} type="number" maxlength={11} disabled />
|
||||
{/* <div className={`${PREFIX}__verify__code-container`}>
|
||||
<BlFormInput
|
||||
className={`${PREFIX}__verify__input`}
|
||||
value={code}
|
||||
onInput={handleInputCode}
|
||||
type="number"
|
||||
maxlength={8}
|
||||
/>
|
||||
<div className={`${PREFIX}__verify__send`}>获取验证码</div>
|
||||
</div> */}
|
||||
<BlFormInput className={`${PREFIX}__verify__input`} value={revisedPhone || phone} type="number" maxlength={11} disabled />
|
||||
<div className={`${PREFIX}__verify__update`}>
|
||||
<Button openType="getRealtimePhoneNumber" onGetRealTimePhoneNumber={handleGetPhoneNumber}>修改</Button>
|
||||
</div>
|
||||
</BlFormItem>
|
||||
<BlFormItem title="公司全称" subTitle={false}>
|
||||
<BlFormInput maxlength={200} value={company} onInput={handleInputCompany} />
|
||||
|
@ -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';
|
||||
|
@ -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<MaterialProfile>)
|
||||
};
|
||||
|
||||
export default function MaterialCreateProfile() {
|
||||
const location = useLocation();
|
||||
const [groupType, setGroupType] = useState<ProfileGroupType>(ProfileGroupType.Intention);
|
||||
const ref = useRef<{ getData: () => Partial<MaterialProfile> } | null>(null);
|
||||
const ProfileFragment =
|
||||
@ -121,7 +123,7 @@ export default function MaterialCreateProfile() {
|
||||
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
<ProfileFragment ref={ref} profile={{}} />
|
||||
<ProfileFragment ref={ref} profile={{cityCodes: location.cityCode || '' }} />
|
||||
<SafeBottomPadding />
|
||||
<div className={`${PREFIX}__footer`}>
|
||||
<Button className={`${PREFIX}__submit-btn`} onClick={handleSubmit}>
|
||||
|
@ -1,6 +1,7 @@
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
export const isDev = () => process.env.NODE_ENV === 'development';
|
||||
// export const isDev = () => true;
|
||||
|
||||
export const isIPhone = (() => {
|
||||
const info = Taro.getSystemInfoSync();
|
||||
|
@ -8,3 +8,9 @@ export const postCertification = async (data: ICertificationRequest) => {
|
||||
await requestUserInfo();
|
||||
return result;
|
||||
};
|
||||
|
||||
export const getPhone = async(code: string): Promise<{phoneNumber: string}> => {
|
||||
const result = await http.post<{ code :string }>(API.GET_PHONE, { data: {code} });
|
||||
return result;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user