|
@@ -4,6 +4,15 @@
|
|
|
$answerQuestions = $questions['answer'] ?? [];
|
|
$answerQuestions = $questions['answer'] ?? [];
|
|
|
$gradingMode = $grading ?? false;
|
|
$gradingMode = $grading ?? false;
|
|
|
|
|
|
|
|
|
|
+ // 是否在题干后显示题目ID (Q000123)
|
|
|
|
|
+ $showQuestionId = config('exam.show_question_id_in_pdf', false);
|
|
|
|
|
+
|
|
|
|
|
+ // 格式化题目ID为6位补0格式
|
|
|
|
|
+ $formatQuestionId = function($id) {
|
|
|
|
|
+ if (empty($id)) return '';
|
|
|
|
|
+ return '(Q' . str_pad($id, 6, '0', STR_PAD_LEFT) . ')';
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
// 【新增】动态计算大题号 - 根据有题目的题型分配序号
|
|
// 【新增】动态计算大题号 - 根据有题目的题型分配序号
|
|
|
$sectionNumbers = [
|
|
$sectionNumbers = [
|
|
|
'choice' => null,
|
|
'choice' => null,
|
|
@@ -184,6 +193,9 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="question-main">
|
|
<div class="question-main">
|
|
|
<span class="question-stem">{!! $renderedStem !!}</span>
|
|
<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>
|
|
</div>
|
|
|
@if(!empty($options))
|
|
@if(!empty($options))
|
|
|
@php
|
|
@php
|
|
@@ -322,11 +334,14 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="question-main">
|
|
<div class="question-main">
|
|
|
<span class="question-stem">{!! $renderedContent !!}</span>
|
|
<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>
|
|
</div>
|
|
|
@if($gradingMode)
|
|
@if($gradingMode)
|
|
|
@php
|
|
@php
|
|
|
$solutionText = trim($q->solution ?? '');
|
|
$solutionText = trim($q->solution ?? '');
|
|
|
- // 去掉前置的“解题思路”标签,避免出现“解题思路:【解题思路】”重复
|
|
|
|
|
|
|
+ // 去掉前置的"解题思路"标签,避免出现"解题思路:【解题思路】"重复
|
|
|
$solutionText = preg_replace('/^【?\s*解题思路\s*】?\s*[::]?\s*/u', '', $solutionText);
|
|
$solutionText = preg_replace('/^【?\s*解题思路\s*】?\s*[::]?\s*/u', '', $solutionText);
|
|
|
$solutionHtml = $solutionText === ''
|
|
$solutionHtml = $solutionText === ''
|
|
|
? '<span style="color:#999;font-style:italic;">(暂无解题思路)</span>'
|
|
? '<span style="color:#999;font-style:italic;">(暂无解题思路)</span>'
|
|
@@ -375,6 +390,9 @@
|
|
|
<span class="question-score-inline">(本小题满分 {{ $q->score ?? 10 }} 分)</span>
|
|
<span class="question-score-inline">(本小题满分 {{ $q->score ?? 10 }} 分)</span>
|
|
|
@endunless
|
|
@endunless
|
|
|
<span class="question-stem">{!! $mathProcessed ? $q->content : \App\Services\MathFormulaProcessor::processFormulas($q->content) !!}</span>
|
|
<span class="question-stem">{!! $mathProcessed ? $q->content : \App\Services\MathFormulaProcessor::processFormulas($q->content) !!}</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>
|
|
</div>
|
|
|
@unless($gradingMode)
|
|
@unless($gradingMode)
|
|
|
<div class="question-lead spacer"></div>
|
|
<div class="question-lead spacer"></div>
|