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); + } + }} + /> + 交叉评查 +
+ )} ) : (