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

暂存

parent 50944c57
import React from 'react'
import { Row, Input, Col, Button } from 'antd';
import useCountDown from '@/utils/hooks';
const Phone = (props) => {
const {text, isActive, start} = useCountDown({
maxTime: 60,
minTime: 0,
initText: '获取验证码',
onEnd: () => {},
decayRate: 1,
delay: 1 * 1000
})
const { value } = props
return (
<Row style={{width: '100%'}}>
<Col flex={1}>
<Input
value={value || ''}
onChange={e => props.mutators.change(e.target.value)}
{...props.props['x-component-props']}
/>
</Col>
<Col style={{marginLeft: 8}}>
<Button disabled={isActive} style={{minWidth: 110, marginLeft: 8}} size='large' onClick={start}>{text}</Button>
</Col>
</Row>
)
}
Phone.defaultProps = {}
Phone.isFieldComponent = true;
export default Phone
\ No newline at end of file
......@@ -18,8 +18,9 @@ import CustomRegistryPhone from './components/CustomRegistryPhone';
import CustomRelevance from './components/CustomRelevance';
import Children from './components/Children';
import CircleBox from './components/CircleBox';
import Phone from './components/Phone';
import './index.less'
import { Input } from '@formily/antd-components';
import { Checkbox } from '@formily/antd-components';
export interface NiceFormProps extends IAntdSchemaFormProps {}
......@@ -78,6 +79,7 @@ const schemaLayout = createControllerBox("schemaLayout", (_props) => {
const NiceForm: React.FC<NiceFormProps> = props => {
const { children, components, ...reset } = props;
const customComponents = {
CheckboxSingle: Checkbox,
CustomUpload,
CustomStatus,
CustomAddArray,
......@@ -93,7 +95,8 @@ const NiceForm: React.FC<NiceFormProps> = props => {
Children,
CircleBox,
SchemaFormButtonGroup,
FlexBox
FlexBox,
Phone
};
const defineComponents = Object.assign(customComponents, components);
......
......@@ -18,3 +18,5 @@ export const Environment_Status = {
3: "APP"
}
// 1是阿里云oss服务器, 2是本地文件服务器
export const UPLOAD_TYPE = isDev ? 2 : 1
\ No newline at end of file
@import './mixins/layout.less';
#root {
// 去除input type为number时的箭头
.ant-input-number-handler-wrap {
display: none;
}
.common_checkbox {
&:hover,
......
......@@ -5,10 +5,9 @@ import {
QuestionCircleOutlined
} from '@ant-design/icons';
import styles from './index.less'
import './index.less'
import globalStyles from '@/global/styles/global.less'
import cx from 'classnames'
import { FormPage } from 'god'
import { IFormControllers, IFormButtonTypes } from 'god/dist/src/form-page'
import { Link, history } from 'umi'
import im_success from '../../../mockStatic/im_success.png'
import { FormStep, FormBlock, Input, Password, Checkbox, setup } from '@formily/antd-components'
......@@ -18,6 +17,8 @@ import { GlobalConfig } from '@/global/config';
import { omit } from '@/utils';
import { PATTERN_MAPS } from '@/constants/regExp';
import { PublicApi } from '@/services/api';
import NiceForm from '@/components/NiceForm';
import { registerStep1Schema } from './schema';
const { TextArea } = Input;
const Step = Steps.Step
......@@ -108,8 +109,14 @@ const UserRegistry = () => {
// }, [])
useEffect(() => {
console.log(current)
actions.setFieldState(`*(REGISTER_STEP${current})`, state => {
state.visible = true
})
actions.setFieldState(`*(!REGISTER_STEP${current})`, state => {
state.visible = false
})
if(current === 3) runTimerJump()
}, [current])
}, [current, actions])
useEffect(() => {
if(time === 0){
clearInterval(timeChange)
......@@ -213,12 +220,67 @@ const UserRegistry = () => {
})
})
}
return (
<div className={cx(styles.register, globalStyles.lingxiBusinessContent1024)}>
<h3>欢迎您注册数商云账号</h3>
<div className={cx(styles.registerBox, globalStyles.lingxiBusinessMarginContent)}>
<Steps current={current} className={styles.stepWrap} size='small'>
{ stepList.map(v => <Steps.Step title={v.title} key={v.key}></Steps.Step>) }
</Steps>
<NiceForm
id='registerForm'
schema={registerStep1Schema}
actions={actions}
effects={() => {
useLinkageValidateEffects()
}}
expressionScope={{
current: false,
phoneBefore: <div className={styles.formBefore}>+86</div>,
smsCodeAfter: <Button disabled={isActive} style={{minWidth: 110, marginLeft: 8}} size='large' onClick={start}>{text}</Button>,
checkBoxChildren: <span style={{fontSize: 12}}>阅读并同意<span className='commonPickColor'>《会员服务协议》《法律条款》《隐私政策》</span></span>
}}
/>
<div className={styles.registerForm}>
{
current === 0 &&
<Button type='primary' className={styles.continueButton} onClick={handleActionBtn}>同意协议并注册</Button>
}
{
current === 1 &&
<Button type='primary' className={styles.continueButton} onClick={nextStepAction}>下一步:继续完善</Button>
}
{
current === 2 &&
<Button type='primary' className={styles.continueButton} onClick={submitForm}>提交注册资料</Button>
}
</div>
{
current === 3 &&
<div className={styles.formBoxStep3}>
<img src={im_success} alt="待审核"/>
<h2>您的注册资料已经提交成功,请等待平台审核</h2>
<div className={styles.description}>
<p>审核结果会以短信通知您</p>
<p>您也可以登录平台查看审核结果</p>
</div>
<p className={styles.guid}>
<span>{time}s 后自动跳转至登录页</span>
<br />
<span><Link to="/user/login">立即跳转</Link></span>
</p>
</div>
}
</div>
</div>
)
return (
<div className={cx(styles.register, globalStyles.lingxiBusinessContent1024)}>
<h3>欢迎您注册数商云账号</h3>
<div className={cx(styles.registerBox, globalStyles.lingxiBusinessMarginContent)}>
<div>
<SchemaForm
<NiceForm
name='registerForm'
actions={actions}
components={{
......@@ -321,7 +383,7 @@ const UserRegistry = () => {
}
</Field>
</FormMegaLayout>
</SchemaForm>
</NiceForm>
<div className={styles.registerForm}>
{
current === 0 &&
......
import { ISchema } from '@formily/antd';
import { PATTERN_MAPS } from '@/constants/regExp';
export const registerStep1Schema: ISchema = {
type: 'object',
properties: {
REGISTER_STEP: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
className: 'registerForm',
full: true
},
properties: {
phone: {
type: 'string',
required: true,
"x-rules": [
{
pattern: PATTERN_MAPS.phone,
message: '请填写手机号'
}
],
"x-component-props": {
placeholder: '请输入您的手机号码',
size: 'large'
},
"x-props": {
addonBefore: "{{phoneBefore}}"
}
},
smsCode: {
type: 'string',
"x-component": 'Phone',
required: true,
"x-rules": [
{
pattern: PATTERN_MAPS.smsCode,
message: '请输入正确的6位验证码'
}
],
"x-component-props": {
size: 'large',
}
},
password: {
type: 'password',
required: true,
"x-rules": [
{
pattern: PATTERN_MAPS.password,
message: '请输入正确的密码'
}
],
"x-component-props": {
placeholder: '请设置你的登录密码',
size: 'large',
}
},
confirmPassword: {
type: 'password',
required: true,
"x-rules": [
{
pattern: PATTERN_MAPS.password,
message: '请输入正确的密码'
}
],
"x-component-props": {
placeholder: '请再次输入你的登录密码',
size: 'large',
}
},
email: {
type: 'string',
"x-rules": [
{
pattern: PATTERN_MAPS.email,
message: '请输入正确的邮箱'
}
],
"x-component-props": {
placeholder: '请输入你的邮箱(选填)',
size: 'large',
type: 'email'
}
},
isRead: {
required: true,
"x-component": 'CheckboxSingle',
"x-component-props": {
children: "{{checkBoxChildren}}"
}
}
}
},
}
}
export const registerStep2Schma: ISchema = {
type: 'object',
properties: {
REGISTER_STEP: {
type: 'object',
properties: {
demo: {
type: 'string'
}
},
visible: false
}
}
}
\ 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