From 4648a3bee638e9a99d2d80b66f8833b261a2db91 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期四, 25 九月 2025 22:39:24 +0800
Subject: [PATCH] feat:设计 app ui

---
 ruoyi-ui/src/permission.js |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/ruoyi-ui/src/permission.js b/ruoyi-ui/src/permission.js
index b66190b..ca6c9cf 100644
--- a/ruoyi-ui/src/permission.js
+++ b/ruoyi-ui/src/permission.js
@@ -9,7 +9,7 @@
 
 NProgress.configure({ showSpinner: false })
 
-const whiteList = ['/login', '/register']
+const whiteList = ['/login', '/register','/anonymous/*', '/h5/*']
 
 const isWhiteList = (path) => {
   return whiteList.some(pattern => isPathMatch(pattern, path))
@@ -17,6 +17,14 @@
 
 router.beforeEach((to, from, next) => {
   NProgress.start()
+  
+  // 璋冭瘯鏃ュ織
+  console.log('=== 璺敱瀹堝崼璋冭瘯 ===')
+  console.log('鐩爣璺緞:', to.path)
+  console.log('瀹屾暣璺緞:', to.fullPath)
+  console.log('Token鐘舵��:', !!getToken())
+  console.log('鐧藉悕鍗曟鏌�:', isWhiteList(to.path))
+  
   if (getToken()) {
     to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
     /* has token*/
@@ -24,6 +32,7 @@
       next({ path: '/' })
       NProgress.done()
     } else if (isWhiteList(to.path)) {
+      console.log('鉁� 鏈塗oken涓斿湪鐧藉悕鍗曪紝鐩存帴閫氳繃')
       next()
     } else {
       if (store.getters.roles.length === 0) {
@@ -47,9 +56,11 @@
       }
     }
   } else {
+    
     // 娌℃湁token
-    if (isWhiteList(to.path)) {
+    if (isWhiteList(to.path) || to.meta.anonymous) {
       // 鍦ㄥ厤鐧诲綍鐧藉悕鍗曪紝鐩存帴杩涘叆
+      
       next()
     } else {
       next(`/login?redirect=${encodeURIComponent(to.fullPath)}`) // 鍚﹀垯鍏ㄩ儴閲嶅畾鍚戝埌鐧诲綍椤�

--
Gitblit v1.9.1