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 (
- + {TYPE_NAME[type]} - - {TYPE_SCORE[type] > 0 && ( - - (共{questions.length}题,每题{TYPE_SCORE[type]}分,共{totalScore}分) - - )} + {TYPE_SCORE[type] > 0 && ( + + (共{questions.length}题,每题{TYPE_SCORE[type]}分,共{totalScore}分) + + )} +
{questions.map((question, index) => { @@ -464,12 +464,12 @@ const ExamPrint: React.FC = () => { {essayQuestions.length > 0 && (
- + {TYPE_NAME['ordinary-essay']} - - - (以下2道论述题任选1道作答,共9分) - + + (以下2道论述题任选1道作答,共9分) + +
{essayQuestions.map((question, index) => renderEssay(question, index))} diff --git a/web/vite.config.ts b/web/vite.config.ts index 1c52384..7da336f 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -31,7 +31,7 @@ export default defineConfig({ port: 3000, proxy: { '/api': { - target: 'https://ankao.yuchat.top', + target: 'http://127.0.0.1:8080', changeOrigin: true, }, },