1
0

5 Commits 71baa28156 ... ed7b48a58f

Autor SHA1 Mensagem Data
  rkljw ed7b48a58f Merge branch 'alt_04_15_liu' into pre há 1 semana atrás
  rkljw d441560108 1 há 1 semana atrás
  rkljw 54a1e6ebe3 Merge branch 'pre' of http://git.bjzxtw.org.cn:3000/zxt/admin_home into pre há 1 semana atrás
  rkljw 631f2f2e57 Merge branch 'alt_04_15_liu' into pre há 1 semana atrás
  rkljw 9c8959adec 1 há 1 semana atrás
2 ficheiros alterados com 15 adições e 6 exclusões
  1. 8 5
      src/permission.js
  2. 7 1
      src/utils/auth.js

+ 8 - 5
src/permission.js

@@ -82,10 +82,7 @@ router.beforeEach(async(to, from, next) => {
     }
   } else {
     /* has no token*/
-    const userurl = hashParams();
-    if(userurl){
-      setUserUrl(userurl, 86400) 
-    }
+   
     if (whiteList.indexOf(to.path) !== -1) {
       // in the free login whitelist, go directly
       next()
@@ -93,7 +90,13 @@ router.beforeEach(async(to, from, next) => {
       // other pages that do not have permission to access are redirected to the login page.
       next(`/login?redirect=${to.path}`)
       NProgress.done()
-      setUserUrl(URL.webUrl, 86400)
+      const userurl = hashParams();
+      if(userurl){
+        setUserUrl(userurl, 86400) 
+      }else{
+        setUserUrl(URL.webUrl, 86400)
+      }
+      
     }
   }
 })

+ 7 - 1
src/utils/auth.js

@@ -93,13 +93,19 @@ export function hashParams() {
   const hash = url.hash;
   const hashParams = new URLSearchParams(hash.split('?')[1]);
   const userurl = hashParams.get('userurl');
-
+  const backurl = hashParams.get('backurl');
   if (userurl) {
     // Create a URL object to extract the domain
     const userUrlObject = new URL(userurl);
     return userUrlObject.hostname; // Return only the domain
   }
 
+  if (backurl) {
+    // Create a URL object to extract the domain
+    const backUrlObject = new URL(backurl);
+    return backUrlObject.hostname; // Return only the domain  
+  }
+
   return null; // Return null if userurl is not present
 }