This commit is contained in:
Eric
2026-02-09 11:24:51 +08:00
commit f2173a9fa9
491 changed files with 43791 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
/**
* 路由守卫模块
* 提供基于权限的路由拦截和未登录自动跳转登录页功能
*/
import { Auth } from '../core/auth';
/**
* 路由守卫选项
*/
export interface RouterGuardOptions {
/**
* 是否需要登录
*/
requiresAuth?: boolean;
/**
* 需要的权限列表
*/
requiredPermissions?: string[];
/**
* 登录后重定向的URL
*/
redirectUri?: string;
/**
* 权限不足时重定向的URL
*/
unauthorizedRedirectUri?: string;
}
/**
* 路由守卫类
*/
export declare class RouterGuard {
private auth;
/**
* 构造函数
* @param auth 认证实例
*/
constructor(auth: Auth);
/**
* 检查路由权限
* @param options 路由守卫选项
* @returns Promise<boolean> 是否通过权限检查
*/
check(options: RouterGuardOptions): Promise<boolean>;
/**
* 创建Vue路由守卫
* @returns 路由守卫函数
*/
createVueGuard(): (to: any, from: any, next: any) => Promise<void>;
/**
* 检查当前用户是否有权限访问资源
* @param permissions 需要的权限列表
* @returns Promise<boolean> 是否拥有权限
*/
hasPermission(permissions: string | string[]): Promise<boolean>;
}
//# sourceMappingURL=router.d.ts.map