feat(access): 实现基于用户角色的路由权限控制

添加权限检查功能,包括用户角色定义、路由元信息扩展和权限验证逻辑
重构路由配置和用户存储,支持动态菜单过滤
更新构建配置以支持类型声明生成
This commit is contained in:
2025-11-15 20:11:05 +08:00
parent a98eae385f
commit 8aa1f313af
10 changed files with 144 additions and 24 deletions

View File

@@ -1,8 +1,21 @@
import type {RouteRecordRaw} from "vue-router";
import type { RouteRecordRaw } from "vue-router";
import HomeView from "../views/HomeView.vue";
import AboutView from "../views/AboutView.vue";
import ACCESS_ENUM from "../access/accessEnum";
/**
* 路由配置
*/
export const routes: Array<RouteRecordRaw> = [
{path: "/home", name: "HomeView", component: HomeView},
{path: "/about", name: "AboutView", component: AboutView},
{
path: "/home",
name: "HomeView",
component: HomeView,
meta: { hideInMenu: false, access: ACCESS_ENUM.NOT_LOGIN },
},
{
path: "/about",
name: "AboutView",
component: AboutView,
meta: { hideInMenu: false, access: ACCESS_ENUM.NOT_LOGIN },
},
];