|
@@ -6,6 +6,8 @@
|
|
|
|
|
|
|
|
// 是否在题干后显示题目ID (Q000123)
|
|
// 是否在题干后显示题目ID (Q000123)
|
|
|
$showQuestionId = config('exam.show_question_id_in_pdf', false);
|
|
$showQuestionId = config('exam.show_question_id_in_pdf', false);
|
|
|
|
|
+ // 判卷模式是否显示题目题干与选项,默认显示;可通过 EXAM_PDF_GRADING_SHOW_STEM 关闭
|
|
|
|
|
+ $showGradingStem = config('exam.pdf_grading_show_stem', true);
|
|
|
|
|
|
|
|
// 格式化题目ID为6位补0格式
|
|
// 格式化题目ID为6位补0格式
|
|
|
$formatQuestionId = function($id) {
|
|
$formatQuestionId = function($id) {
|
|
@@ -191,13 +193,15 @@
|
|
|
@endif
|
|
@endif
|
|
|
<span class="question-number">{{ $gradingMode ? '题目 ' : '' }}{{ $questionNumber }}.</span>
|
|
<span class="question-number">{{ $gradingMode ? '题目 ' : '' }}{{ $questionNumber }}.</span>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="question-main">
|
|
|
|
|
- <span class="question-stem">{!! $renderedStem !!}</span>
|
|
|
|
|
- @if($showQuestionId && !empty($q->id))
|
|
|
|
|
- <span class="question-id" style="font-size:10px;color:#999;margin-left:4px;">{!! $formatQuestionId($q->id) !!}</span>
|
|
|
|
|
- @endif
|
|
|
|
|
- </div>
|
|
|
|
|
- @if(!empty($options))
|
|
|
|
|
|
|
+ @if(!$gradingMode || $showGradingStem)
|
|
|
|
|
+ <div class="question-main">
|
|
|
|
|
+ <span class="question-stem">{!! $renderedStem !!}</span>
|
|
|
|
|
+ @if($showQuestionId && !empty($q->id))
|
|
|
|
|
+ <span class="question-id" style="font-size:10px;color:#999;margin-left:4px;">{!! $formatQuestionId($q->id) !!}</span>
|
|
|
|
|
+ @endif
|
|
|
|
|
+ </div>
|
|
|
|
|
+ @endif
|
|
|
|
|
+ @if((!$gradingMode || $showGradingStem) && !empty($options))
|
|
|
@php
|
|
@php
|
|
|
// 计算选项长度并动态选择布局
|
|
// 计算选项长度并动态选择布局
|
|
|
$optCount = count($options);
|
|
$optCount = count($options);
|
|
@@ -265,7 +269,9 @@
|
|
|
? '<span style="color:#999;font-style:italic;">(暂无解题思路)</span>'
|
|
? '<span style="color:#999;font-style:italic;">(暂无解题思路)</span>'
|
|
|
: ($mathProcessed ? $solutionText : \App\Services\MathFormulaProcessor::processFormulas($solutionText));
|
|
: ($mathProcessed ? $solutionText : \App\Services\MathFormulaProcessor::processFormulas($solutionText));
|
|
|
@endphp
|
|
@endphp
|
|
|
- <div class="question-lead spacer"></div>
|
|
|
|
|
|
|
+ @if($showGradingStem)
|
|
|
|
|
+ <div class="question-lead spacer"></div>
|
|
|
|
|
+ @endif
|
|
|
<div class="answer-meta">
|
|
<div class="answer-meta">
|
|
|
<div class="answer-line"><strong>正确答案:</strong><span class="solution-content">{!! $mathProcessed ? ($q->answer ?? '') : \App\Services\MathFormulaProcessor::processFormulas($q->answer ?? '') !!}</span></div>
|
|
<div class="answer-line"><strong>正确答案:</strong><span class="solution-content">{!! $mathProcessed ? ($q->answer ?? '') : \App\Services\MathFormulaProcessor::processFormulas($q->answer ?? '') !!}</span></div>
|
|
|
<div class="answer-line"><strong>解题思路:</strong><span class="solution-content">{!! $solutionHtml !!}</span></div>
|
|
<div class="answer-line"><strong>解题思路:</strong><span class="solution-content">{!! $solutionHtml !!}</span></div>
|
|
@@ -338,12 +344,14 @@
|
|
|
@endif
|
|
@endif
|
|
|
<span class="question-number">{{ $gradingMode ? '题目 ' : '' }}{{ $questionNumber }}.</span>
|
|
<span class="question-number">{{ $gradingMode ? '题目 ' : '' }}{{ $questionNumber }}.</span>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="question-main">
|
|
|
|
|
- <span class="question-stem">{!! $renderedContent !!}</span>
|
|
|
|
|
- @if($showQuestionId && !empty($q->id))
|
|
|
|
|
- <span class="question-id" style="font-size:10px;color:#999;margin-left:4px;">{!! $formatQuestionId($q->id) !!}</span>
|
|
|
|
|
- @endif
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ @if(!$gradingMode || $showGradingStem)
|
|
|
|
|
+ <div class="question-main">
|
|
|
|
|
+ <span class="question-stem">{!! $renderedContent !!}</span>
|
|
|
|
|
+ @if($showQuestionId && !empty($q->id))
|
|
|
|
|
+ <span class="question-id" style="font-size:10px;color:#999;margin-left:4px;">{!! $formatQuestionId($q->id) !!}</span>
|
|
|
|
|
+ @endif
|
|
|
|
|
+ </div>
|
|
|
|
|
+ @endif
|
|
|
@if($gradingMode)
|
|
@if($gradingMode)
|
|
|
@php
|
|
@php
|
|
|
$solutionText = trim($q->solution ?? '');
|
|
$solutionText = trim($q->solution ?? '');
|
|
@@ -353,7 +361,9 @@
|
|
|
? '<span style="color:#999;font-style:italic;">(暂无解题思路)</span>'
|
|
? '<span style="color:#999;font-style:italic;">(暂无解题思路)</span>'
|
|
|
: ($mathProcessed ? $solutionText : \App\Services\MathFormulaProcessor::processFormulas($solutionText));
|
|
: ($mathProcessed ? $solutionText : \App\Services\MathFormulaProcessor::processFormulas($solutionText));
|
|
|
@endphp
|
|
@endphp
|
|
|
- <div class="question-lead spacer"></div>
|
|
|
|
|
|
|
+ @if($showGradingStem)
|
|
|
|
|
+ <div class="question-lead spacer"></div>
|
|
|
|
|
+ @endif
|
|
|
<div class="answer-meta">
|
|
<div class="answer-meta">
|
|
|
<div class="answer-line"><strong>正确答案:</strong><span class="solution-content">{!! $mathProcessed ? ($q->answer ?? '') : \App\Services\MathFormulaProcessor::processFormulas($q->answer ?? '') !!}</span></div>
|
|
<div class="answer-line"><strong>正确答案:</strong><span class="solution-content">{!! $mathProcessed ? ($q->answer ?? '') : \App\Services\MathFormulaProcessor::processFormulas($q->answer ?? '') !!}</span></div>
|
|
|
<div class="answer-line"><strong>解题思路:</strong><span class="solution-content">{!! $solutionHtml !!}</span></div>
|
|
<div class="answer-line"><strong>解题思路:</strong><span class="solution-content">{!! $solutionHtml !!}</span></div>
|
|
@@ -391,16 +401,18 @@
|
|
|
<div class="question-lead">
|
|
<div class="question-lead">
|
|
|
<span class="question-number">{{ $gradingMode ? '题目 ' : '' }}{{ $questionNumber }}.</span>
|
|
<span class="question-number">{{ $gradingMode ? '题目 ' : '' }}{{ $questionNumber }}.</span>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="question-main">
|
|
|
|
|
- @unless($gradingMode)
|
|
|
|
|
- <span class="question-score-inline">(本小题满分 {{ $q->score ?? 10 }} 分)
|
|
|
|
|
- @if($showQuestionId && !empty($q->id))
|
|
|
|
|
- <span class="question-id" style="font-size:10px;color:#999;margin-left:4px;">{!! $formatQuestionId($q->id) !!}</span>
|
|
|
|
|
- @endif
|
|
|
|
|
- </span>
|
|
|
|
|
- @endunless
|
|
|
|
|
- <span class="question-stem">{!! $mathProcessed ? $q->content : \App\Services\MathFormulaProcessor::processFormulas($q->content) !!}</span>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ @if(!$gradingMode || $showGradingStem)
|
|
|
|
|
+ <div class="question-main">
|
|
|
|
|
+ @unless($gradingMode)
|
|
|
|
|
+ <span class="question-score-inline">(本小题满分 {{ $q->score ?? 10 }} 分)
|
|
|
|
|
+ @if($showQuestionId && !empty($q->id))
|
|
|
|
|
+ <span class="question-id" style="font-size:10px;color:#999;margin-left:4px;">{!! $formatQuestionId($q->id) !!}</span>
|
|
|
|
|
+ @endif
|
|
|
|
|
+ </span>
|
|
|
|
|
+ @endunless
|
|
|
|
|
+ <span class="question-stem">{!! $mathProcessed ? $q->content : \App\Services\MathFormulaProcessor::processFormulas($q->content) !!}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ @endif
|
|
|
@unless($gradingMode)
|
|
@unless($gradingMode)
|
|
|
<div class="question-lead spacer"></div>
|
|
<div class="question-lead spacer"></div>
|
|
|
<div class="answer-area boxy">
|
|
<div class="answer-area boxy">
|
|
@@ -509,7 +521,9 @@
|
|
|
$solutionProcessed = preg_replace('/\n{3,}/u', "\n\n", $solutionProcessed);
|
|
$solutionProcessed = preg_replace('/\n{3,}/u', "\n\n", $solutionProcessed);
|
|
|
$solutionProcessed = nl2br($solutionProcessed);
|
|
$solutionProcessed = nl2br($solutionProcessed);
|
|
|
@endphp
|
|
@endphp
|
|
|
- <div class="question-lead spacer"></div>
|
|
|
|
|
|
|
+ @if($showGradingStem)
|
|
|
|
|
+ <div class="question-lead spacer"></div>
|
|
|
|
|
+ @endif
|
|
|
<div class="answer-meta">
|
|
<div class="answer-meta">
|
|
|
<div class="answer-line"><strong>正确答案:</strong><span class="solution-content">{!! $mathProcessed ? ($q->answer ?? '') : \App\Services\MathFormulaProcessor::processFormulas($q->answer ?? '') !!}</span></div>
|
|
<div class="answer-line"><strong>正确答案:</strong><span class="solution-content">{!! $mathProcessed ? ($q->answer ?? '') : \App\Services\MathFormulaProcessor::processFormulas($q->answer ?? '') !!}</span></div>
|
|
|
<div class="answer-line solution-parsed">{!! $solutionProcessed !!}</div>
|
|
<div class="answer-line solution-parsed">{!! $solutionProcessed !!}</div>
|