From a70940450c021a47e69abdf8fa8f7f98594601cc Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 13 十二月 2019 17:36:54 +0800
Subject: [PATCH] 2019-12-13

---
 src/components/header/index.jsx |   37 ++++++++++++++++++++-----------------
 1 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index d9d7865..752bfe3 100644
--- a/src/components/header/index.jsx
+++ b/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)                   // 鍏抽敭瀛楃鏇挎崲锛宐ase64鍔犲瘑
+    _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>

--
Gitblit v1.8.0