king
2019-12-13 a70940450c021a47e69abdf8fa8f7f98594601cc
src/components/header/index.jsx
@@ -3,17 +3,17 @@
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import { is, fromJS } from 'immutable'
import {Dropdown, Menu, Icon, Modal, message, Form, notification, Switch } from 'antd'
import md5 from 'md5'
import moment from 'moment'
import {Dropdown, Menu, Icon, Modal, Form, notification, Switch } from 'antd'
import asyncComponent from '@/utils/asyncComponent'
import {toggleCollapse, modifyMainMenu, resetState, resetDebug, resetEditState, resetEditLevel, logout} from '@/store/action'
import Resetpwd from '@/components/resetpwd'
import Api from '@/api'
import zhCN from '@/locales/zh-CN/header.js'
import enUS from '@/locales/en-US/header.js'
import Utils from '@/utils/utils.js'
import logourl from '@/assets/img/main-logo.png'
import avatar from '@/assets/img/avatar.jpg'
import Resetpwd from './resetpwd'
import './index.scss'
const EditMenu = asyncComponent(() => import('./editmenu'))
@@ -50,12 +50,6 @@
    })
  }
  md5Password (pwd) {
    // md5密码加密
    const salt = 'minkesoft'
    return md5(md5(pwd + salt))
  }
  resetPwdSubmit = () => {
    this.formRef.handleConfirm().then(res => {
      this.setState({
@@ -66,17 +60,26 @@
  }
  async resetPwdSubmitexec (param) {
    // 重置密码提交,关闭模态框,清空表单数据
    let password = this.md5Password(param.originpwd)
    let newpassword = this.md5Password(param.password)
    let result = await Api.resetpassword(password, newpassword)
    let _param = {
      func: 's_PwdUpt',
      LText: `select '${param.originpwd}','${param.password}'`
    }
    _param.LText = Utils.formatOptions(_param.LText)                   // 关键字符替换,base64加密
    _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' // 时间戳
    _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)   // md5密钥
    let result = await Api.getSystemConfig(_param)
    if (result.status) {
      this.setState({
        visible: false,
        confirmLoading: false
      })
      this.formRef.resetfrom()
      message.success(this.state.dict['header.password.resetsuccess'])
      notification.success({
        top: 92,
        message: this.state.dict['header.password.resetsuccess'],
        duration: 5
      })
    } else {
      notification.warning({
        top: 92,
@@ -94,7 +97,6 @@
    this.setState({
      visible: false
    })
    this.formRef.resetfrom()
  }
  logout = () => {
@@ -182,7 +184,7 @@
    // 获取主菜单
    let result = await Api.getSystemConfig({func: 'sPC_Get_RolesMenu'})
    if (result.status) {
      // console.log(result.Roles)
    }
  }
@@ -276,6 +278,7 @@
          onOk={this.resetPwdSubmit}
          confirmLoading={this.state.confirmLoading}
          onCancel={this.handleCancel}
          destroyOnClose
        >
          <Resetpwd dict={this.state.dict} wrappedComponentRef={(inst) => this.formRef = inst} resetPwdSubmit={this.resetPwdSubmit}/>
        </Modal>