From e4424ba3b195ddfd0dc5333a472b690a3daad5f5 Mon Sep 17 00:00:00 2001 From: JEECG <445654970@qq.com> Date: Mon, 18 Mar 2024 11:04:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=8E=89vue2=E4=B8=8Evue3?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/sys/menu.ts | 15 +++++--- src/store/modules/permission.ts | 68 ++++++++++++++++----------------- 2 files changed, 43 insertions(+), 40 deletions(-) diff --git a/src/api/sys/menu.ts b/src/api/sys/menu.ts index 1b905e5..27d9ba5 100644 --- a/src/api/sys/menu.ts +++ b/src/api/sys/menu.ts @@ -3,7 +3,8 @@ import { getMenuListResultModel } from './model/menuModel'; enum Api { GetMenuList = '/sys/permission/getUserPermissionByToken', - SwitchVue3Menu = '/sys/switchVue3Menu', + // 【QQYUN-8487】 + // SwitchVue3Menu = '/sys/switchVue3Menu', } /** @@ -33,8 +34,10 @@ export function getBackMenuAndPerms() { /** * 切换成vue3菜单 */ -export const switchVue3Menu = () => { - return new Promise((resolve) => { - defHttp.get({ url: Api.SwitchVue3Menu }); - }); -}; + // update-begin--author:liaozhiyang---date:20240313---for:【QQYUN-8487】注释掉判断菜单是否vue2版本逻辑代码 +// export const switchVue3Menu = () => { +// return new Promise((resolve) => { +// defHttp.get({ url: Api.SwitchVue3Menu }); +// }); +// }; +// update-end--author:liaozhiyang---date:20240313---for:【QQYUN-8487】注释掉判断菜单是否vue2版本逻辑代码 diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 056eab9..09264f3 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -18,7 +18,7 @@ import { ERROR_LOG_ROUTE, PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic'; import { filter } from '/@/utils/helper/treeHelper'; -import { getBackMenuAndPerms, switchVue3Menu } from '/@/api/sys/menu'; +import { getBackMenuAndPerms } from '/@/api/sys/menu'; import { useMessage } from '/@/hooks/web/useMessage'; import { PageEnum } from '/@/enums/pageEnum'; @@ -224,39 +224,39 @@ export const usePermissionStore = defineStore({ routeList = await this.changePermissionCode(); //routeList = (await getMenuList()) as AppRouteRecordRaw[]; // update-begin----author:sunjianlei---date:20220315------for: 判断是否是 vue3 版本的菜单 --- - let hasIndex: boolean = false; - let hasIcon: boolean = false; - for (let menuItem of routeList) { - // 条件1:判断组件是否是 layouts/default/index - if (!hasIndex) { - hasIndex = menuItem.component === 'layouts/default/index'; - } - // 条件2:判断图标是否带有 冒号 - if (!hasIcon) { - hasIcon = !!menuItem.meta?.icon?.includes(':'); - } - // 满足任何一个条件都直接跳出循环 - if (hasIcon || hasIndex) { - break; - } - } - // 两个条件都不满足,就弹出提示框 - if (!hasIcon && !hasIndex) { - // 延迟1.5秒之后再出现提示,否则提示框出不来 - setTimeout( - () => - createWarningModal({ - title: '检测提示', - content: - '当前菜单表是 Vue2版本,导致菜单加载异常!
点击确认,切换到Vue3版菜单!', - onOk:function () { - switchVue3Menu(); - location.reload(); - } - }), - 100 - ); - } + // let hasIndex: boolean = false; + // let hasIcon: boolean = false; + // for (let menuItem of routeList) { + // // 条件1:判断组件是否是 layouts/default/index + // if (!hasIndex) { + // hasIndex = menuItem.component === 'layouts/default/index'; + // } + // // 条件2:判断图标是否带有 冒号 + // if (!hasIcon) { + // hasIcon = !!menuItem.meta?.icon?.includes(':'); + // } + // // 满足任何一个条件都直接跳出循环 + // if (hasIcon || hasIndex) { + // break; + // } + // } + // // 两个条件都不满足,就弹出提示框 + // if (!hasIcon && !hasIndex) { + // // 延迟1.5秒之后再出现提示,否则提示框出不来 + // setTimeout( + // () => + // createWarningModal({ + // title: '检测提示', + // content: + // '当前菜单表是 Vue2版本,导致菜单加载异常!
点击确认,切换到Vue3版菜单!', + // onOk:function () { + // switchVue3Menu(); + // location.reload(); + // } + // }), + // 100 + // ); + // } // update-end----author:sunjianlei---date:20220315------for: 判断是否是 vue3 版本的菜单 --- } catch (error) { console.error(error);