first commit

This commit is contained in:
muzi
2025-06-16 14:42:26 +08:00
commit 6f06721506
149 changed files with 56883 additions and 0 deletions

View File

@ -0,0 +1,29 @@
/*
* @Author: 田鑫
* @Date: 2023-03-05 14:46:43
* @LastEditors: 田鑫
* @LastEditTime: 2023-03-05 15:55:36
* @Description: 路由权限守卫
*/
import type { Router, RouteRecordNormalized } from 'vue-router';
import NProgress from 'nprogress'; // progress bar
import { useAppStore } from '@/stores';
export default function setupPermissionGuard(router: Router) {
router.beforeEach(async (to, from, next) => {
console.log('access permission router guard');
const appStore = useAppStore();
//* 菜单是否为服务端渲染
if (appStore.menuFromServer) {
//* 没有服务端渲染的菜单
if(!appStore.appAsyncMenus) {
// todo 请求服务端渲染菜单的接口当前为mock数据
await appStore.fetchServerMenuConfig();
}
next();
} else {
next();
}
NProgress.done();
});
}