Admin
2022-09-21 999cab6fb3fc6d2a288d365da991351c5a396bf0
src/router/backEnd.ts
@@ -3,7 +3,6 @@
import pinia from '/@/stores/index';
import { useUserInfo } from '/@/stores/userInfo';
import { useRequestOldRoutes } from '/@/stores/requestOldRoutes';
import { Session } from '/@/utils/storage';
import { NextLoading } from '/@/utils/loading';
import { dynamicRoutes, notFoundAndNoPower } from '/@/router/route';
import { formatTwoStageRoutes, formatFlatteningRoutes, router } from '/@/router/index';
@@ -11,6 +10,7 @@
import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
import { useMenuApi } from '/@/api/systemManage/menu/index';
import { ElMessage } from 'element-plus';
import Cookies from 'js-cookie';
const menuApi = useMenuApi();
@@ -26,8 +26,8 @@
export async function initBackEndControlRoutes() {
    if (window.nextLoading === undefined) NextLoading.start();
    if (!Session.get('token')) return false;
    const res = await getBackEndControlRoutes(Session.get('projectId') === null ? '' : Session.get('projectId'));
    if (!Cookies.get('token')) return false;
    const res = await getBackEndControlRoutes(Cookies.get('projectId') === null ? '' : Cookies.get('projectId'));
    await useRequestOldRoutes().setRequestOldRoutes(JSON.parse(JSON.stringify(res.data.data)));
    dynamicRoutes[0].children = await backEndComponent(res.data.data);
    await setAddRoute();
@@ -67,10 +67,10 @@
/**
 * 重新请求后端路由菜单接口
 * @description 用于菜单管理界面刷新菜单(未进行测试)
 * @description 路径:/src/views/system/homeMenu/component/menuDialog.vue
 * @description 路径:/src/views/system/homeMenu/components/menuDialog.vue
 */
export function setBackEndControlRefreshRoutes() {
    getBackEndControlRoutes(Session.get('projectId'));
    getBackEndControlRoutes(Cookies.get('projectId'));
}
export function backEndComponent(routes: any) {