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] } }