From 2f952c67cb4eddd4ad916a8418b3aee4cae82111 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 十一月 2021 10:00:09 +0800
Subject: [PATCH] 2021-11-02

---
 src/views/login/index.jsx |   67 +++++++++++++++++++++++++++++++--
 1 files changed, 62 insertions(+), 5 deletions(-)

diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx
index 8b82352..8eaa080 100644
--- a/src/views/login/index.jsx
+++ b/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)                   // 鍏抽敭瀛楃鏇挎崲锛宐ase64鍔犲瘑
+      _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>
     )
   }

--
Gitblit v1.8.0