From de11a6d14646caca1972ef643de23e6180892e64 Mon Sep 17 00:00:00 2001 From: margrop <1731827+margrop@users.noreply.github.com> Date: Wed, 2 Dec 2026 03:10:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=94=99=E9=A2=98=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A2=98=E7=9B=AE=E4=B8=8E=E8=A7=A3=E6=9E=90=E5=90=8C=E5=B1=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 桌面改为双列:左侧题目与作答,右侧解析与错因,题目和解析同屏可见 - 移动端保持单列堆叠 - E2E 覆盖桌面同屏与移动端堆叠布局 Refs: https://github.com/margrop/wrong-notebook/issues/56 --- e2e/error-detail.spec.ts | 17 ++++++ src/app/error-items/[id]/page.tsx | 86 ++++++++++++++++--------------- 2 files changed, 61 insertions(+), 42 deletions(-) diff --git a/e2e/error-detail.spec.ts b/e2e/error-detail.spec.ts index ddce142d..8b4b25b4 100644 --- a/e2e/error-detail.spec.ts +++ b/e2e/error-detail.spec.ts @@ -68,6 +68,23 @@ test('错题详情页显示各区块,编辑后保存并在刷新后保留', as await expect(card(page, /^解析$/)).toContainText('路程等于速度乘以时间。'); await expect(card(page, '你的笔记 / 答案')).toContainText('暂无笔记'); + // 桌面双列:题目与解析顶部对齐且同屏可见(#56) + const questionBox = await card(page, '题目').boundingBox(); + const analysisBox = await card(page, /^解析$/).boundingBox(); + expect(questionBox).not.toBeNull(); + expect(analysisBox).not.toBeNull(); + expect(Math.abs(questionBox!.y - analysisBox!.y)).toBeLessThan(8); + expect(Math.max(questionBox!.y, analysisBox!.y) + Math.min(questionBox!.height, analysisBox!.height)).toBeLessThan(900); + + // 移动端恢复单列堆叠,解析排在题目之后 + await page.setViewportSize({ width: 390, height: 844 }); + const stackedQuestionBox = await card(page, '题目').boundingBox(); + const stackedAnalysisBox = await card(page, /^解析$/).boundingBox(); + expect(stackedQuestionBox).not.toBeNull(); + expect(stackedAnalysisBox).not.toBeNull(); + expect(stackedAnalysisBox!.y).toBeGreaterThan(stackedQuestionBox!.y); + await page.setViewportSize({ width: 1280, height: 900 }); + // 年级有明确编辑入口,跨学段修改后持久保存。 await page.getByRole('heading', { name: '试题信息' }).locator('..').getByRole('button', { name: '编辑' }).click(); await page.getByRole('combobox', { name: '年级/学期' }).selectOption('高二下'); diff --git a/src/app/error-items/[id]/page.tsx b/src/app/error-items/[id]/page.tsx index 0adbdb59..8946e3e9 100644 --- a/src/app/error-items/[id]/page.tsx +++ b/src/app/error-items/[id]/page.tsx @@ -167,50 +167,52 @@ export default function ErrorDetailPage() { - + {/* 桌面双列:左侧题目与作答,右侧解析与错因,题目和解析同屏可见;移动端按自然阅读顺序堆叠 */} +
+
+ - + saveFields({ answerText })} + logLabel="answer" + rows={5} + placeholder="Enter answer..." + cardClassName="border-primary/20" + titleClassName="text-primary" + contentClassName="font-semibold" + headerActions={ updateItem({ answerText: updated.answerText ?? "", analysis: updated.analysis ?? "" })} onReload={reload} />} + > + {item.referenceImageUrl && ( +
+ +
+ )} +
+ +
-
- saveFields({ answerText })} - logLabel="answer" - rows={5} - placeholder="Enter answer..." - cardClassName="border-primary/20" - titleClassName="text-primary" - contentClassName="font-semibold" - headerActions={ updateItem({ answerText: updated.answerText ?? "", analysis: updated.analysis ?? "" })} onReload={reload} />} - > - {item.referenceImageUrl && ( -
- -
- )} -
- -
- -
- saveFields({ analysis })} - logLabel="analysis" - rows={12} - placeholder="Enter analysis..." - /> - saveFields({ mistakeAnalysis })} - logLabel="mistake analysis" - rows={8} - editorLabel={t.editor?.mistakeAnalysis || "Mistake Cause Analysis"} - emptyText={t.detail?.noMistakeAnalysis || "No mistake analysis yet."} - /> +
+ saveFields({ analysis })} + logLabel="analysis" + rows={12} + placeholder="Enter analysis..." + /> + saveFields({ mistakeAnalysis })} + logLabel="mistake analysis" + rows={8} + editorLabel={t.editor?.mistakeAnalysis || "Mistake Cause Analysis"} + emptyText={t.detail?.noMistakeAnalysis || "No mistake analysis yet."} + /> + +