feat: 初步完成评查详情页面的work文档和pdf文档的加载的页面三栏设计的重构。

This commit is contained in:
2026-04-21 15:08:14 +08:00
parent 4e19672b38
commit a3fd2c7fed
13 changed files with 1781 additions and 332 deletions
+21 -7
View File
@@ -15,6 +15,8 @@ interface LayoutProps {
// 添加一个接口表示路由handle可能包含的属性
interface RouteHandle {
hideBreadcrumb?: boolean;
collapseSidebar?: boolean;
noPadding?: boolean;
[key: string]: unknown;
}
@@ -42,6 +44,11 @@ export function Layout({ children, userRole = 'developer' as UserRole, frontendJ
match.handle && match.handle.hideBreadcrumb === true
);
// 检查当前路由是否要求无 padding
const shouldNoPadding = matches.some(match =>
match.handle && match.handle.noPadding === true
);
// 从 localStorage 读取用户信息和 JWT 作为备用方案
useEffect(() => {
if (typeof window === 'undefined') return;
@@ -80,16 +87,23 @@ export function Layout({ children, userRole = 'developer' as UserRole, frontendJ
// 检查是否为移动端
const isMobile = window.innerWidth <= 768;
// 从localStorage获取侧边栏状态
const savedState = localStorage.getItem('sidebarCollapsed');
// 检查当前路由是否要求收缩侧边栏
const shouldCollapse = matches.some(match =>
match.handle && match.handle.collapseSidebar === true
);
// 移动端默认收起,桌面端使用保存的状态
if (isMobile) {
setSidebarCollapsed(true);
} else if (savedState) {
setSidebarCollapsed(savedState === 'true');
} else if (shouldCollapse) {
setSidebarCollapsed(true);
} else {
// 从localStorage获取侧边栏状态
const savedState = localStorage.getItem('sidebarCollapsed');
if (savedState) {
setSidebarCollapsed(savedState === 'true');
}
}
}, []);
}, [location.pathname]);
const toggleSidebar = () => {
const newState = !sidebarCollapsed;
@@ -135,7 +149,7 @@ export function Layout({ children, userRole = 'developer' as UserRole, frontendJ
))}
</div> */}
<div className="content-container">
<div className={`content-container${shouldNoPadding ? ' !p-0' : ''}`}>
{!shouldHideBreadcrumb && <Breadcrumb />}
{children}
</div>