| | |
| | | }) |
| | | } |
| | | |
| | | handleSubmit = e => { |
| | | // 登录参数检验 |
| | | handleSubmit = (e, key) => { |
| | | e.preventDefault() |
| | | this.props.handleSubmit() |
| | | if (e.target.value) { |
| | | if (!this.props.form.getFieldValue(key)) { |
| | | const input = document.getElementById(key) |
| | | if (input) { |
| | | input.focus() |
| | | } |
| | | return |
| | | } |
| | | this.props.handleSubmit() |
| | | } else { |
| | | this.handleConfirm() |
| | | } |
| | | } |
| | | |
| | | componentDidMount () { |
| | |
| | | prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />} |
| | | placeholder={this.state.dict['login.username']} |
| | | autoComplete="off" |
| | | onPressEnter={this.handleSubmit} |
| | | onPressEnter={(e) => {this.handleSubmit(e, 'password')}} |
| | | /> |
| | | )} |
| | | </Form.Item> |
| | |
| | | message: this.state.dict['login.password.empty'], |
| | | } |
| | | ] |
| | | })(<Input.Password onPressEnter={this.handleSubmit} placeholder={this.state.dict['login.password']} prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} />)} |
| | | })(<Input.Password onPressEnter={(e) => {this.handleSubmit(e, 'username')}} placeholder={this.state.dict['login.password']} prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} />)} |
| | | </Form.Item> |
| | | </Form> |
| | | ) |