From 8f96865ebf6e01417f6197e2da6f62fd3f1a6b95 Mon Sep 17 00:00:00 2001 From: ittoview Date: Sun, 1 Mar 2026 16:31:02 +0000 Subject: [PATCH] =?UTF-8?q?fix(=E7=BB=83=E4=B9=A0):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=B5=8C=E5=A5=97=E6=BB=9A=E5=8A=A8=E5=92=8C=E5=BA=95=E9=83=A8?= =?UTF-8?q?=E7=A9=BA=E7=99=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Layout: 将 h-screen 改为 min-h-screen,移除嵌套滚动容器 - ProcessPracticePage: 底部区域从 fixed 改为 sticky,移除动态高度计算 - 使用 flex 布局管理页面结构,消除双滚动条和大片空白 - 清理未使用的 state 和 imports via [HAPI](https://hapi.run) Co-Authored-By: HAPI --- src/components/layout/Layout.tsx | 6 +++--- src/pages/ProcessPracticePage.tsx | 35 +++++-------------------------- 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/src/components/layout/Layout.tsx b/src/components/layout/Layout.tsx index 0dc9c36..0725ca5 100644 --- a/src/components/layout/Layout.tsx +++ b/src/components/layout/Layout.tsx @@ -14,19 +14,19 @@ export function Layout({ children }: LayoutProps) { return (
-
+
{/* 侧边栏 */} {/* 主内容区 */} -
+
{/* 顶部导航 */}
{/* 页面内容 */}
diff --git a/src/pages/ProcessPracticePage.tsx b/src/pages/ProcessPracticePage.tsx index d7c8107..fd37fd2 100644 --- a/src/pages/ProcessPracticePage.tsx +++ b/src/pages/ProcessPracticePage.tsx @@ -9,14 +9,10 @@ import { import { PracticeMatrix } from '@/components/practice/PracticeMatrix' import { InputArea } from '@/components/practice/InputArea' import { HintInfo } from '@/components/practice/HintInfo' -import { useAppStore } from '@/stores/useAppStore' -import { clsx } from 'clsx' type CharStatus = 'pending' | 'correct' | 'error' export default function ProcessPracticePage() { - const sidebarOpen = useAppStore((s) => s.sidebarOpen) - // 生成格子顺序 const [cellSequence] = useState(() => generateCellSequence()) @@ -64,8 +60,6 @@ export default function ProcessPracticePage() { } | null>(null) const [inputLocked, setInputLocked] = useState(false) const latestInputRef = useRef([]) - const bottomAreaRef = useRef(null) - const [bottomHeight, setBottomHeight] = useState(0) // 初始化输入框 useEffect(() => { @@ -96,19 +90,6 @@ export default function ProcessPracticePage() { } }, [answeredCells, currentCellId]) - // 动态计算底部固定区域高度 - useEffect(() => { - const updateBottomHeight = () => { - if (bottomAreaRef.current) { - setBottomHeight(bottomAreaRef.current.offsetHeight) - } - } - - updateBottomHeight() - window.addEventListener('resize', updateBottomHeight) - return () => window.removeEventListener('resize', updateBottomHeight) - }, [userInput.length]) // 当输入框数量变化时重新计算 - // 切换到指定格子 const switchToCell = useCallback( (cell: CellInfo) => { @@ -371,7 +352,7 @@ export default function ProcessPracticePage() { }, [cellSequence]) return ( -
+
{/* 顶部进度条 */}
@@ -405,7 +386,7 @@ export default function ProcessPracticePage() {
{/* 主内容区域 */} -
+
{/* 矩阵区域 */}
- {/* 底部固定区域 */} -
-
+ {/* 底部固定区域(粘附底部,参与文档流) */} +
+
{/* 输入区域 */}