From 1ba430d58ea3fd662d09b99f6e22ed3b3564a356 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 03 二月 2023 14:15:31 +0800
Subject: [PATCH] 2023-02-03

---
 src/views/login/index.jsx |   77 ++++++++------------------------------
 1 files changed, 16 insertions(+), 61 deletions(-)

diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx
index 8a0d939..68d2181 100644
--- a/src/views/login/index.jsx
+++ b/src/views/login/index.jsx
@@ -5,6 +5,7 @@
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js' 
+import MKEmitter from '@/utils/events.js'
 import options, { styles } from '@/store/options.js'
 import zhCN from '@/locales/zh-CN/login.js'
 import enUS from '@/locales/en-US/login.js'
@@ -13,7 +14,7 @@
 import './index.scss'
 
 const LoginForm = asyncLoadComponent(() => import('./loginform'))
-const Resetpwd = asyncLoadComponent(() => import('@/components/header/resetpwd'))
+const Resetpwd = asyncLoadComponent(() => import('@/components/resetPassword'))
 const LoginCloudForm = asyncComponent(() => import('./logincloudform'))
 const LoginCodeForm = asyncComponent(() => import('./logincodeform'))
 const iszhCN = sessionStorage.getItem('lang') !== 'en-US'
@@ -39,8 +40,6 @@
     loginWays: null,
     touristLogin: false,
     syncing: false,
-    visible: false,
-    resetLoading: false
   }
 
   changelang (item) {
@@ -150,8 +149,14 @@
         if (visible) {
           message.warning(tip)
           this.setState({
-            isDisabled: false,
-            visible: true
+            isDisabled: false
+          })
+          
+          MKEmitter.emit('resetpassword', () => {
+            const input = document.getElementById('password')
+            if (input) {
+              input.select()
+            }
           })
           return
         }
@@ -658,7 +663,11 @@
                 login_ways.push({
                   type: item.way_no,
                   smsId: item.sms_id
-                }) 
+                })
+
+                if (item.way_no === 'sms_vcode' && item.sms_id) {
+                  sessionStorage.setItem('mk_sms_id', item.sms_id)
+                }
               })
             } else {
               login_ways.push({
@@ -899,48 +908,6 @@
     }, () => {})
   }
 
-  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
-          })
-        }
-      })
-    }, () => {})
-  }
-
   /**
    * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊
    */
@@ -1000,19 +967,7 @@
           <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}
-          maskClosable={false}
-          confirmLoading={this.state.resetLoading}
-          onCancel={() => this.setState({visible: false, resetLoading: false})}
-          destroyOnClose
-        >
-          <Resetpwd wrappedComponentRef={(inst) => this.formRef = inst} resetPwdSubmit={this.resetPwdSubmit}/>
-        </Modal>
+        <Resetpwd />
         {/* 浜屾楠岃瘉 */}
         <Modal
           title="浜屾楠岃瘉"

--
Gitblit v1.8.0