From cdf1d4f096d7adfd9096e49aac433c1abc59c0ba Mon Sep 17 00:00:00 2001 From: yorn <1057707203@qq.com> Date: Tue, 14 Apr 2026 09:45:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E4=BA=A4=E5=8F=89=E8=AF=84=E6=9F=A5=E5=92=8C=E7=9F=A5=E8=AF=86?= =?UTF-8?q?=E5=BA=93=E5=85=A5=E5=8F=A3=E7=9A=84=E6=B8=B2=E6=9F=93=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/routes/_index.tsx | 105 ++++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 54 deletions(-) diff --git a/app/routes/_index.tsx b/app/routes/_index.tsx index 330015c..c109476 100644 --- a/app/routes/_index.tsx +++ b/app/routes/_index.tsx @@ -59,6 +59,7 @@ export async function loader({ request }: LoaderFunctionArgs) { if (userRole && frontendJWT) { const { getUserRoutesByRole } = await import('~/api/auth/user-routes'); const routesResult = await getUserRoutesByRole(userRole, frontendJWT, true); // includeHidden=true + // console.log('🔍 [Index Loader] 顶级路由paths:', routesResult.data?.map(r => r.path)); if (routesResult.success && routesResult.data) { // 查找 '/settings' 路由及其子路由 @@ -439,7 +440,6 @@ export default function Index() { loaderData.entryModules && loaderData.entryModules.length > 0 ? ( <> {loaderData.entryModules.map((module) => { - // 判断是否为智慧法务助手,如果是且有交叉评查权限,则在其之前插入交叉评查卡片 const isLLMModule = module.name === '智慧法务助手'; // 🔑 如果是智慧法务助手且用户没有访问权限,则不渲染该模块 @@ -448,61 +448,58 @@ export default function Index() { } return ( - - {/* 在智慧法务助手之前插入交叉评查入口 */} - {isLLMModule && loaderData.hasCrossCheckingAccess && ( -
{ - if (e.key === 'Enter' || e.key === ' ') { - handleEnterCrossChecking(); - } - }} - role="button" - tabIndex={0} - aria-label="交叉评查" - > - 交叉评查 { - // 如果图片加载失败,使用 icon - (e.target as HTMLImageElement).style.display = 'none'; - const parent = (e.target as HTMLImageElement).parentElement; - if (parent) { - const icon = document.createElement('i'); - icon.className = 'ri-shuffle-line'; - icon.style.fontSize = '48px'; - icon.style.color = 'var(--color-primary)'; - parent.insertBefore(icon, parent.firstChild); - } - }} - /> - 交叉评查 -
- )} - - {/* 渲染原有模块 */} -
handleModuleClick(module)} - onKeyDown={(e) => handleKeyDown(module, e)} - role="button" - tabIndex={0} - aria-label={module.name} - > - {module.name} - {module.name} -
-
+
handleModuleClick(module)} + onKeyDown={(e) => handleKeyDown(module, e)} + role="button" + tabIndex={0} + aria-label={module.name} + > + {module.name} + {module.name} +
); })} + + {/* 交叉评查入口 - 独立渲染,不依赖智慧法务助手模块 */} + {loaderData.hasCrossCheckingAccess && ( +
{ + if (e.key === 'Enter' || e.key === ' ') { + handleEnterCrossChecking(); + } + }} + role="button" + tabIndex={0} + aria-label="交叉评查" + > + 交叉评查 { + (e.target as HTMLImageElement).style.display = 'none'; + const parent = (e.target as HTMLImageElement).parentElement; + if (parent) { + const icon = document.createElement('i'); + icon.className = 'ri-shuffle-line'; + icon.style.fontSize = '48px'; + icon.style.color = 'var(--color-primary)'; + parent.insertBefore(icon, parent.firstChild); + } + }} + /> + 交叉评查 +
+ )} ) : (