king
2021-01-15 76a4300654a18d228838c3f27455dc8e7a8cd616
src/components/header/resetpwd/index.jsx
@@ -15,7 +15,29 @@
  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 = () => {
@@ -68,7 +90,7 @@
    }
    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: [
@@ -77,7 +99,7 @@
                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', {