知识库增加租户隔离
This commit is contained in:
+16
-3
@@ -71,9 +71,22 @@ export async function loadAndAddDynamicRoutes() {
|
||||
// 创建加载 Promise
|
||||
routesLoadingPromise = (async () => {
|
||||
try {
|
||||
// 直接从 API 获取菜单数据
|
||||
const { getAllMenus } = await import("@/api/menu");
|
||||
const res = await getAllMenus();
|
||||
// 获取用户信息,判断登录类型
|
||||
const userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
||||
const loginType = userInfo.type; // "user" 或 "employee"
|
||||
const roleId = userInfo.role; // 角色ID
|
||||
|
||||
// 根据登录类型选择不同的菜单接口
|
||||
const { getAllMenus, getTenantMenus } = await import("@/api/menu");
|
||||
let res;
|
||||
|
||||
if (loginType === "employee" && roleId) {
|
||||
// 员工登录,使用getTenantMenus接口
|
||||
res = await getTenantMenus(roleId);
|
||||
} else {
|
||||
// 用户登录,使用getAllMenus接口
|
||||
res = await getAllMenus();
|
||||
}
|
||||
|
||||
if (res && res.success && res.data) {
|
||||
// 添加动态路由
|
||||
|
||||
Reference in New Issue
Block a user