king
2021-11-02 2f952c67cb4eddd4ad916a8418b3aee4cae82111
src/views/login/index.jsx
@@ -1,5 +1,5 @@
import React, { Component } from 'react'
import { message, Modal } from 'antd'
import { message, Modal, notification } from 'antd'
import { connect } from 'react-redux'
import md5 from 'md5'
import moment from 'moment'
@@ -9,12 +9,14 @@
import options, { styles } from '@/store/options.js'
import zhCN from '@/locales/zh-CN/login.js'
import enUS from '@/locales/en-US/login.js'
import asyncComponent from '@/utils/asyncComponent'
import asyncLoadComponent from '@/utils/asyncLoadComponent'
import { modifyMemberLevel } from '@/store/action'
import './index.scss'
const LoginForm = asyncLoadComponent(() => import('./loginform'))
const LoginCloudForm = asyncLoadComponent(() => import('./logincloudform'))
const Resetpwd = asyncLoadComponent(() => import('@/components/header/resetpwd'))
const LoginCloudForm = asyncComponent(() => import('./logincloudform'))
const iszhCN = sessionStorage.getItem('lang') !== 'en-US'
const _href = window.location.href.split('#')[0]
@@ -42,7 +44,8 @@
    loginWays: null,
    touristLogin: false,
    syncing: false,
    visible: false
    visible: false,
    resetLoading: false
  }
  UNSAFE_componentWillMount() {
@@ -466,7 +469,7 @@
              app_version: res.app_version
            }
            let level = res.pwd_level || 'char_num_90'
            let level = res.pwd_level || ''
            if (level && !['letter_num', 'char_num', 'char_num_90'].includes(level)) {
              level = ''
@@ -635,7 +638,6 @@
      param.rduri = options.cloudServiceApi.replace('dostars', 'dostar')
    }
    this.logincloudRef.handleConfirm().then(result => {
      param.UserName = result.cloudusername
      param.Password = result.cloudpassword
@@ -678,6 +680,48 @@
        }
      })
    })
  }
  resetPwdSubmit = () => {
    this.formRef.handleConfirm().then(res => {
      this.setState({
        resetLoading: true
      })
      let _param = {
        func: 's_PwdUpt',
        LText: `select '${res.originpwd}','${res.password}'`
      }
      _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密钥
      Api.getSystemConfig(_param).then(result => {
        this.setState({
          visible: !result.status,
          resetLoading: false
        })
        if (result.status) {
          notification.success({
            top: 92,
            message: '修改成功,请重新登录。',
            duration: 2
          })
          const input = document.getElementById('password')
          if (input) {
            input.select()
          }
        } else {
          notification.warning({
            top: 92,
            message: result.message,
            duration: 5
          })
        }
      })
    }, () => {})
  }
  /**
@@ -737,6 +781,19 @@
        >
          <LoginCloudForm handleSubmit={() => this.syncSubmit()} wrappedComponentRef={(inst) => this.logincloudRef = inst}/>
        </Modal>
        {/* 修改密码 */}
        <Modal
          title="修改密码"
          okText={this.state.dict['login.ok']}
          cancelText={this.state.dict['login.cancel']}
          visible={this.state.visible}
          onOk={this.resetPwdSubmit}
          confirmLoading={this.state.resetLoading}
          onCancel={() => this.setState({visible: false, resetLoading: false})}
          destroyOnClose
        >
          <Resetpwd wrappedComponentRef={(inst) => this.formRef = inst} resetPwdSubmit={this.resetPwdSubmit}/>
        </Modal>
      </div>
    )
  }