From 233e4fc4f35bd00a36ee34a7fbf5e47b41db26db Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 17 Nov 2025 09:54:44 +0800
Subject: [PATCH] feat:更新初始化地形
---
src/store/modules/user.js | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index 3b6a410..181b52d 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' }) || '',
@@ -39,7 +40,7 @@
token: getStore({ name: 'token' }) || '',
refreshToken: getStore({ name: 'refreshToken' }) || '',
parentDeptInfo: getStore({ name: 'parentDeptInfo' }) || '',
-
+
},
actions: {
//根据用户名登录
@@ -269,21 +270,36 @@
});
},
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 => {
+ getRoutes({tenantId,sysType: 1}).then(res => {
const data = res.data.data;
let menu = deepClone(data);
+ 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 =>{
+ errLogOut()
+ })
});
},
GetButtons({ commit }) {
return new Promise(resolve => {
- getButtons().then(res => {
+ getButtons({sysType: 1}).then(res => {
const data = res.data.data;
commit('SET_PERMISSION', data);
resolve();
--
Gitblit v1.9.3