From 78413e98d7c4808b8a9c7f42c25e7e0050170b59 Mon Sep 17 00:00:00 2001 From: yanlongqi Date: Tue, 18 Nov 2025 02:44:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=A1=AB=E7=A9=BA=E9=A2=98?= =?UTF-8?q?=E4=B8=8B=E5=88=92=E7=BA=BF=E6=9C=80=E5=B0=8F=E9=95=BF=E5=BA=A6?= =?UTF-8?q?=E4=B8=BA8=E4=B8=AA=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 将填空题下划线最小宽度从2个字符(8px)调整为8个字符(32px) 2. 更新默认宽度策略:单个填空32px,多个填空30-40px循环 3. 确保无论答案长度如何,下划线都有足够的空间供用户书写 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- web/src/pages/ExamPrint.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/web/src/pages/ExamPrint.tsx b/web/src/pages/ExamPrint.tsx index e19bc5d..9b1284d 100644 --- a/web/src/pages/ExamPrint.tsx +++ b/web/src/pages/ExamPrint.tsx @@ -156,23 +156,23 @@ const ExamPrint: React.FC = () => { // 优先使用 answer_lengths 字段(在 show_answer=false 时也会返回) if (question.answer_lengths && question.answer_lengths[blankIndex] !== undefined) { const answerLength = question.answer_lengths[blankIndex] - // 每个字符对应约4px宽度,最少2个字符=8px,最多60px - return Math.max(Math.max(answerLength, 2) * 4, 8) + // 每个字符对应约4px宽度,最少8个字符=32px,最多60px + return Math.max(Math.max(answerLength, 8) * 4, 32) } // 如果有实际的答案数据,使用答案长度 if (answers[blankIndex]) { const answerText = String(answers[blankIndex]) - // 每个字符对应约4px宽度,最少2个字符=8px - return Math.max(Math.max(answerText.length, 2) * 4, 8) + // 每个字符对应约4px宽度,最少8个字符=32px + return Math.max(Math.max(answerText.length, 8) * 4, 32) } // 如果没有任何答案数据,使用默认策略 if (totalBlanks === 1) { - return 20 // 单个填空:20px(约5个字符) + return 32 // 单个填空:32px(约8个字符) } else { - // 多个填空:15-25px循环(4-6个字符) - const widths = [15, 20, 25, 18, 22] + // 多个填空:30-40px循环(约8-10个字符) + const widths = [32, 36, 40, 34, 38] return widths[blankIndex % widths.length] } }