|
|
@@ -2,6 +2,7 @@ import { defineStore } from "pinia";
|
|
|
import { AuthState } from "@/stores/interface";
|
|
|
import { getAuthButtonListApi, getAuthMenuListApi } from "@/api/modules/login";
|
|
|
import { getFlatMenuList, getShowMenuList, getAllBreadcrumbList } from "@/utils";
|
|
|
+import { usePermission } from "@/utils/permission";
|
|
|
export const useAuthStore = defineStore({
|
|
|
id: "geeker-auth",
|
|
|
state: (): AuthState => ({
|
|
|
@@ -33,7 +34,27 @@ export const useAuthStore = defineStore({
|
|
|
// Get AuthMenuList
|
|
|
async getAuthMenuList() {
|
|
|
const { data } = (await getAuthMenuListApi()) as any;
|
|
|
- console.log(data, "ddd-000d");
|
|
|
+
|
|
|
+ const hasPermission = await usePermission();
|
|
|
+ if (!hasPermission) {
|
|
|
+ // 根据权限隐藏"门店装修"和"财务管理"菜单
|
|
|
+ const hideMenuNames = ["storeDecoration", "financialManagement"];
|
|
|
+ // 递归查找并隐藏指定菜单
|
|
|
+ const hideMenus = (menuList: any[]) => {
|
|
|
+ menuList.forEach(menu => {
|
|
|
+ // 根据菜单名称判断是否需要隐藏
|
|
|
+ if (menu.name && hideMenuNames.includes(menu.name)) {
|
|
|
+ menu.meta.isHide = true;
|
|
|
+ }
|
|
|
+ // 递归处理子菜单
|
|
|
+ if (menu.children && menu.children.length > 0) {
|
|
|
+ hideMenus(menu.children);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+ hideMenus(data);
|
|
|
+ }
|
|
|
+
|
|
|
this.authMenuList = data;
|
|
|
},
|
|
|
// Set RouteName
|