king
2024-06-19 9ff5920c0a58771219b134a7b46b7d0c1e1542ad
src/components/resetPassword/index.jsx
@@ -14,7 +14,8 @@
    visible: false,
    loading: false,
    type: 'account',
    okText: '确定',
    okText: window.GLOB.dict['ok'] || '确定',
    dict: window.GLOB.dict,
    smsId: '',
    mob: '',
    code: ''
@@ -40,7 +41,7 @@
      visible: true,
      loading: false,
      type: 'account',
      okText: '确定',
      okText: window.GLOB.dict['ok'] || '确定',
      mob: '',
      code: '',
      smsId: sessionStorage.getItem('mk_sms_id') || ''
@@ -48,7 +49,7 @@
  }
  resetPwdSubmit = () => {
    const { type } = this.state
    const { type, dict } = this.state
    if (type === 'account') {
      this.formRef.handleConfirm().then(res => {
@@ -77,7 +78,7 @@
            })
            notification.success({
              top: 92,
              message: '修改成功,请重新登录。',
              message: dict['re_login'] || '修改成功,请重新登录。',
              duration: 2
            })
            this.callback && this.callback()
@@ -98,7 +99,7 @@
        if (!/^1[3456789]\d{9}$/.test(res.phone)) {
          notification.warning({
            top: 92,
            message: '手机号格式错误,请重填!',
            message: dict['phone_error'] || '手机号格式错误,请重填!',
            duration: 5
          })
          return
@@ -114,7 +115,7 @@
        this.setState({
          code: res.vercode,
          type: 'phonepwd',
          okText: '确定'
          okText: dict['ok'] || '确定'
        })
      }, () => {})
    } else if (type === 'phonepwd') {
@@ -146,7 +147,7 @@
            })
            notification.success({
              top: 92,
              message: '修改成功,请重新登录。',
              message: dict['re_login'] || '修改成功,请重新登录。',
              duration: 2
            })
            this.callback && this.callback()
@@ -166,23 +167,23 @@
  }
  render() {
    const { visible, loading, okText, type, mob, smsId } = this.state
    const { visible, loading, okText, type, mob, smsId, dict } = this.state
    return (
      <Modal
        title="修改密码"
        title={dict['ch_pwd'] || '修改密码'}
        wrapClassName="reset-password-modal"
        visible={visible}
        maskClosable={false}
        onOk={this.resetPwdSubmit}
        onCancel={() => { this.setState({ visible: false })}}
        okText={okText}
        cancelText="取消"
        cancelText={dict['cancel'] || '取消'}
        confirmLoading={loading}
        destroyOnClose
      >
        <Resetpwd type={type} mob={mob} smsId={smsId} wrappedComponentRef={(inst) => this.formRef = inst} resetPwdSubmit={this.resetPwdSubmit}/>
        {type === 'account' && smsId ? <div className="forget-pwd"><span onClick={() => this.setState({type: 'mob', okText: '下一步'})}>忘记密码?</span></div> : null}
        {type === 'account' && smsId ? <div className="forget-pwd"><span onClick={() => this.setState({type: 'mob', okText: dict['next'] || '下一步'})}>{dict['forgot_pwd'] || '忘记密码?'}</span></div> : null}
      </Modal>
    )
  }