chore: update deps

This commit is contained in:
vben
2024-06-01 22:17:52 +08:00
parent c531f0c154
commit f7b97e8a83
47 changed files with 569 additions and 322 deletions

View File

@@ -2,13 +2,12 @@ import type { ExRouteRecordRaw, MenuRecordRaw } from '@vben/types';
import type { RouteRecordRaw, Router } from 'vue-router';
import { LOGIN_PATH } from '@vben/constants';
import { useAccessStore } from '@vben/stores';
import { filterTree, mapTree, traverseTreeValues } from '@vben/utils';
import { dynamicRoutes } from '../routes';
import { dynamicRoutes } from '@/router/routes';
// 登录页面路由 path
const LOGIN_ROUTE_PATH = '/auth/login';
// 不需要权限的页面白名单
const WHITE_ROUTE_NAMES = new Set<string>([]);
@@ -29,14 +28,15 @@ function configAccessGuard(router: Router) {
}
// 白名单路由列表检查
// TODO: 不是很需要,通过 ignoreAccess 也可以做到,考虑删除
if (WHITE_ROUTE_NAMES.has(to.name as string)) {
return true;
}
// 没有访问权限,跳转登录页面
if (to.fullPath !== LOGIN_ROUTE_PATH) {
if (to.fullPath !== LOGIN_PATH) {
return {
path: LOGIN_ROUTE_PATH,
path: LOGIN_PATH,
// 如不需要,直接删除 query
query: { redirect: encodeURIComponent(to.fullPath) },
// 携带当前跳转的页面,登录后重新跳转该页面

View File

@@ -12,9 +12,11 @@ import { configAccessGuard } from './access';
* @param router
*/
function configCommonGuard(router: Router) {
// 记录已经加载的页面
const loadedPaths = new Set<string>();
router.beforeEach(async (to) => {
// 页面加载进度条
if (preference.pageProgress) {
startProgress();
}
@@ -25,6 +27,8 @@ function configCommonGuard(router: Router) {
router.afterEach((to) => {
// 记录页面是否加载,如果已经加载,后续的页面切换动画等效果不在重复执行
loadedPaths.add(to.path);
// 关闭页面加载进度条
if (preference.pageProgress) {
stopProgress();
}