| | |
| | | onEnterSubmit = (e) => { |
| | | // 表单回车提交 |
| | | if (e.key !== 'Enter') return |
| | | this.props.resetPwdSubmit() |
| | | |
| | | if (!this.props.form.getFieldValue('originpwd')) { |
| | | this.focusInput('originpwd') |
| | | } else if (!this.props.form.getFieldValue('password')) { |
| | | this.focusInput('password') |
| | | } else if (!this.props.form.getFieldValue('confirm')) { |
| | | this.focusInput('confirm') |
| | | } else { |
| | | this.props.resetPwdSubmit() |
| | | } |
| | | } |
| | | |
| | | focusInput = (selectId) => { |
| | | let _form = document.getElementById('reset-password-form') |
| | | let _inputs = _form.getElementsByTagName('input') |
| | | _inputs = [..._inputs] |
| | | _inputs.forEach(input => { |
| | | if (!input || input.id !== selectId) return |
| | | |
| | | if (input.focus) { |
| | | input.focus() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} onKeyDown={this.onEnterSubmit}> |
| | | <Form {...formItemLayout} onKeyDown={this.onEnterSubmit} id="reset-password-form"> |
| | | <Form.Item label={this.props.dict['main.password.origin']}> |
| | | {getFieldDecorator('originpwd', { |
| | | rules: [ |
| | |
| | | message: this.props.dict['main.password.origin.required'] |
| | | } |
| | | ] |
| | | })(<Input.Password />)} |
| | | })(<Input.Password autoFocus/>)} |
| | | </Form.Item> |
| | | <Form.Item label={this.props.dict['main.password.new']} hasFeedback> |
| | | {getFieldDecorator('password', { |