Commit c0db64a0 authored by 前端-许佳敏's avatar 前端-许佳敏

对接注册接口

parent 9743ea94
/**
* 正则表达式集合
*/
export const PATTERN_MAPS = {
// 8-20位, 大小写字幕 + 数字组合
password: /^(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{8,20}$/,
email: /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/,
phone: /^1[3|4|5|6|7|8|9][0-9]{9}$/,
smsCode: /^\d{6}$/
}
\ No newline at end of file
......@@ -16,6 +16,9 @@ import { FormStep, FormBlock, Input, Password, Checkbox } from '@formily/antd-co
import SchemaForm, { Field, FormMegaLayout, FormButtonGroup, createFormActions, FormEffectHooks } from '@formily/antd';
import useCountDown from '@/utils/hooks';
import { GlobalConfig } from '@/global/config';
import { omit } from '@/utils';
import { postUserRegister } from '@/services/user';
import { PATTERN_MAPS } from '@/constants/regExp';
const { TextArea } = Input;
const Step = Steps.Step
......@@ -196,11 +199,11 @@ const UserRegistry = () => {
})
const handleActionBtn = () => {
actions.dispatch('onFormStepNext', () => {
// 校验后触发跳转
actions.validate('*').then(data => {
actions.dispatch('onFormStepNext', {})
setCurrent(current + 1)
})
// FormStep
// FormStep.onStepNext$()
}
const mapMemberType = GlobalConfig.userRegister.useType.memberType.map(v => {
return {
......@@ -222,7 +225,10 @@ const UserRegistry = () => {
formCache = Object.assign(values, formCache)
// 写死传入的区号
formCache.countryCode = '+86'
console.log(formCache)
const params = omit(formCache, ['isRead', 'confirmPassword'])
postUserRegister(params).then(() => {
console.log('register success')
})
})
}
return (
......@@ -231,6 +237,7 @@ const UserRegistry = () => {
<div className={cx(styles.registerBox, globalStyles.lingxiBusinessMarginContent)}>
<div>
<SchemaForm
name='registerForm'
actions={actions}
components={{
Input,
......@@ -252,11 +259,11 @@ const UserRegistry = () => {
>
</FormStep>
<FormMegaLayout className={styles.registerForm} name='message'>
<Field name="phone" x-rules={{required: true, pattern: /^1[3|4|5|6|7|8|9][0-9]{9}$/}} x-component-props={{placeholder: '请输入你的手机号码', size: 'large'}} x-props={{addonBefore: <div className={styles.formBefore}>+86</div>}} x-component="Input" />
<Field name="smsCode" x-rules={{required: true, pattern: /^\d{6}$/}} x-component-props={{ size: 'large', style: {width: 220}}} x-props={{addonAfter: <Button disabled={isActive} style={{minWidth: 110, marginLeft: 8}} size='large' onClick={start}>{text}</Button>}} x-component="Input" />
<Field name="password" x-rules={{required: true}} x-component-props={{ placeholder: '设置你的登录密码', size: 'large'}} x-component="Password" />
<Field name="phone" x-rules={{required: true, pattern: PATTERN_MAPS.phone}} x-component-props={{placeholder: '请输入你的手机号码', size: 'large'}} x-props={{addonBefore: <div className={styles.formBefore}>+86</div>}} x-component="Input" />
<Field name="smsCode" x-rules={{required: true, pattern: PATTERN_MAPS.smsCode}} x-component-props={{ size: 'large', style: {width: 220}}} x-props={{addonAfter: <Button disabled={isActive} style={{minWidth: 110, marginLeft: 8}} size='large' onClick={start}>{text}</Button>}} x-component="Input" />
<Field name="password" x-rules={{required: true, pattern: PATTERN_MAPS.password}} x-component-props={{ placeholder: '设置你的登录密码', size: 'large'}} x-component="Password" />
<Field name="confirmPassword" x-rules={{required: true}} x-component-props={{ placeholder: '请再次输入你的登录密码',size: 'large'}} x-component="Password" />
<Field name="email" x-rules={{message: '请输入正确的邮箱', pattern: /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/}} x-component-props={{ placeholder: '请输入你的邮箱(选填)',size: 'large', type: 'email'}} x-component="Input" />
<Field name="email" x-rules={{message: '请输入正确的邮箱', pattern: PATTERN_MAPS.email}} x-component-props={{ placeholder: '请输入你的邮箱(选填)',size: 'large', type: 'email'}} x-component="Input" />
<Field name="isRead" x-rules={{message: '请勾选', required: true}} x-component-props={{
children:<span style={{fontSize: 12}}>阅读并同意<span className='commonPickColor'>《会员服务协议》《法律条款》《隐私政策》</span></span>
}} x-component="CheckBoxSingle" />
......
declare namespace UserModalApi {
interface registerModal {
countryCode: string;
phone: string;
smsCode: string;
password: string;
email?: string;
typeId: number;
businessTypeId: number;
detail: {
[key: string]: any
}
}
}
\ No newline at end of file
import request from '@/utils/request';
const prefix = '/member/merchant'
/**
* @description 用户基础注册接口
* @param {MemberApi.RegisterBasicModel} params
* @todo 注册接口
*/
export async function postUserRegister(params: UserModalApi.registerModal) {
return request('/member/register', {
method: 'post',
data: params
})
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment