diff --git a/admin-web/src/layouts/UserLayout.js b/admin-web/src/layouts/UserLayout.js index 18fb176e2..f4710ec83 100644 --- a/admin-web/src/layouts/UserLayout.js +++ b/admin-web/src/layouts/UserLayout.js @@ -63,10 +63,10 @@ class UserLayout extends Component {
logo - Ant Design + 后台管理系统
-
Ant Design 是西湖区最具影响力的 Web 设计规范
+
TODO....
{children} diff --git a/admin-web/src/pages/User/Register.js b/admin-web/src/pages/User/Register.js index ea4565c28..a1fe10b6f 100644 --- a/admin-web/src/pages/User/Register.js +++ b/admin-web/src/pages/User/Register.js @@ -3,37 +3,13 @@ import { connect } from 'dva'; import { formatMessage, FormattedMessage } from 'umi/locale'; import Link from 'umi/link'; import router from 'umi/router'; -import { Form, Input, Button, Select, Row, Col, Popover, Progress } from 'antd'; +import { Form, Input, Button, Select, Row, Col } from 'antd'; import styles from './Register.less'; const FormItem = Form.Item; const { Option } = Select; const InputGroup = Input.Group; -const passwordStatusMap = { - ok: ( -
- -
- ), - pass: ( -
- -
- ), - poor: ( -
- -
- ), -}; - -const passwordProgressMap = { - ok: 'success', - pass: 'normal', - poor: 'exception', -}; - @connect(({ register, loading }) => ({ register, submitting: loading.effects['register/submit'], @@ -42,9 +18,6 @@ const passwordProgressMap = { class Register extends Component { state = { count: 0, - confirmDirty: false, - visible: false, - help: '', prefix: '86', }; @@ -77,24 +50,13 @@ class Register extends Component { }, 1000); }; - getPasswordStatus = () => { - const { form } = this.props; - const value = form.getFieldValue('password'); - if (value && value.length > 9) { - return 'ok'; - } - if (value && value.length > 5) { - return 'pass'; - } - return 'poor'; - }; - handleSubmit = e => { e.preventDefault(); const { form, dispatch } = this.props; form.validateFields({ force: true }, (err, values) => { if (!err) { const { prefix } = this.state; + console.log('123', values); dispatch({ type: 'register/submit', payload: { @@ -106,149 +68,22 @@ class Register extends Component { }); }; - handleConfirmBlur = e => { - const { value } = e.target; - const { confirmDirty } = this.state; - this.setState({ confirmDirty: confirmDirty || !!value }); - }; - - checkConfirm = (rule, value, callback) => { - const { form } = this.props; - if (value && value !== form.getFieldValue('password')) { - callback(formatMessage({ id: 'validation.password.twice' })); - } else { - callback(); - } - }; - - checkPassword = (rule, value, callback) => { - const { visible, confirmDirty } = this.state; - if (!value) { - this.setState({ - help: formatMessage({ id: 'validation.password.required' }), - visible: !!value, - }); - callback('error'); - } else { - this.setState({ - help: '', - }); - if (!visible) { - this.setState({ - visible: !!value, - }); - } - if (value.length < 6) { - callback('error'); - } else { - const { form } = this.props; - if (value && confirmDirty) { - form.validateFields(['confirm'], { force: true }); - } - callback(); - } - } - }; - changePrefix = value => { this.setState({ prefix: value, }); }; - renderPasswordProgress = () => { - const { form } = this.props; - const value = form.getFieldValue('password'); - const passwordStatus = this.getPasswordStatus(); - return value && value.length ? ( -
- 100 ? 100 : value.length * 10} - showInfo={false} - /> -
- ) : null; - }; - render() { const { form, submitting } = this.props; const { getFieldDecorator } = form; - const { count, prefix, help, visible } = this.state; + const { count, prefix } = this.state; return (

- - {getFieldDecorator('mail', { - rules: [ - { - required: true, - message: formatMessage({ id: 'validation.email.required' }), - }, - { - type: 'email', - message: formatMessage({ id: 'validation.email.wrong-format' }), - }, - ], - })( - - )} - - - node.parentNode} - content={ -
- {passwordStatusMap[this.getPasswordStatus()]} - {this.renderPasswordProgress()} -
- -
-
- } - overlayStyle={{ width: 240 }} - placement="right" - visible={visible} - > - {getFieldDecorator('password', { - rules: [ - { - validator: this.checkPassword, - }, - ], - })( - - )} -
-
- - {getFieldDecorator('confirm', { - rules: [ - { - required: true, - message: formatMessage({ id: 'validation.confirm-password.required' }), - }, - { - validator: this.checkConfirm, - }, - ], - })( - - )} - - {getFieldDecorator('mobile', { + {getFieldDecorator('username', { rules: [ { required: true, @@ -283,7 +118,7 @@ class Register extends Component { - {getFieldDecorator('captcha', { + {getFieldDecorator('password', { rules: [ { required: true, diff --git a/admin-web/src/pages/User/models/register.js b/admin-web/src/pages/User/models/register.js index a2901bbd5..e3e307ec8 100644 --- a/admin-web/src/pages/User/models/register.js +++ b/admin-web/src/pages/User/models/register.js @@ -11,6 +11,7 @@ export default { effects: { *submit({ payload }, { call, put }) { + console.error(1); const response = yield call(fakeRegister, payload); yield put({ type: 'registerHandle', diff --git a/admin-web/src/services/api.js b/admin-web/src/services/api.js index 6e789bcc9..43fa92403 100644 --- a/admin-web/src/services/api.js +++ b/admin-web/src/services/api.js @@ -111,7 +111,7 @@ export async function fakeAccountLogin(params) { } export async function fakeRegister(params) { - return request('/api/register', { + return request(`/admin-api/admin/passport/login/?${stringify(params)}`, { method: 'POST', body: params, });