From eebe63a6727e6495321d1433ebd2779b5a36d45a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 31 十二月 2020 22:08:14 +0800
Subject: [PATCH] 2020-12-31

---
 src/api/index.js |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/api/index.js b/src/api/index.js
index 8d1b215..2bf0ef3 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -56,7 +56,7 @@
   return Promise.reject(error)
 })
 
-const setCurrentUrl = () => {
+const setCurrentUrl = (res) => {
   if (!!(window.history && window.history.pushState)) {
     if (window.location.href.indexOf('paramsmain') > -1) {
       let _href = window.location.href.split('#')
@@ -64,6 +64,7 @@
     }
 
     sessionStorage.clear()
+    sessionStorage.setItem('loginError', JSON.stringify({request: res.config ? res.config.data : '', response: JSON.stringify(res.data)}))
     window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login')
     window.location.reload()
   }
@@ -77,7 +78,7 @@
       response.data.ErrCode = 'E'
       return Promise.resolve(response.data)
     } else {
-      setCurrentUrl()
+      setCurrentUrl(response)
     }
   } else {
     return Promise.resolve(response.data)
@@ -116,6 +117,24 @@
   }
 
   /**
+   * @description 浣跨敤dostar鎺ュ彛锛岃烦杩囬獙璇�
+   * @param {Object} param 鏌ヨ鍙婃彁浜ゅ弬鏁�
+   */
+  loginAndRedirect (param) {
+    let url = ''
+    if (process.env.NODE_ENV === 'production') {
+      url = document.location.origin + '/Home/LoginAndRedirect'
+    } else {
+      url = '/Home/LoginAndRedirect'
+    }
+
+    return axios({
+      url: url,
+      data: param
+    })
+  }
+
+  /**
    * @description 浣跨敤dostar鎺ュ彛锛岃烦杞嚦dostars
    * @param {Object} param 鏌ヨ鍙婃彁浜ゅ弬鏁�
    */

--
Gitblit v1.8.0