feat: 1. 本地化思源黑体的字体包并优先使用。
2. 添加权限映射表和全局查看权限的hook,便于路由控制不同权限按钮显示/隐藏。 3. 删除评查点分组的部分旧api方法。 4. 对接评查点分组接口,文档类型接口, 提示词管理接口, 入口模块管理的接口。 5. 优化角色权限管理的接口,完善不用地区的访问权限认证。 6. 优化主页交叉评查和设置的入口样式和布局。 7. 优化评查点分组,评查规则的功能权限校验。
This commit is contained in:
@@ -27,6 +27,7 @@ import "remixicon/fonts/remixicon.css";
|
||||
import styles from "~/styles/main.css?url";
|
||||
import messageModalStyles from "~/styles/components/message-modal.css?url";
|
||||
import toastStyles from "~/styles/components/toast.css?url";
|
||||
import sourceHanSansStyles from "~/styles/fonts/source-han-sans.css?url";
|
||||
import LoadingBarContainer from "~/components/ui/LoadingBar";
|
||||
import RouteChangeLoader from "~/components/ui/RouteChangeLoader";
|
||||
// import { useState, useEffect } from "react";
|
||||
@@ -124,6 +125,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
||||
let userRole: UserRole = 'common'; // 默认为普通用户
|
||||
let frontendJWT: string | null = null;
|
||||
let allowedPaths: string[] = []; // 用户允许访问的路由列表
|
||||
let permissionMap: Record<string, string[]> = {}; // ✅ 权限映射表
|
||||
|
||||
if (!isPublicPath) {
|
||||
try {
|
||||
@@ -166,6 +168,12 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
||||
allowedPaths = extractAllPaths(routesResult.data);
|
||||
// console.log("🔑 [Root Loader] 用户允许的路由:", allowedPaths);
|
||||
|
||||
// ✅ 保存权限映射表
|
||||
if (routesResult.permissionMap) {
|
||||
permissionMap = routesResult.permissionMap;
|
||||
console.log("🔑 [Root Loader] 权限映射表:", permissionMap);
|
||||
}
|
||||
|
||||
// 检查当前路径是否在允许列表中
|
||||
const isAllowedPath = isPathAllowed(pathname, allowedPaths);
|
||||
|
||||
@@ -240,6 +248,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
||||
pathname,
|
||||
frontendJWT,
|
||||
isPublicPath, // 传递给客户端,用于判断是否需要认证
|
||||
permissionMap, // ✅ 传递权限映射表
|
||||
ENV: {
|
||||
// 客户端不再需要直接调用 Dify API
|
||||
},
|
||||
@@ -263,9 +272,11 @@ export function links() {
|
||||
{ rel: "stylesheet", href: styles },
|
||||
{ rel: "stylesheet", href: messageModalStyles },
|
||||
{ rel: "stylesheet", href: toastStyles },
|
||||
{ rel: "stylesheet", href: sourceHanSansStyles }, // 思源黑体字体
|
||||
// 添加 Antd 样式
|
||||
// { rel: "stylesheet", href: "https://cdn.jsdelivr.net/npm/antd@5/dist/reset.css" },
|
||||
{ rel: "icon", type: "image/svg+xml", href: "/logo.svg" },
|
||||
// Google Fonts(已弃用,改用本地字体)
|
||||
// { rel: "preconnect", href: "https://fonts.googleapis.com" },
|
||||
// { rel: "preconnect", href: "https://fonts.gstatic.com", crossOrigin: "anonymous" },
|
||||
// { rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap" }
|
||||
|
||||
Reference in New Issue
Block a user