|
@@ -11,36 +11,6 @@ import { ActionType } from "@/store/modules/app/actions";
|
|
const WHITE_URL_LIST: string[] = ["/login", "/forget"];
|
|
const WHITE_URL_LIST: string[] = ["/login", "/forget"];
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 权限动态路由合并
|
|
|
|
- * TODO 外部封装next函数有问题
|
|
|
|
- * @param to
|
|
|
|
- * @param next
|
|
|
|
- */
|
|
|
|
-const generatorRoutes = async (
|
|
|
|
- to: RouteLocationNormalized,
|
|
|
|
- next: NavigationGuardNext
|
|
|
|
-) => {
|
|
|
|
- const roles = store.getters["system/userRoles"];
|
|
|
|
- if (roles.length) next();
|
|
|
|
- else {
|
|
|
|
- const userRoles: string[] = await store.dispatch("system/getUserRoles");
|
|
|
|
- const webRoutes: RouteConfig[] = await store.dispatch(
|
|
|
|
- "system/generatorRoutes",
|
|
|
|
- userRoles
|
|
|
|
- );
|
|
|
|
- const AppRoute: RouteConfig = {
|
|
|
|
- name: "home",
|
|
|
|
- path: "/",
|
|
|
|
- redirect: webRoutes[0].path,
|
|
|
|
- component: Layout,
|
|
|
|
- children: webRoutes,
|
|
|
|
- };
|
|
|
|
- router.addRoute(AppRoute);
|
|
|
|
- next({ ...to, replace: true, name: to.name! });
|
|
|
|
- }
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
* 未登录的情况下 路由的处理
|
|
* 未登录的情况下 路由的处理
|
|
* @param to
|
|
* @param to
|
|
* @param next
|
|
* @param next
|