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',
|
GET_VIDEO_INFO = '/file/url/get',
|
||||||
// 企业
|
// 企业
|
||||||
CERTIFICATION = '/boss/auth',
|
CERTIFICATION = '/boss/auth',
|
||||||
|
GET_PHONE = '/user/wx/phone',
|
||||||
// 主播
|
// 主播
|
||||||
GET_ANCHOR_LIST = '/resume/list',
|
GET_ANCHOR_LIST = '/resume/list',
|
||||||
// message
|
// message
|
||||||
|
@ -42,24 +42,29 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&__verify {
|
&__verify {
|
||||||
.flex-column();
|
.flex-row();
|
||||||
|
|
||||||
&__input {
|
&__input {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__code-container {
|
&__update {
|
||||||
width: 100%;
|
flex: 0 0 auto;
|
||||||
.flex-row();
|
|
||||||
}
|
|
||||||
|
|
||||||
&__send {
|
button {
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
line-height: 32px;
|
line-height: 32px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: @blHighlightColor;
|
color: @blHighlightColor;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,4 +81,4 @@
|
|||||||
.button(@width: 100%; @height: 80px);
|
.button(@width: 100%; @height: 80px);
|
||||||
margin-bottom: 56px;
|
margin-bottom: 56px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 Taro, { UploadTask } from '@tarojs/taro';
|
||||||
|
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
@ -13,7 +13,7 @@ import { CollectEventName, ReportEventId } from '@/constants/event';
|
|||||||
import useUserInfo from '@/hooks/use-user-info';
|
import useUserInfo from '@/hooks/use-user-info';
|
||||||
import { ICertificationRequest } from '@/types/company';
|
import { ICertificationRequest } from '@/types/company';
|
||||||
import { isValidIdCard, isValidPhone, logWithPrefix } from '@/utils/common';
|
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 { collectEvent, reportEvent } from '@/utils/event';
|
||||||
import { chooseMedia } from '@/utils/material';
|
import { chooseMedia } from '@/utils/material';
|
||||||
import { redirectTo } from '@/utils/route';
|
import { redirectTo } from '@/utils/route';
|
||||||
@ -92,6 +92,7 @@ const uploadIdCard = async () => {
|
|||||||
|
|
||||||
export default function Certification() {
|
export default function Certification() {
|
||||||
const { phone } = useUserInfo();
|
const { phone } = useUserInfo();
|
||||||
|
const [revisedPhone, setRevisedPhone] = useState('')
|
||||||
const [leftIdCardUrl, setLeftIdCardUrl] = useState('');
|
const [leftIdCardUrl, setLeftIdCardUrl] = useState('');
|
||||||
const [rightIdCardUrl, setRightIdCardUrl] = useState('');
|
const [rightIdCardUrl, setRightIdCardUrl] = useState('');
|
||||||
const [name, setName] = useState('');
|
const [name, setName] = useState('');
|
||||||
@ -137,7 +138,7 @@ export default function Certification() {
|
|||||||
const data: ICertificationRequest = {
|
const data: ICertificationRequest = {
|
||||||
name,
|
name,
|
||||||
// code,
|
// code,
|
||||||
phone,
|
phone: revisedPhone || phone,
|
||||||
idCardNo: idNumber,
|
idCardNo: idNumber,
|
||||||
companyName: company,
|
companyName: company,
|
||||||
// idCardSideAUrl: leftIdCardUrl,
|
// idCardSideAUrl: leftIdCardUrl,
|
||||||
@ -164,9 +165,23 @@ export default function Certification() {
|
|||||||
} finally {
|
} finally {
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
}
|
}
|
||||||
}, [name, idNumber, phone, company]);
|
}, [name, idNumber, phone, revisedPhone, company]);
|
||||||
// }, [leftIdCardUrl, rightIdCardUrl, name, idNumber, phone, 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(() => {
|
useEffect(() => {
|
||||||
if (phone) {
|
if (phone) {
|
||||||
return;
|
return;
|
||||||
@ -222,17 +237,10 @@ export default function Certification() {
|
|||||||
<BlFormInput value={idNumber} onInput={handleInputIdNumber} type="idcard" maxlength={18} />
|
<BlFormInput value={idNumber} onInput={handleInputIdNumber} type="idcard" maxlength={18} />
|
||||||
</BlFormItem>
|
</BlFormItem>
|
||||||
<BlFormItem title="手机号" subTitle="请使用本人名下的手机号" contentClassName={`${PREFIX}__verify`} dynamicHeight>
|
<BlFormItem title="手机号" subTitle="请使用本人名下的手机号" contentClassName={`${PREFIX}__verify`} dynamicHeight>
|
||||||
<BlFormInput className={`${PREFIX}__verify__input`} value={phone} type="number" maxlength={11} disabled />
|
<BlFormInput className={`${PREFIX}__verify__input`} value={revisedPhone || phone} type="number" maxlength={11} disabled />
|
||||||
{/* <div className={`${PREFIX}__verify__code-container`}>
|
<div className={`${PREFIX}__verify__update`}>
|
||||||
<BlFormInput
|
<Button openType="getRealtimePhoneNumber" onGetRealTimePhoneNumber={handleGetPhoneNumber}>修改</Button>
|
||||||
className={`${PREFIX}__verify__input`}
|
</div>
|
||||||
value={code}
|
|
||||||
onInput={handleInputCode}
|
|
||||||
type="number"
|
|
||||||
maxlength={8}
|
|
||||||
/>
|
|
||||||
<div className={`${PREFIX}__verify__send`}>获取验证码</div>
|
|
||||||
</div> */}
|
|
||||||
</BlFormItem>
|
</BlFormItem>
|
||||||
<BlFormItem title="公司全称" subTitle={false}>
|
<BlFormItem title="公司全称" subTitle={false}>
|
||||||
<BlFormInput maxlength={200} value={company} onInput={handleInputCompany} />
|
<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 { CreateJobInfo, JobDetails } from '@/types/job';
|
||||||
import { logWithPrefix } from '@/utils/common';
|
import { logWithPrefix } from '@/utils/common';
|
||||||
import { collectEvent } from '@/utils/event';
|
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 { getCityValues } from '@/utils/location';
|
||||||
import { getPageQuery, navigateBack, navigateTo } from '@/utils/route';
|
import { getPageQuery, navigateBack, navigateTo } from '@/utils/route';
|
||||||
import Toast from '@/utils/toast';
|
import Toast from '@/utils/toast';
|
||||||
|
@ -18,6 +18,7 @@ import { isFullTimePriceRequired, isPartTimePriceRequired } from '@/utils/job';
|
|||||||
import { updateProfile, subscribeMaterialMessage } from '@/utils/material';
|
import { updateProfile, subscribeMaterialMessage } from '@/utils/material';
|
||||||
import { navigateBack } from '@/utils/route';
|
import { navigateBack } from '@/utils/route';
|
||||||
import Toast from '@/utils/toast';
|
import Toast from '@/utils/toast';
|
||||||
|
import useLocation from '@/hooks/use-location';
|
||||||
|
|
||||||
import './index.less';
|
import './index.less';
|
||||||
|
|
||||||
@ -73,6 +74,7 @@ const isValidFormData = (type: ProfileGroupType, data: Partial<MaterialProfile>)
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function MaterialCreateProfile() {
|
export default function MaterialCreateProfile() {
|
||||||
|
const location = useLocation();
|
||||||
const [groupType, setGroupType] = useState<ProfileGroupType>(ProfileGroupType.Intention);
|
const [groupType, setGroupType] = useState<ProfileGroupType>(ProfileGroupType.Intention);
|
||||||
const ref = useRef<{ getData: () => Partial<MaterialProfile> } | null>(null);
|
const ref = useRef<{ getData: () => Partial<MaterialProfile> } | null>(null);
|
||||||
const ProfileFragment =
|
const ProfileFragment =
|
||||||
@ -121,7 +123,7 @@ export default function MaterialCreateProfile() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={PREFIX}>
|
<div className={PREFIX}>
|
||||||
<ProfileFragment ref={ref} profile={{}} />
|
<ProfileFragment ref={ref} profile={{cityCodes: location.cityCode || '' }} />
|
||||||
<SafeBottomPadding />
|
<SafeBottomPadding />
|
||||||
<div className={`${PREFIX}__footer`}>
|
<div className={`${PREFIX}__footer`}>
|
||||||
<Button className={`${PREFIX}__submit-btn`} onClick={handleSubmit}>
|
<Button className={`${PREFIX}__submit-btn`} onClick={handleSubmit}>
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
|
|
||||||
export const isDev = () => process.env.NODE_ENV === 'development';
|
export const isDev = () => process.env.NODE_ENV === 'development';
|
||||||
|
// export const isDev = () => true;
|
||||||
|
|
||||||
export const isIPhone = (() => {
|
export const isIPhone = (() => {
|
||||||
const info = Taro.getSystemInfoSync();
|
const info = Taro.getSystemInfoSync();
|
||||||
|
@ -8,3 +8,9 @@ export const postCertification = async (data: ICertificationRequest) => {
|
|||||||
await requestUserInfo();
|
await requestUserInfo();
|
||||||
return result;
|
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