From 0519dcda8b6fb2914987f8d4d58e1d14bcf98dc3 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 30 六月 2023 14:33:06 +0800
Subject: [PATCH] 2023-06-30

---
 src/views/login/index.jsx |   91 ++++++++++++++++++++++-----------------------
 1 files changed, 45 insertions(+), 46 deletions(-)

diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx
index 2738aa7..c160a08 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, notification } from 'antd'
+import { message, Modal } from 'antd'
 import md5 from 'md5'
 import moment from 'moment'
 
@@ -149,11 +149,10 @@
         }
       }
 
-      let _history = sessionStorage.getItem('history')
-      if (_history) {
-        sessionStorage.removeItem('history')
-        // 鏌ョ湅鏄惁涓哄叾浠栭〉闈㈣烦杞紝璺緞瀛樺湪鏃讹紝璺冲洖鍘熼〉闈�
-        this.props.history.replace(_history)
+      let iframe = sessionStorage.getItem('iframe')
+      if (iframe) {
+        sessionStorage.removeItem('iframe')
+        this.props.history.replace(iframe.replace(/@loginuid@/, res.LoginUID))
       } else {
         this.props.history.replace('/main')
       }
@@ -210,11 +209,10 @@
       sessionStorage.removeItem('visitorUserID')
       sessionStorage.removeItem('visitorLoginUID')
 
-      let _history = sessionStorage.getItem('history')
-      if (_history) {
-        sessionStorage.removeItem('history')
-        // 鏌ョ湅鏄惁涓哄叾浠栭〉闈㈣烦杞紝璺緞瀛樺湪鏃讹紝璺冲洖鍘熼〉闈�
-        this.props.history.replace(_history)
+      let iframe = sessionStorage.getItem('iframe')
+      if (iframe) {
+        sessionStorage.removeItem('iframe')
+        this.props.history.replace(iframe.replace(/@loginuid@/, res.LoginUID))
       } else {
         this.props.history.replace('/main')
       }
@@ -256,11 +254,10 @@
         sessionStorage.removeItem('visitorUserID')
         sessionStorage.removeItem('visitorLoginUID')
   
-        let _history = sessionStorage.getItem('history')
-        if (_history) {
-          sessionStorage.removeItem('history')
-          // 鏌ョ湅鏄惁涓哄叾浠栭〉闈㈣烦杞紝璺緞瀛樺湪鏃讹紝璺冲洖鍘熼〉闈�
-          this.props.history.replace(_history)
+        let iframe = sessionStorage.getItem('iframe')
+        if (iframe) {
+          sessionStorage.removeItem('iframe')
+          this.props.history.replace(iframe.replace(/@loginuid@/, res.LoginUID))
         } else {
           this.props.history.replace('/main')
         }
@@ -302,43 +299,16 @@
     // md5("/ws/location/v1/ip?callback=callbackFunction&key=key&output=jsonp secret key")
     // md5("/ws/location/v1/ip?callback=callbackFunction&key=BA7BZ-4QB65-LFCIA-QPDA6-4G6O7-MJB4Q&output=jsonpuThL4ZM3XOj642ksEQh76tyHFjh4")
 
-    // 鑾峰彇ip鍙婂煄甯備俊鎭�
-    // let ipurl = window.atob('aHR0cHM6Ly9lcGMubWs5a$mkC5jbi93ZWJhcGkvaXBsb2M='.replace(/\$mk/ig, ''))
-    // Api.directRequest(ipurl, 'get', null, 'true').then(res => {
-    //   if (!res || !res.ip) return
-    //   sessionStorage.setItem('ipAddress', res.ip)
-    // })
-
     setTimeout(() => {
       Api.delCacheConfig()
     }, 50)
+
     if (window.GLOB.filter) {
       let view = document.getElementById('mk-login-view')
       
       if (view) {
         view.style.filter = 'grayscale(100%)'
       }
-    }
-
-    if (sessionStorage.getItem('loginError')) {
-      try {
-        let res = JSON.parse(sessionStorage.getItem('loginError'))
-        console.info(res.url)
-        console.info(res.request)
-        console.info(res.response)
-
-        let result = JSON.parse(res.response)
-
-        notification.warning({
-          top: 92,
-          message: result.message,
-          duration: 5
-        })
-      } catch (e) {}
-      
-      setTimeout(() => {
-        sessionStorage.removeItem('loginError')
-      }, 2000)
     }
 
     const _addressUrl = _href + 'queryAddress'
@@ -473,7 +443,11 @@
       param.sign = md5(values)
       param.t = new Date().getTime()
   
-      Api.directRequest(_rduri + '/' + _func, 'post', param, 'true').then(res => {
+      Api.directRequest({
+        url: _rduri + '/' + _func,
+        method: 'post',
+        data: JSON.stringify(param)
+      }).then(res => {
         if (res.status) {
           if (res.EPC === str) {
             let box = []
@@ -514,7 +488,30 @@
             authError: res.message
           })
         }
-      }, () => {
+      }, (error) => {
+        if (error && error.ErrCode === 'LoginError') {
+          let param = {
+            func: 's_visitor_login',
+            timestamp: moment().format('YYYY-MM-DD HH:mm:ss'), 
+            SessionUid: _id,
+            TypeCharOne: 'pc',
+            appkey: '202004041613277377A6A2456D34A4948AE84'
+          }
+
+          param.LText = md5(window.btoa(_id + param.timestamp))
+          param.secretkey = md5(param.LText + 'mingke' + param.timestamp)
+
+          let params = {
+            url: _rduri.replace('dostars', 'dologon'),
+            method: 'post',
+            data: JSON.stringify(param)
+          }
+
+          Api.directRequest(params)
+
+          return
+        }
+
         if (index === -1 || index > 10) {
           this.setState({
             auth: false,
@@ -561,6 +558,8 @@
         _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)
 
         Api.getSystemConfig(_param).then(res => {
+          if (!res) return
+          
           if (res.status) {
             // positecgroup
             // res.Banner = res.Banner ? res.Banner.replace(/:8080/ig, '').replace(/http:/ig, 'https:') : ''

--
Gitblit v1.8.0