From 86fbae80fc9bcc9a9118e031a2ddb0534a27b0e1 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 22 Jul 2025 11:19:31 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 src/store/modules/user.js |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index f498d03..2750ef4 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -27,6 +27,7 @@
 import { encrypt } from '@/utils/sm2';
 import md5 from 'js-md5';
 
+
 const user = {
   state: {
     tenantId: getStore({ name: 'tenantId' }) || '',
@@ -269,20 +270,30 @@
       });
     },
     GetMenu({ commit, dispatch }, tenantId) {
+      const errLogOut = () => {
+        dispatch('LogOut').then(()=>{
+          const env = import.meta.env.VITE_APP_ENV
+          const adminUrl = import.meta.env.VITE_APP_DASHBOARD_URL
+          env === 'development'
+            ? window.location.href = "/manage/login"
+            : window.location.replace(`${adminUrl}#/login`)
+        })
+      }
       return new Promise(resolve => {
         getRoutes(tenantId).then(res => {
           const data = res.data.data;
           let menu = deepClone(data);
-          menu?.forEach(ele => formatPath(ele, true));
+          if (!res.data?.data?.length){
+            errLogOut()
+            return
+          }
+          menu.forEach(ele => formatPath(ele, true));
           commit('SET_MENU', menu);
           commit('SET_MENU_ALL', menu);
           dispatch('GetButtons');
           resolve(menu);
         }).catch(err =>{
-          dispatch('LogOut').then(()=>{
-            const adminUrl = import.meta.env.VITE_APP_DASHBOARD_URL
-            window.location.replace(`${adminUrl}#/login`)
-          })
+          errLogOut()
         })
       });
     },

--
Gitblit v1.9.3