mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): new storage system [新的本地数据存储系统]
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import type { NavigationGuardNext, RouteLocationNormalized } from 'vue-router';
|
||||
import { routeName } from '@/router';
|
||||
import { useRouteStore } from '@/store';
|
||||
import { getToken } from '@/utils';
|
||||
import { localStg } from '@/utils';
|
||||
|
||||
/**
|
||||
* 动态路由
|
||||
@ -12,7 +12,7 @@ export async function createDynamicRouteGuard(
|
||||
next: NavigationGuardNext
|
||||
) {
|
||||
const route = useRouteStore();
|
||||
const isLogin = Boolean(getToken());
|
||||
const isLogin = Boolean(localStg.get('token'));
|
||||
|
||||
// 初始化权限路由
|
||||
if (!route.isInitAuthRoute) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { NavigationGuardNext, RouteLocationNormalized } from 'vue-router';
|
||||
import { routeName } from '@/router';
|
||||
import { useAuthStore } from '@/store';
|
||||
import { exeStrategyActions, getToken } from '@/utils';
|
||||
import { exeStrategyActions, localStg } from '@/utils';
|
||||
import { createDynamicRouteGuard } from './dynamic';
|
||||
|
||||
/** 处理路由页面的权限 */
|
||||
@ -22,7 +22,7 @@ export async function createPermissionGuard(
|
||||
}
|
||||
|
||||
const auth = useAuthStore();
|
||||
const isLogin = Boolean(getToken());
|
||||
const isLogin = Boolean(localStg.get('token'));
|
||||
const permissions = to.meta.permissions || [];
|
||||
const needLogin = Boolean(to.meta?.requiresAuth) || Boolean(permissions.length);
|
||||
const hasPermission = !permissions.length || permissions.includes(auth.userInfo.userRole);
|
||||
|
Reference in New Issue
Block a user