From 1072f0d4d3390d4b4923f3c7e407731817660780 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 27 四月 2022 23:20:25 +0800
Subject: [PATCH] 2022-04-27

---
 src/views/login/index.jsx |  146 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 116 insertions(+), 30 deletions(-)

diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx
index 146a321..ff7ee83 100644
--- a/src/views/login/index.jsx
+++ b/src/views/login/index.jsx
@@ -17,6 +17,7 @@
 const LoginForm = asyncLoadComponent(() => import('./loginform'))
 const Resetpwd = asyncLoadComponent(() => import('@/components/header/resetpwd'))
 const LoginCloudForm = asyncComponent(() => import('./logincloudform'))
+const LoginCodeForm = asyncComponent(() => import('./logincodeform'))
 const iszhCN = sessionStorage.getItem('lang') !== 'en-US'
 
 const _href = window.location.href.split('#')[0]
@@ -103,6 +104,16 @@
         localStorage.setItem(_href, window.btoa(window.encodeURIComponent(JSON.stringify({username: param.username, password: param.password}))))
       } else {
         localStorage.removeItem(_href)
+      }
+      
+      // positecgroup
+      if (res.token) {
+        this.setState({
+          isDisabled: false,
+          verify: {...res, $password: param.password},
+          codeVisible: true
+        })
+        return
       }
 
       let level = localStorage.getItem(_href + 'pwdlevel')
@@ -512,10 +523,10 @@
         Api.getSystemConfig(_param).then(res => {
           if (res.status) {
             // positecgroup
-            // res.Banner = res.Banner ? res.Banner.replace(/:8080/ig, '').replace(/http:/ig, 'https:') : ''
-            // res.doclogo = res.doclogo ? res.doclogo.replace(/:8080/ig, '').replace(/http:/ig, 'https:') : ''
-            // res.indexlogo = res.indexlogo ? res.indexlogo.replace(/:8080/ig, '').replace(/http:/ig, 'https:') : ''
-            // res.loginlogo = res.loginlogo ? res.loginlogo.replace(/:8080/ig, '').replace(/http:/ig, 'https:') : ''
+            res.Banner = res.Banner ? res.Banner.replace(/:8080/ig, '').replace(/http:/ig, 'https:') : ''
+            res.doclogo = res.doclogo ? res.doclogo.replace(/:8080/ig, '').replace(/http:/ig, 'https:') : ''
+            res.indexlogo = res.indexlogo ? res.indexlogo.replace(/:8080/ig, '').replace(/http:/ig, 'https:') : ''
+            res.loginlogo = res.loginlogo ? res.loginlogo.replace(/:8080/ig, '').replace(/http:/ig, 'https:') : ''
 
             let _url = _href + 'system'
             let systemMsg = {
@@ -624,32 +635,32 @@
             }
 
             // positecgroup
-            // if (res.users_upt === 'true' && window.GLOB.systemType === 'production') {
-            //   Api.getLocalConfig ({
-            //     func: 's_Get_local_u_deleted',
-            //     users_upt_date: res.users_upt_date,
-            //     userid: result.UserID,
-            //     LoginUID: result.LoginUID
-            //   }).then(localres => {
-            //     if (!localres.status) return
-            //     Api.getSystemConfig({
-            //       func: 's_get_sso_u_create',
-            //       user_ids: localres.user_ids,
-            //       user_ids_local: localres.user_ids_local,
-            //       users_upt_date: localres.users_upt_date,
-            //       userid: result.UserID,
-            //       LoginUID: result.LoginUID
-            //     }).then(ssores => {
-            //       if (!ssores.status) return
-            //       Api.getLocalConfig ({
-            //         func: 's_get_local_u_create',
-            //         user_ids_local: ssores.user_ids_local,
-            //         userid: result.UserID,
-            //         LoginUID: result.LoginUID
-            //       })
-            //     })
-            //   })
-            // }
+            if (res.users_upt === 'true' && window.GLOB.systemType === 'production') {
+              Api.getLocalConfig ({
+                func: 's_Get_local_u_deleted',
+                users_upt_date: res.users_upt_date,
+                userid: result.UserID,
+                LoginUID: result.LoginUID
+              }).then(localres => {
+                if (!localres.status) return
+                Api.getSystemConfig({
+                  func: 's_get_sso_u_create',
+                  user_ids: localres.user_ids,
+                  user_ids_local: localres.user_ids_local,
+                  users_upt_date: localres.users_upt_date,
+                  userid: result.UserID,
+                  LoginUID: result.LoginUID
+                }).then(ssores => {
+                  if (!ssores.status) return
+                  Api.getLocalConfig ({
+                    func: 's_get_local_u_create',
+                    user_ids_local: ssores.user_ids_local,
+                    userid: result.UserID,
+                    LoginUID: result.LoginUID
+                  })
+                })
+              })
+            }
           } else {
             message.warning(res.message)
           }
@@ -753,6 +764,66 @@
         }
       })
     })
+  }
+
+  codeSubmit = () => {
+    const { verify } = this.state
+    this.codeRef.handleConfirm().then(res => {
+      this.setState({
+        codeLoading: true
+      })
+      Api.verifycode({...verify, code: res.code}).then(result => {
+        this.setState({
+          codeVisible: false,
+          codeLoading: false
+        })
+
+        if (result.verifyResult === 'success') {
+          let level = localStorage.getItem(_href + 'pwdlevel')
+          if (level) {
+            let visible = false
+            let tip = '瀵嗙爜寮哄害涓嶅锛岃淇敼瀵嗙爜锛�'
+            if (verify.$password.length < 8) {
+              visible = true
+            } else if (level === 'letter_num' && /^([^0-9]*|[^a-zA-Z]*)$/.test(verify.$password)) {
+              visible = true
+            } else if ((level === 'char_num' || level === 'char_num_90') && /^([^0-9]*|[^a-zA-Z]*|[^!@#$%^&*()_]*)$/.test(verify.$password)) {
+              visible = true
+            } else if (level === 'char_num_90' && verify.modifydate) {
+              let s = (new Date().getTime() - new Date(verify.modifydate).getTime()) / (1000 * 24 * 60 * 60)
+              if (!isNaN(s) && s > 90) {
+                visible = true
+                tip = '鎮ㄥ凡90澶╂湭淇敼瀵嗙爜锛岃鏇存崲瀵嗙爜鍚庝娇鐢紒'
+              }
+            }
+
+            if (visible) {
+              message.warning(tip)
+              this.setState({
+                isDisabled: false,
+                visible: true
+              })
+              return
+            }
+          }
+
+          let _history = sessionStorage.getItem('history')
+          if (_history) {
+            sessionStorage.removeItem('history')
+            // 鏌ョ湅鏄惁涓哄叾浠栭〉闈㈣烦杞紝璺緞瀛樺湪鏃讹紝璺冲洖鍘熼〉闈�
+            this.props.history.replace(_history)
+          } else {
+            this.props.history.replace('/main')
+          }
+        } else {
+          notification.warning({
+            top: 92,
+            message: '楠岃瘉鐮佹棤鏁堬紝璇烽噸鏂扮櫥褰曪紒',
+            duration: 5
+          })
+        }
+      })
+    }, () => {})
   }
 
   resetPwdSubmit = () => {
@@ -862,12 +933,27 @@
           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>
+        {/* 浜屾楠岃瘉 */}
+        <Modal
+          title="浜屾楠岃瘉"
+          okText={this.state.dict['login.ok']}
+          cancelText={this.state.dict['login.cancel']}
+          visible={this.state.codeVisible}
+          onOk={this.codeSubmit}
+          maskClosable={false}
+          confirmLoading={this.state.codeLoading}
+          onCancel={() => this.setState({codeVisible: false, codeLoading: false})}
+          destroyOnClose
+        >
+          <LoginCodeForm verify={this.state.verify} wrappedComponentRef={(inst) => this.codeRef = inst} handleSubmit={this.codeSubmit}/>
+        </Modal>
       </div>
     )
   }

--
Gitblit v1.8.0