From c832bf2e80ac465e71b7a1c1f7a59d4252030989 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 05 Aug 2025 17:33:08 +0800
Subject: [PATCH] feat:事件工单滚动条

---
 src/permission.js |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/permission.js b/src/permission.js
index f12dc4e..4db5ed8 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -18,6 +18,8 @@
 NProgress.configure({ showSpinner: false })
 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) {
   // 遍历数组中的每个路由对象
@@ -39,16 +41,14 @@
   // 遍历完所有路由都没找到,返回null
   return null
 }
-
 router.beforeEach((to, from, next) => {
   const meta = to.meta || {}
   const isMenu = meta.menu === undefined ? to.query.menu : meta.menu
   store.commit('SET_IS_MENU', isMenu === undefined)
 
   const menuAll = getStore({ name: 'menuAll' })
-
   if (getToken()) {
-    if (!menuAll) {
+    if (!menuAll?.length) {
       store.dispatch('GetMenu').then(data => {
         if (data.length !== 0) {
           router.$avueRouter.formatRoutes(data, true)
@@ -96,6 +96,7 @@
         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 || {}
@@ -120,7 +121,7 @@
     if (meta.isAuth === false) {
       next()
     } else {
-      next('/login')
+      env === 'development' ? next('/login') : window.location.replace(`${adminUrl}#/login`)
     }
   }
 })

--
Gitblit v1.9.3