注释掉vue2与vue3菜单切换

pull/1164/head
JEECG 2024-03-18 11:04:43 +08:00
parent b4539da84c
commit e4424ba3b1
2 changed files with 43 additions and 40 deletions

View File

@ -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版本逻辑代码

View File

@ -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:
'当前菜单表是 <b>Vue2版本</b>,导致菜单加载异常!<br>点击确认切换到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:
// '当前菜单表是 <b>Vue2版本</b>,导致菜单加载异常!<br>点击确认切换到Vue3版菜单',
// onOk:function () {
// switchVue3Menu();
// location.reload();
// }
// }),
// 100
// );
// }
// update-end----author:sunjianlei---date:20220315------for: 判断是否是 vue3 版本的菜单 ---
} catch (error) {
console.error(error);