mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-11-13 12:13:43 +08:00
feat(projects): 新增静态路由
This commit is contained in:
@@ -15,9 +15,9 @@ export async function createDynamicRouteGuard(
|
||||
const route = useRouteStore();
|
||||
const isLogin = Boolean(getToken());
|
||||
|
||||
// 初始化动态路由
|
||||
if (!route.isAddedDynamicRoute) {
|
||||
// 未登录情况下直接回到登录页,登录成功后再加载动态路由
|
||||
// 初始化权限路由
|
||||
if (!route.isInitedAuthRoute) {
|
||||
// 未登录情况下直接回到登录页,登录成功后再加载权限路由
|
||||
if (!isLogin) {
|
||||
if (to.name === routeName('login')) {
|
||||
next();
|
||||
@@ -28,16 +28,16 @@ export async function createDynamicRouteGuard(
|
||||
return false;
|
||||
}
|
||||
|
||||
await route.initDynamicRoute(router);
|
||||
await route.initAuthRoute(router);
|
||||
|
||||
if (to.name === routeName('not-found-page')) {
|
||||
// 动态路由没有加载导致被not-found-page路由捕获,等待动态路由加载好了,回到之前的路由
|
||||
// 动态路由没有加载导致被not-found-page路由捕获,等待权限路由加载好了,回到之前的路由
|
||||
next({ path: to.fullPath, replace: true, query: to.query });
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 动态路由已经加载,仍然未找到,重定向到not-found
|
||||
// 权限路由已经加载,仍然未找到,重定向到not-found
|
||||
if (to.name === routeName('not-found-page')) {
|
||||
next({ name: routeName('not-found'), replace: true });
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user