diff --git a/web/src/pages/ExamPrint.module.less b/web/src/pages/ExamPrint.module.less index ac7ee1d..8c7605b 100644 --- a/web/src/pages/ExamPrint.module.less +++ b/web/src/pages/ExamPrint.module.less @@ -205,7 +205,7 @@ display: none !important; } - // A4纸张设置 - 增加边距以确保圆角不被遮挡 + // A4纸张设置 @page { size: A4; margin: 1cm; @@ -225,6 +225,9 @@ .paperHeader { margin-bottom: 6px; padding-bottom: 4px; + // 防止试卷标题和考试说明分页 + page-break-after: avoid; + page-break-inside: avoid; .paperTitle { font-size: 16pt !important; @@ -256,6 +259,9 @@ overflow: visible; // 添加一些内边距确保圆角有空间显示 padding: 2px; + // 防止考试说明和填空题分页 + page-break-after: avoid; + page-break-inside: avoid; :global(.ant-card-body) { padding: 6px; @@ -280,10 +286,18 @@ .questionGroup { margin-bottom: 8px; + // 防止题型组内部分页 + page-break-inside: avoid; + // 尽量让下一个题型紧接着显示 + page-break-after: avoid; .groupHeader { + display: flex; + align-items: baseline; margin-bottom: 4px; padding-bottom: 2px; + // 确保题型标题和第一道题在同一页 + page-break-after: avoid; .groupTitle { font-size: 12pt; @@ -291,12 +305,15 @@ .groupScore { font-size: 10pt; + margin-left: 8px; } } } .questionItem { margin-bottom: 6px; + // 防止题目内部分页,保持题目完整性 + page-break-inside: avoid; .questionContent { margin-bottom: 3px; diff --git a/web/src/pages/ExamPrint.tsx b/web/src/pages/ExamPrint.tsx index 32f6537..7b9f8b5 100644 --- a/web/src/pages/ExamPrint.tsx +++ b/web/src/pages/ExamPrint.tsx @@ -352,14 +352,14 @@ const ExamPrint: React.FC = () => { return (