king
2024-06-19 9ff5920c0a58771219b134a7b46b7d0c1e1542ad
src/components/resetPassword/resetpwd/index.jsx
@@ -9,7 +9,8 @@
  state = {
    confirmDirty: false,
    autoCompleteResult: [],
    level: localStorage.getItem(window.location.href.split('#')[0] + 'pwdlevel') || ''
    level: localStorage.getItem(window.GLOB.sysSign + 'pwdlevel') || '',
    dict: window.GLOB.dict,
  }
  LoginTimer = null
@@ -63,7 +64,7 @@
  compareToFirstPassword = (rule, value, callback) => {
    const { form } = this.props
    if (value && value !== form.getFieldValue('password')) {
      callback('两次输入密码不一致!')
      callback(window.GLOB.dict['pwd_notM'] || '两次输入密码不一致!')
    } else {
      callback()
    }
@@ -71,16 +72,16 @@
  validateToNextPassword = (rule, value, callback) => {
    const { form } = this.props
    const { level } = this.state
    const { level, dict } = this.state
    if (value && this.state.confirmDirty) {
      form.validateFields(['confirm'], { force: true })
    }
    if (level === 'letter_num' && value && /^[0-9a-zA-Z!@#$%^&*()_]*$/.test(value) && /^([^0-9]*|[^a-zA-Z]*)$/.test(value)) {
      callback('密码中必须含有数字和字母。')
      callback(dict['pwd_letter_num'] || '密码中必须包含数字与字母')
    } else if ((level === 'char_num' || level === 'char_num_90' || level === 'char_num_90_sms') && value && /^[0-9a-zA-Z!@#$%^&*()_]*$/.test(value) && /^([^0-9]*|[^a-zA-Z]*|[^!@#$%^&*()_]*)$/.test(value)) {
      callback('密码中必须含有数字、字母和特殊字符。')
      callback(dict['pwd_char_num'] || '密码中必须含有数字、字母以及特殊字符')
    } else {
      callback()
    }
@@ -191,12 +192,12 @@
  render() {
    const { type } = this.props
    const { getFieldDecorator } = this.props.form
    const { level, delay, verdisabled } = this.state
    const { level, delay, verdisabled, dict } = this.state
    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 }
        sm: { span: 7 }
      },
      wrapperCol: {
        xs: { span: 24 },
@@ -208,38 +209,38 @@
    if (level) {
      rules.push({
        min: 8,
        message: '密码长度不可小于8位!'
        message: dict['pwd_min'] || '密码长度不可小于8位'
      })
    }
    return (
      <>
        {type === 'account' ? <Form {...formItemLayout} onKeyDown={this.onEnterSubmit} id="reset-password-form">
          <Form.Item label="原密码">
          <Form.Item label={dict['ori_pwd'] || '原密码'}>
            {getFieldDecorator('originpwd', {
              rules: [
                {
                  required: true,
                  message: '请输入原密码!'
                  message: dict['oripwd_required'] || '请输入原密码!'
                }
              ]
            })(<Input.Password autoFocus/>)}
          </Form.Item>
          <Form.Item label="新密码" hasFeedback>
          <Form.Item label={dict['new_pwd'] || '新密码'} hasFeedback>
            {getFieldDecorator('password', {
              rules: [
                {
                  required: true,
                  message: '请输入新密码!'
                  message: dict['newpwd_required'] || '请输入新密码!'
                },
                {
                  pattern: /^[0-9a-zA-Z!@#$%^&*()_]*$/ig,
                  message: '密码只允许包含数字、字母以及!@#$%&*()_。'
                  message: dict['password_format'] || '密码只允许包含数字、字母以及!@#$%&*()_。'
                },
                ...rules,
                {
                  max: 50,
                  message: '最大密码长度为50位!'
                  message: dict['pwd_max'] || '密码长度不可超过50个字符!'
                },
                {
                  validator: this.validateToNextPassword
@@ -247,12 +248,12 @@
              ]
            })(<Input.Password />)}
          </Form.Item>
          <Form.Item label="确认密码" hasFeedback>
          <Form.Item label={dict['con_pwd'] || '确认密码'} hasFeedback>
            {getFieldDecorator('confirm', {
              rules: [
                {
                  required: true,
                  message: '请确认密码!'
                  message: dict['conpwd_required'] || '请确认密码!'
                },
                {
                  validator: this.compareToFirstPassword
@@ -262,21 +263,21 @@
          </Form.Item>
        </Form> : null}
        {type === 'phonepwd' ? <Form {...formItemLayout} onKeyDown={(e) => e.key === 'Enter' && this.props.resetPwdSubmit()}>
          <Form.Item label="新密码" hasFeedback>
          <Form.Item label={dict['new_pwd'] || '新密码'} hasFeedback>
            {getFieldDecorator('password', {
              rules: [
                {
                  required: true,
                  message: '请输入新密码!'
                  message: dict['newpwd_required'] || '请输入新密码!'
                },
                {
                  pattern: /^[0-9a-zA-Z!@#$%^&*()_]*$/ig,
                  message: '密码只允许包含数字、字母以及!@#$%&*()_。'
                  message: dict['password_format'] || '密码只允许包含数字、字母以及!@#$%&*()_。'
                },
                ...rules,
                {
                  max: 50,
                  message: '最大密码长度为50位!'
                  message: dict['pwd_max'] || '密码长度不可超过50个字符!'
                },
                {
                  validator: this.validateToNextPassword
@@ -284,12 +285,12 @@
              ]
            })(<Input.Password />)}
          </Form.Item>
          <Form.Item label="确认密码" hasFeedback>
          <Form.Item label={dict['con_pwd'] || '确认密码'} hasFeedback>
            {getFieldDecorator('confirm', {
              rules: [
                {
                  required: true,
                  message: '请确认密码!'
                  message: dict['conpwd_required'] || '请确认密码!'
                },
                {
                  validator: this.compareToFirstPassword
@@ -299,16 +300,16 @@
          </Form.Item>
        </Form> : null}
        {type === 'mob' ? <Form {...formItemLayout} onKeyDown={(e) => e.key === 'Enter' && this.props.resetPwdSubmit()}>
          <Form.Item label="手机号">
          <Form.Item label={dict['phone_no'] || '手机号'}>
            {getFieldDecorator('phone', {
              initialValue: '',
              rules: [
                {
                  required: true,
                  message: '请输入手机号!'
                  message: dict['phone_no_required'] || '请输入手机号'
                }
              ]
            })(<Input placeholder="请输入手机号" autoComplete="off" />)}
            })(<Input placeholder={dict['phone_no'] || '手机号'} autoComplete="off" />)}
          </Form.Item>
        </Form> : null}
        {type === 'code' ? <Form wrapperCol={{ xs: { span: 24 }, sm: { span: 20 }}} onKeyDown={(e) => e.key === 'Enter' && this.props.resetPwdSubmit()}>
@@ -318,16 +319,16 @@
              rules: [
                {
                  required: true,
                  message: '请输入验证码!'
                  message: dict['vercode_required'] || '请输入验证码'
                }
              ]
            })(<Input
              addonAfter={
                <Button type="link" size="small" disabled={verdisabled} onClick={this.getvercode}>
                  {delay ? `${delay}s后重新获取` : '获取验证码'}
                  {delay ? `${delay}s` : dict['query_vercode'] || '获取验证码'}
                </Button>
              }
              placeholder="请输入验证码"
              placeholder={dict['vercode'] || '验证码'}
              autoComplete="off"
            />)}
          </Form.Item>