|
@@ -241,6 +241,7 @@
|
|
|
// 严格口径:顶部列表来自“本卷题目关联知识点”
|
|
// 严格口径:顶部列表来自“本卷题目关联知识点”
|
|
|
$hitCodes = array_values(array_unique(array_filter($exam_hit_kp_codes ?? [])));
|
|
$hitCodes = array_values(array_unique(array_filter($exam_hit_kp_codes ?? [])));
|
|
|
$masteryByCode = [];
|
|
$masteryByCode = [];
|
|
|
|
|
+ $hitMasteryFromParents = [];
|
|
|
$questionKpNameMap = [];
|
|
$questionKpNameMap = [];
|
|
|
foreach (($questions ?? []) as $q) {
|
|
foreach (($questions ?? []) as $q) {
|
|
|
$code = trim((string) ($q['knowledge_point'] ?? ''));
|
|
$code = trim((string) ($q['knowledge_point'] ?? ''));
|
|
@@ -249,6 +250,20 @@
|
|
|
$questionKpNameMap[$code] = $name;
|
|
$questionKpNameMap[$code] = $name;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ // 优先使用父节点树里的命中子节点掌握度(与左侧树口径一致)
|
|
|
|
|
+ foreach (($parent_mastery_levels ?? []) as $parent) {
|
|
|
|
|
+ $childrenAll = $parent['children_all'] ?? [];
|
|
|
|
|
+ if (!is_array($childrenAll)) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ foreach ($childrenAll as $child) {
|
|
|
|
|
+ $cCode = trim((string) ($child['kp_code'] ?? ''));
|
|
|
|
|
+ if ($cCode === '' || empty($child['is_hit'])) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ $hitMasteryFromParents[$cCode] = floatval($child['mastery_level'] ?? 0);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
foreach (($mastery['items'] ?? []) as $item) {
|
|
foreach (($mastery['items'] ?? []) as $item) {
|
|
|
$code = (string) ($item['kp_code'] ?? '');
|
|
$code = (string) ($item['kp_code'] ?? '');
|
|
|
if ($code !== '') {
|
|
if ($code !== '') {
|
|
@@ -262,11 +277,23 @@
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
$base = $masteryByCode[$kpCode] ?? null;
|
|
$base = $masteryByCode[$kpCode] ?? null;
|
|
|
|
|
+ $levelFromParentTree = $hitMasteryFromParents[$kpCode] ?? null;
|
|
|
|
|
+ $resolvedLevel = $levelFromParentTree !== null
|
|
|
|
|
+ ? floatval($levelFromParentTree)
|
|
|
|
|
+ : floatval($base['mastery_level'] ?? 0);
|
|
|
|
|
+ $resolvedChange = $base['mastery_change'] ?? null;
|
|
|
|
|
+ // 当顶部使用了父节点树中的实时值且与旧值不一致时,避免显示旧变化值误导
|
|
|
|
|
+ if ($levelFromParentTree !== null && $base !== null) {
|
|
|
|
|
+ $oldLevel = floatval($base['mastery_level'] ?? 0);
|
|
|
|
|
+ if (abs($resolvedLevel - $oldLevel) > 0.0001) {
|
|
|
|
|
+ $resolvedChange = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
$filteredMasteryItems[] = [
|
|
$filteredMasteryItems[] = [
|
|
|
'kp_code' => $kpCode,
|
|
'kp_code' => $kpCode,
|
|
|
'kp_name' => $questionKpNameMap[$kpCode] ?? ($base['kp_name'] ?? $kpCode),
|
|
'kp_name' => $questionKpNameMap[$kpCode] ?? ($base['kp_name'] ?? $kpCode),
|
|
|
- 'mastery_level' => floatval($base['mastery_level'] ?? 0),
|
|
|
|
|
- 'mastery_change' => $base['mastery_change'] ?? null,
|
|
|
|
|
|
|
+ 'mastery_level' => $resolvedLevel,
|
|
|
|
|
+ 'mastery_change' => $resolvedChange,
|
|
|
'is_hit' => true,
|
|
'is_hit' => true,
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
@@ -665,6 +692,17 @@
|
|
|
$solution = $q['solution'] ?? null;
|
|
$solution = $q['solution'] ?? null;
|
|
|
$solution = $formatSolutionLikeGrading($solution);
|
|
$solution = $formatSolutionLikeGrading($solution);
|
|
|
$analysis = $formatSolutionLikeGrading($analysis);
|
|
$analysis = $formatSolutionLikeGrading($analysis);
|
|
|
|
|
+ // 对齐判卷渲染口径:直接走 MathFormulaProcessor,保留图片与公式标签
|
|
|
|
|
+ $renderLikeGrading = function ($text) {
|
|
|
|
|
+ if (is_array($text)) {
|
|
|
|
|
+ $text = json_encode($text, JSON_UNESCAPED_UNICODE);
|
|
|
|
|
+ }
|
|
|
|
|
+ $text = is_string($text) ? trim($text) : '';
|
|
|
|
|
+ if ($text === '') {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ return \App\Services\MathFormulaProcessor::processFormulas($text);
|
|
|
|
|
+ };
|
|
|
@endphp
|
|
@endphp
|
|
|
<div class="question-card">
|
|
<div class="question-card">
|
|
|
<div style="display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:4px;">
|
|
<div style="display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:4px;">
|
|
@@ -702,13 +740,13 @@
|
|
|
<div class="question-block" style="margin-top:6px; background:#eff6ff; border-left:3px solid #3b82f6;">
|
|
<div class="question-block" style="margin-top:6px; background:#eff6ff; border-left:3px solid #3b82f6;">
|
|
|
<div style="font-weight:600; font-size:12px; color:#111827; margin-bottom:4px;">解题思路</div>
|
|
<div style="font-weight:600; font-size:12px; color:#111827; margin-bottom:4px;">解题思路</div>
|
|
|
<div class="math-content solution-content" style="color:#374151;">
|
|
<div class="math-content solution-content" style="color:#374151;">
|
|
|
- {!! nl2br(e(is_array($solution) ? json_encode($solution, JSON_UNESCAPED_UNICODE) : (string) $solution)) !!}
|
|
|
|
|
|
|
+ {!! $renderLikeGrading($solution) !!}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
@elseif(!empty($analysis) && $analysis !== '暂无解题思路记录')
|
|
@elseif(!empty($analysis) && $analysis !== '暂无解题思路记录')
|
|
|
<div class="question-block" style="margin-top:6px; background:#eff6ff; border-left:3px solid #3b82f6;">
|
|
<div class="question-block" style="margin-top:6px; background:#eff6ff; border-left:3px solid #3b82f6;">
|
|
|
<div style="font-weight:600; font-size:12px; color:#111827; margin-bottom:4px;">解题思路</div>
|
|
<div style="font-weight:600; font-size:12px; color:#111827; margin-bottom:4px;">解题思路</div>
|
|
|
- <div class="math-content solution-content" style="color:#374151;">{!! nl2br(e((string) $analysis)) !!}</div>
|
|
|
|
|
|
|
+ <div class="math-content solution-content" style="color:#374151;">{!! $renderLikeGrading($analysis) !!}</div>
|
|
|
</div>
|
|
</div>
|
|
|
@endif
|
|
@endif
|
|
|
|
|
|