diff --git a/src/layouts/LayoutClassic/index.vue b/src/layouts/LayoutClassic/index.vue index 75892b5..fb120d0 100644 --- a/src/layouts/LayoutClassic/index.vue +++ b/src/layouts/LayoutClassic/index.vue @@ -1,13 +1,13 @@ diff --git a/src/layouts/components/Menu/SubMenu.vue b/src/layouts/components/Menu/SubMenu.vue index bc2df99..2346dd5 100644 --- a/src/layouts/components/Menu/SubMenu.vue +++ b/src/layouts/components/Menu/SubMenu.vue @@ -44,12 +44,13 @@ const baseImgURl = import.meta.env.VITE_BASE_IMAGE_URL; // const imgUrl = "@/assets/images/leftTab/"; const handleClickMenu = async (subItem: Menu.MenuOptions) => { if (subItem.meta.isLink) return window.open(subItem.meta.isLink, "_blank"); - if (globalStore.accountType != 1) { - const res = await getButtonAuth({ menuId: subItem.name }); - if (res && res.result) { - authStore.authButtonList = res.result; - } - } + // if (globalStore.accountType != 1) { + // globalStore.menuName = subItem.name + // const res = await getButtonAuth({ menuId: subItem.name }); + // if (res && res.result) { + // authStore.authButtonList = res.result; + // } + // } router.push(subItem.path); }; diff --git a/src/routers/index.ts b/src/routers/index.ts index 359111f..8290013 100644 --- a/src/routers/index.ts +++ b/src/routers/index.ts @@ -6,6 +6,7 @@ import { initDynamicRouter } from "@/routers/modules/dynamicRouter"; import { staticRouter, errorRouter } from "@/routers/modules/staticRouter"; import NProgress from "@/config/nprogress"; import { HOME_URL } from "@/enums/Home"; +import { getButtonAuth } from "@/api/modules/auth"; // import path from "path"; /** @@ -35,6 +36,7 @@ const router = createRouter({ * @description 路由拦截 beforeEach * */ router.beforeEach(async (to, from, next) => { + console.log(to); const globalStore = GlobalStore(); // 1.NProgress 开始 @@ -62,6 +64,11 @@ router.beforeEach(async (to, from, next) => { // 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由 const authStore = AuthStore(); authStore.setRouteName(to.name as string); + + const res = await getButtonAuth({ menuId: to.name }); + if (res && res.result) { + authStore.authButtonList = res.result; + } if (!authStore.authMenuListGet.length) { await initDynamicRouter(); if (globalStore.accountType && globalStore.accountType !== 1 && to.fullPath === HOME_URL[0]) { diff --git a/src/stores/index.ts b/src/stores/index.ts index 1980bb0..47fee2b 100644 --- a/src/stores/index.ts +++ b/src/stores/index.ts @@ -16,6 +16,7 @@ export const GlobalStore = defineStore({ userInfo: "", account: "", moduleId: "", //模块id + menuName: "", // 菜单id accountType: undefined, //登录账号类型 moduleName: "", //登录账号类型 // 都是控制退出或者修改密码的时候遮挡视频的问题 diff --git a/src/stores/interface/index.ts b/src/stores/interface/index.ts index 6b9152d..a966d46 100644 --- a/src/stores/interface/index.ts +++ b/src/stores/interface/index.ts @@ -5,6 +5,7 @@ export interface GlobalState { userInfo: any | null; accountType: number | undefined; moduleId: string | null; + menuName: string | null; account: string | null; assemblySize: AssemblySizeType | ""; language: string | null; diff --git a/src/views/goverment/huizhou/progressManagement/GanttchartChart/index.vue b/src/views/goverment/huizhou/progressManagement/GanttchartChart/index.vue index b41aee2..d09c66d 100644 --- a/src/views/goverment/huizhou/progressManagement/GanttchartChart/index.vue +++ b/src/views/goverment/huizhou/progressManagement/GanttchartChart/index.vue @@ -123,9 +123,11 @@