From 83a6b22bb99ff68896b2f0751d3d23ebddde7cbb Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 11 Jun 2025 17:10:48 +0800
Subject: [PATCH] feat:判断是否有token然后跳转到个人工作台页面

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

diff --git a/src/permission.js b/src/permission.js
index c244bec..f12dc4e 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -47,43 +47,43 @@
 
   const menuAll = getStore({ name: 'menuAll' })
 
-  if (!menuAll) {
-    store.dispatch('GetMenu').then(data => {
-      if (data.length !== 0) {
-        router.$avueRouter.formatRoutes(data, true)
-
-        let newMenu = getStore({ name: 'menuAll' })
-
-        let firstMenu = newMenu[0]
-
-        let toMenu = findRouteByPath(newMenu, to.path)
-
-        store.commit('ADD_TAG', {
-          name: firstMenu.name,
-          path: firstMenu.path,
-          fullPath: firstMenu.path,
-          params: firstMenu.params || {},
-          query: firstMenu.query || {},
-          meta: firstMenu.meta || {},
-        })
-
-        store.commit('ADD_TAG', {
-          name: toMenu.name,
-          path: toMenu.path,
-          fullPath: toMenu.path,
-          params: toMenu.params || {},
-          query: toMenu.query || {},
-          meta: toMenu.meta || {},
-        })
-
-        next(to.fullPath)
-      }
-    })
-
-    return
-  }
-
   if (getToken()) {
+    if (!menuAll) {
+      store.dispatch('GetMenu').then(data => {
+        if (data.length !== 0) {
+          router.$avueRouter.formatRoutes(data, true)
+
+          let newMenu = getStore({ name: 'menuAll' })
+
+          let firstMenu = newMenu[0]
+
+          let toMenu = findRouteByPath(newMenu, to.path)
+
+          store.commit('ADD_TAG', {
+            name: firstMenu.name,
+            path: firstMenu.path,
+            fullPath: firstMenu.path,
+            params: firstMenu.params || {},
+            query: firstMenu.query || {},
+            meta: firstMenu.meta || {},
+          })
+
+          store.commit('ADD_TAG', {
+            name: toMenu.name,
+            path: toMenu.path,
+            fullPath: toMenu.path,
+            params: toMenu.params || {},
+            query: toMenu.query || {},
+            meta: toMenu.meta || {},
+          })
+
+          next(to.fullPath)
+        }
+      })
+
+      return
+    }
+
     if (store.getters.isLock && to.path !== lockPage) {
       //如果系统激活锁屏,全部跳转到锁屏页
       next({ path: lockPage })

--
Gitblit v1.9.3