king
2025-04-21 f3d4db769ba9b51b799d981511a710fd443d0e08
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 => {
@@ -60,10 +61,14 @@
          func: 's_PwdUpt',
          LText: `select '${res.originpwd}','${res.password}'`
        }
        if (window.GLOB.execType === 'x') {
          _param.exec_type = 'x'
        }
        
        _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')          // 时间戳
        _param.LText = Utils.formatOptions(_param.LText)                   // 关键字符替换,base64加密
        _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)   // md5密钥
        _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
        _param.LText = Utils.formatOptions(_param.LText, _param.exec_type)
        _param.secretkey = Utils.encrypt(window.GLOB.execType === 'x' ? '' : _param.LText, _param.timestamp)
    
        Api.getSystemConfig(_param).then(result => {
          if (result.status) {
@@ -73,7 +78,7 @@
            })
            notification.success({
              top: 92,
              message: '修改成功,请重新登录。',
              message: dict['re_login'] || '修改成功,请重新登录。',
              duration: 2
            })
            this.callback && this.callback()
@@ -94,7 +99,7 @@
        if (!/^1[3456789]\d{9}$/.test(res.phone)) {
          notification.warning({
            top: 92,
            message: '手机号格式错误,请重填!',
            message: dict['phone_error'] || '手机号格式错误,请重填!',
            duration: 5
          })
          return
@@ -110,7 +115,7 @@
        this.setState({
          code: res.vercode,
          type: 'phonepwd',
          okText: '确定'
          okText: dict['ok'] || '确定'
        })
      }, () => {})
    } else if (type === 'phonepwd') {
@@ -125,10 +130,14 @@
          mob: this.state.mob,
          check_code: this.state.code
        }
        if (window.GLOB.execType === 'x') {
          _param.exec_type = 'x'
        }
        
        _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')          // 时间戳
        _param.LText = Utils.formatOptions(_param.LText)                   // 关键字符替换,base64加密
        _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)   // md5密钥
        _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
        _param.LText = Utils.formatOptions(_param.LText, _param.exec_type)
        _param.secretkey = Utils.encrypt(window.GLOB.execType === 'x' ? '' : _param.LText, _param.timestamp)
    
        Api.getSystemConfig(_param).then(result => {
          if (result.status) {
@@ -138,7 +147,7 @@
            })
            notification.success({
              top: 92,
              message: '修改成功,请重新登录。',
              message: dict['re_login'] || '修改成功,请重新登录。',
              duration: 2
            })
            this.callback && this.callback()
@@ -158,22 +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={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>
    )
  }