From aed141813bc64c7afdf3a337d631585b0a3cf42e Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 17 Jul 2025 09:39:43 +0800
Subject: [PATCH] Merge branch 'test'

---
 src/permission.js |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/permission.js b/src/permission.js
index 5272458..c91ba32 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -19,6 +19,8 @@
 const lockPage = '/lock' //锁屏页
 const urlParams = getUrlParams(window.location.href)
 const adminUrl = import.meta.env.VITE_APP_DASHBOARD_URL
+const env = import.meta.env.VITE_APP_ENV
+
 function findRouteByPath (routes, targetPath) {
   // 遍历数组中的每个路由对象
   for (const route of routes) {
@@ -39,7 +41,6 @@
   // 遍历完所有路由都没找到,返回null
   return null
 }
-
 router.beforeEach((to, from, next) => {
   const meta = to.meta || {}
   const isMenu = meta.menu === undefined ? to.query.menu : meta.menu
@@ -93,10 +94,10 @@
     } else {
       const systemToken = store.getters.token || urlParams?.token
       if (systemToken === 0) {
-        // store.dispatch('FedLogOut').then(() => {
-        //   next({ path: '/login' })
-        // })
-        store.dispatch('FedLogOut').then(() =>  window.location.replace(`${adminUrl}#/login`));
+        store.dispatch('FedLogOut').then(() => {
+          next({ path: '/login' })
+        })
+        // store.dispatch('FedLogOut').then(() =>  window.location.replace(`${adminUrl}#/login`));
       } else {
         const meta = to.meta || {}
         const query = to.query || {}
@@ -121,8 +122,7 @@
     if (meta.isAuth === false) {
       next()
     } else {
-      // next('/login')
-      window.location.replace(`${adminUrl}#/login`)
+      env === 'development' ? next('/login') : window.location.replace(`${adminUrl}#/login`)
     }
   }
 })

--
Gitblit v1.9.3