pdf-report.blade.php 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992
  1. @php
  2. // 提取15位paper_id数字部分作为学案编号
  3. $rawPaperId = $paper['id'] ?? $paper['paper_id'] ?? 'unknown';
  4. preg_match('/paper_(\d{15})/', $rawPaperId, $matches);
  5. $reportCode = $matches[1] ?? preg_replace('/[^0-9]/', '', $rawPaperId);
  6. $averageMastery = isset($mastery['average']) ? number_format($mastery['average'] * 100, 1) . '%' : '无数据';
  7. // 【修复】从insights中获取AI分析结果(而不是从analysis_data)
  8. $questionAnalysis = $insights ?? [];
  9. // 生成时间(格式:2026年01月30日 15:04:05)
  10. $generateDateTime = now()->format('Y年m月d日 H:i:s');
  11. @endphp
  12. <!DOCTYPE html>
  13. <html lang="zh-CN">
  14. <head>
  15. <meta charset="UTF-8">
  16. <title>学情报告 - {{ $paper['name'] ?? '试卷' }}</title>
  17. <link rel="stylesheet" href="/css/katex/katex.min.css">
  18. <style>
  19. @page {
  20. size: A4;
  21. margin: 2.2cm 2cm 2.3cm 2cm;
  22. @top-left {
  23. content: "知了数学·{{ $generateDateTime }}";
  24. font-size: 13px;
  25. color: #666;
  26. }
  27. @top-center {
  28. content: "{{ $student['name'] ?? '-' }}";
  29. font-size: 13px;
  30. color: #666;
  31. }
  32. @top-right {
  33. content: "{{ $reportCode }}";
  34. font-size: 19px;
  35. font-weight: 600;
  36. font-family: "Noto Sans", "Liberation Sans", "Nimbus Sans", sans-serif;
  37. letter-spacing: 0;
  38. padding-right: 3mm;
  39. padding-top: 1.8mm;
  40. color: #222;
  41. }
  42. @bottom-left {
  43. content: "{{ $reportCode }}";
  44. font-size: 11px;
  45. color: #666;
  46. }
  47. @bottom-right {
  48. content: counter(page) "/" counter(pages);
  49. font-size: 13px;
  50. color: #666;
  51. }
  52. }
  53. * { box-sizing: border-box; }
  54. body {
  55. font-family: "SimSun", "Songti SC", serif;
  56. margin: 0;
  57. padding: 0;
  58. color: #000;
  59. background: #fff;
  60. font-size: 12px;
  61. line-height: 1.6;
  62. }
  63. h1, h2, h3 { margin: 0; color: #000; }
  64. .card { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04); break-inside: auto; page-break-inside: auto; }
  65. .header { text-align: center; margin-bottom: 1.5rem; border-bottom: 2px solid #000; padding-bottom: 1rem; }
  66. .paper-title { font-size: 22px; font-weight: bold; margin-bottom: 14px; }
  67. .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
  68. .tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; color: #374151; background: #e5e7eb; }
  69. .section-title { font-size: 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
  70. .pill { padding: 4px 10px; border-radius: 999px; font-size: 12px; }
  71. .pill.green { background: #ecfdf3; color: #15803d; }
  72. .pill.amber { background: #fef3c7; color: #b45309; }
  73. .pill.red { background: #fef2f2; color: #b91c1c; }
  74. table { width: 100%; border-collapse: collapse; font-size: 13px; }
  75. th, td { padding: 8px 10px; border-bottom: 1px solid #e5e7eb; text-align: left; vertical-align: top; }
  76. th { background: #f3f4f6; color: #111827; }
  77. .muted { color: #6b7280; font-size: 12px; }
  78. .progress-wrap { background: #f3f4f6; border-radius: 999px; overflow: hidden; height: 10px; }
  79. .progress-bar { height: 100%; background: linear-gradient(90deg, #4f46e5, #10b981); }
  80. .recommend-card { border: 1px dashed #cbd5e1; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: #f8fafc; }
  81. .relation-board { margin: 6px 0 10px; break-inside: auto; page-break-inside: auto; }
  82. .relation-block { margin-bottom: 10px; padding: 8px; border: 1px solid #dbeafe; border-radius: 8px; background: #fff; break-inside: auto; page-break-inside: auto; }
  83. .relation-row { display: flex; align-items: flex-start; gap: 10px; }
  84. .tree-cards { width: 100%; border-collapse: collapse; table-layout: fixed; }
  85. .tree-cards td { border: none; padding: 0; vertical-align: top; }
  86. .tree-left { width: 45%; flex: 0 0 45%; padding-right: 10px; }
  87. .tree-right { width: 55%; flex: 1; padding-left: 10px; }
  88. .tree-parent {
  89. display: inline-block;
  90. margin-bottom: 6px;
  91. padding: 4px 8px;
  92. border-radius: 999px;
  93. border: 1px solid #93c5fd;
  94. background: #dbeafe;
  95. color: #1e3a8a;
  96. font-weight: 700;
  97. font-size: 12px;
  98. }
  99. .tree-lines { margin: 0; padding-left: 14px; border-left: 2px solid #cbd5e1; }
  100. .tree-line {
  101. font-size: 11px;
  102. color: #334155;
  103. margin-bottom: 3px;
  104. white-space: normal;
  105. overflow: visible;
  106. text-overflow: clip;
  107. word-break: break-all;
  108. line-height: 1.45;
  109. }
  110. .tree-line.hit { font-weight: 600; color: #1e40af; }
  111. .tree-line-badge { display: inline-block; margin-left: 6px; padding: 1px 5px; border-radius: 999px; font-size: 10px; border: 1px solid transparent; }
  112. .tree-line-badge.high,
  113. .tree-line-badge.mid,
  114. .tree-line-badge.low,
  115. .tree-line-badge.miss { background: #f8fafc; color: #64748b; border-color: #cbd5e1; }
  116. .detail-card {
  117. border: 1px solid #e2e8f0;
  118. border-radius: 6px;
  119. background: #f8fafc;
  120. padding: 6px 8px;
  121. margin-bottom: 5px;
  122. break-inside: auto;
  123. page-break-inside: auto;
  124. }
  125. .detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
  126. .detail-title { font-size: 11px; color: #0f172a; font-weight: 700; margin-bottom: 2px; }
  127. .detail-meta { font-size: 11px; color: #475569; margin-top: 3px; }
  128. .detail-mastery { font-size: 38px; color: #0f172a; font-weight: 700; line-height: 1; margin: 0; }
  129. .detail-mastery.high { color: #16a34a; }
  130. .detail-mastery.mid { color: #d97706; }
  131. .detail-mastery.low { color: #dc2626; }
  132. .node-tags { margin-top: 2px; }
  133. .node-tag {
  134. display: inline-block;
  135. margin: 0 6px 6px 0;
  136. padding: 1px 7px;
  137. border-radius: 999px;
  138. font-size: 10px;
  139. line-height: 1.4;
  140. color: #475569;
  141. background: #f1f5f9;
  142. border: 1px solid #cbd5e1;
  143. }
  144. .suggest-tags { display: inline; }
  145. .suggest-tag {
  146. display: inline-block;
  147. margin: 0 6px 6px 0;
  148. padding: 1px 7px;
  149. border-radius: 999px;
  150. font-size: 10px;
  151. line-height: 1.4;
  152. color: #334155;
  153. background: #f8fafc;
  154. border: 1px solid #d1d5db;
  155. }
  156. .weak-kp-tags { margin-top: 6px; }
  157. .weak-kp-tag {
  158. display: inline-block;
  159. margin: 0 6px 6px 0;
  160. padding: 1px 7px;
  161. border-radius: 999px;
  162. font-size: 10px;
  163. line-height: 1.45;
  164. color: #854d0e;
  165. background: #fef3c7;
  166. border: 1px solid #fcd34d;
  167. }
  168. .error-kp-tag {
  169. display: inline-block;
  170. margin: 0 6px 6px 0;
  171. padding: 1px 7px;
  172. border-radius: 999px;
  173. font-size: 10px;
  174. line-height: 1.45;
  175. color: #334155;
  176. background: #f8fafc;
  177. border: 1px solid #d1d5db;
  178. }
  179. .error-kp-tag.high-risk {
  180. color: #b91c1c;
  181. border-color: #fca5a5;
  182. background: #fff;
  183. font-weight: 600;
  184. }
  185. .detail-change-up { color: #16a34a; font-weight: 700; }
  186. .detail-change-down { color: #dc2626; font-weight: 700; }
  187. .aggregate-tip { font-size: 11px; color: #475569; margin-top: 6px; }
  188. .question-card { border:1px solid #e5e7eb; border-radius:8px; padding:6px 9px; margin-bottom:5px; background:#fff; page-break-inside: auto; break-inside: auto; }
  189. .question-block { margin-bottom: 5px; padding: 5px; border-radius: 4px; page-break-inside: auto; break-inside: auto; }
  190. .question-card,
  191. .question-card .math-content,
  192. .question-card .solution-content {
  193. font-size: 12px;
  194. line-height: 1.7;
  195. }
  196. /* 题干区:与判卷 PDF(exam-grading)一致 — <img>、内嵌 SVG、公式 */
  197. .question-card .question-stem svg,
  198. .question-card .math-content svg {
  199. max-width: 100%;
  200. height: auto;
  201. display: block;
  202. shape-rendering: geometricPrecision;
  203. text-rendering: geometricPrecision;
  204. }
  205. .question-card .question-stem svg text {
  206. font-family: "Noto Serif", "Noto Serif CJK SC", "Noto Sans CJK SC", "Noto Sans", "STSongti-SC", "PingFang SC", "Songti SC", serif !important;
  207. font-size: 13px !important;
  208. font-weight: bold;
  209. dominant-baseline: middle;
  210. text-anchor: middle;
  211. }
  212. .question-card .question-stem svg circle,
  213. .question-card .question-stem svg line,
  214. .question-card .question-stem svg polygon,
  215. .question-card .question-stem svg polyline {
  216. shape-rendering: geometricPrecision;
  217. }
  218. .question-card .question-stem img,
  219. .question-card .question-main img {
  220. display: block;
  221. max-width: 220px;
  222. max-height: 60mm;
  223. width: auto;
  224. height: auto;
  225. margin: 6px auto;
  226. box-sizing: border-box;
  227. object-fit: contain;
  228. -webkit-print-color-adjust: exact;
  229. print-color-adjust: exact;
  230. image-rendering: -webkit-optimize-contrast;
  231. }
  232. .question-card .question-stem .katex {
  233. font-size: 1em !important;
  234. vertical-align: 0;
  235. }
  236. .question-card .question-stem .katex-display {
  237. margin: 0.35em 0 !important;
  238. }
  239. .question-card .solution-content img,
  240. .question-card .report-answer-meta img {
  241. display: block;
  242. max-width: 220px;
  243. max-height: 60mm;
  244. width: auto;
  245. height: auto;
  246. margin: 6px auto;
  247. object-fit: contain;
  248. -webkit-print-color-adjust: exact;
  249. print-color-adjust: exact;
  250. }
  251. .solution-content {
  252. display: block;
  253. line-height: 1.75;
  254. white-space: normal;
  255. word-break: break-word;
  256. overflow-wrap: anywhere;
  257. page-break-inside: auto;
  258. break-inside: auto;
  259. }
  260. /* 与判卷 PDF(exam-grading / paper-body)一致的选项网格 */
  261. .report-options {
  262. margin-top: 6px;
  263. page-break-inside: avoid;
  264. break-inside: avoid;
  265. }
  266. .report-options.options-grid-4 {
  267. display: grid;
  268. grid-template-columns: repeat(4, 1fr);
  269. gap: 8px 12px;
  270. }
  271. .report-options.options-grid-2 {
  272. display: grid;
  273. grid-template-columns: 1fr 1fr;
  274. gap: 8px 20px;
  275. }
  276. .report-options.options-grid-1 {
  277. display: grid;
  278. grid-template-columns: 1fr;
  279. gap: 8px;
  280. }
  281. .report-options .option {
  282. display: flex;
  283. align-items: baseline;
  284. font-size: 12px;
  285. line-height: 1.6;
  286. page-break-inside: avoid;
  287. break-inside: avoid;
  288. }
  289. .report-options .option strong { margin-right: 4px; flex: 0 0 auto; }
  290. .report-options .option-value.option-short { white-space: nowrap; }
  291. .report-options .option-value.option-long { white-space: normal; word-break: break-word; }
  292. .report-options .option p, .report-options .option div { margin: 0; display: inline; }
  293. .report-options .option img {
  294. max-width: 100%;
  295. height: auto;
  296. vertical-align: middle;
  297. }
  298. /* 判卷风格:解题思路(与 answer-meta 一致) */
  299. .report-answer-meta {
  300. font-size: 12px;
  301. color: #2f2f2f;
  302. line-height: 1.75;
  303. margin-top: 6px;
  304. page-break-inside: avoid;
  305. break-inside: avoid;
  306. }
  307. .report-answer-meta .answer-line + .answer-line { margin-top: 4px; }
  308. .report-answer-meta .solution-content {
  309. display: inline;
  310. line-height: 1.75;
  311. }
  312. </style>
  313. </head>
  314. <body>
  315. <div class="page">
  316. <div class="header">
  317. <h1 class="paper-title">学情分析报告</h1>
  318. @php
  319. $teacherName = trim((string) ($teacher['name'] ?? ''));
  320. $showTeacher = $teacherName !== '' && $teacherName !== '________' && $teacherName !== '未知老师';
  321. @endphp
  322. <div style="display:flex;justify-content:space-between;font-size:14px;margin-top:8px;">
  323. @if($showTeacher)
  324. <span>老师:{{ $teacherName }}</span>
  325. @endif
  326. <span>年级:@formatGrade($student['grade'] ?? '________')</span>
  327. @if(!empty($paper['assemble_type_label']) && $paper['assemble_type_label'] !== '未知类型')
  328. <span>类型:{{ $paper['assemble_type_label'] }}</span>
  329. @endif
  330. <span>姓名:{{ $student['name'] ?? '________' }}</span>
  331. <span>题目数:{{ $paper['total_questions'] ?? (is_array($questions ?? null) ? count($questions) : '-') }}</span>
  332. </div>
  333. </div>
  334. <div class="card">
  335. <div class="section-title">本次命中子知识点掌握度</div>
  336. @php
  337. // 严格口径:顶部列表来自“本卷题目关联知识点”
  338. $hitCodes = array_values(array_unique(array_filter($exam_hit_kp_codes ?? [])));
  339. $masteryByCode = [];
  340. $hitMasteryFromParents = [];
  341. $questionKpNameMap = [];
  342. foreach (($questions ?? []) as $q) {
  343. $code = trim((string) ($q['knowledge_point'] ?? ''));
  344. $name = trim((string) ($q['knowledge_point_name'] ?? ''));
  345. if ($code !== '' && $name !== '') {
  346. $questionKpNameMap[$code] = $name;
  347. }
  348. }
  349. // 优先使用父节点树里的命中子节点掌握度(与左侧树口径一致)
  350. foreach (($parent_mastery_levels ?? []) as $parent) {
  351. $childrenAll = $parent['children_all'] ?? [];
  352. if (!is_array($childrenAll)) {
  353. continue;
  354. }
  355. foreach ($childrenAll as $child) {
  356. $cCode = trim((string) ($child['kp_code'] ?? ''));
  357. if ($cCode === '' || empty($child['is_hit'])) {
  358. continue;
  359. }
  360. $hitMasteryFromParents[$cCode] = floatval($child['mastery_level'] ?? 0);
  361. }
  362. }
  363. foreach (($mastery['items'] ?? []) as $item) {
  364. $code = (string) ($item['kp_code'] ?? '');
  365. if ($code !== '') {
  366. $masteryByCode[$code] = $item;
  367. }
  368. }
  369. $filteredMasteryItems = [];
  370. foreach ($hitCodes as $kpCode) {
  371. if (in_array($kpCode, ['K-GENERAL', 'GENERAL', 'DEFAULT'])) {
  372. continue;
  373. }
  374. $base = $masteryByCode[$kpCode] ?? null;
  375. $levelFromParentTree = $hitMasteryFromParents[$kpCode] ?? null;
  376. $resolvedLevel = $levelFromParentTree !== null
  377. ? floatval($levelFromParentTree)
  378. : floatval($base['mastery_level'] ?? 0);
  379. $resolvedChange = $base['mastery_change'] ?? null;
  380. // 当顶部使用了父节点树中的实时值且与旧值不一致时,避免显示旧变化值误导
  381. if ($levelFromParentTree !== null && $base !== null) {
  382. $oldLevel = floatval($base['mastery_level'] ?? 0);
  383. if (abs($resolvedLevel - $oldLevel) > 0.0001) {
  384. $resolvedChange = null;
  385. }
  386. }
  387. $filteredMasteryItems[] = [
  388. 'kp_code' => $kpCode,
  389. 'kp_name' => $questionKpNameMap[$kpCode] ?? ($base['kp_name'] ?? $kpCode),
  390. 'mastery_level' => $resolvedLevel,
  391. 'mastery_change' => $resolvedChange,
  392. 'is_hit' => true,
  393. ];
  394. }
  395. @endphp
  396. @if(!empty($filteredMasteryItems))
  397. @foreach($filteredMasteryItems as $item)
  398. @php
  399. $pct = min(100, max(0, ($item['mastery_level'] ?? 0) * 100));
  400. $barColor = $pct >= 80 ? '#10b981' : ($pct >= 60 ? '#f59e0b' : '#ef4444');
  401. $delta = $item['mastery_change'] ?? null;
  402. $isHitItem = !empty($item['is_hit']);
  403. // 只有当有变化值时才显示变化信息
  404. $changeText = '';
  405. if ($delta !== null && $delta !== '' && abs($delta) > 0.001) {
  406. $changeText = ($delta > 0 ? '↑ ' : '↓ ') . number_format(abs($delta) * 100, 1) . '%';
  407. }
  408. @endphp
  409. <div style="margin-bottom:12px; padding: 8px; border: 1px solid #e5e7eb; border-radius: 6px;">
  410. <div style="display:flex; justify-content:space-between; align-items:center; margin-bottom: 6px;">
  411. <div style="font-weight: 600; font-size: 13px;">{{ $item['kp_name'] ?? $item['kp_code'] ?? '未知知识点' }}</div>
  412. <div style="font-weight: 600; color: {{ $barColor }}; font-size: 13px;">
  413. {{ number_format($pct, 1) }}%
  414. <span style="margin-left: 8px; color: #666; font-size: 11px;">{{ $changeText ? '子节点变化 ' . $changeText : '' }}</span>
  415. </div>
  416. </div>
  417. <div class="progress-wrap" style="height: 12px;">
  418. <div class="progress-bar" style="width: {{ $pct }}%; background: {{ $barColor }};"></div>
  419. </div>
  420. </div>
  421. @endforeach
  422. @else
  423. <div class="muted">暂无有效掌握度数据(已过滤通用知识点)</div>
  424. @endif
  425. </div>
  426. <div class="card">
  427. <div class="section-title">📊 知识点层级掌握度分析</div>
  428. @php
  429. $parentMasteryLevels = $parent_mastery_levels ?? [];
  430. $hasParentMastery = !empty($parentMasteryLevels);
  431. $childMasteryMap = [];
  432. foreach (($filteredMasteryItems ?? []) as $it) {
  433. $childMasteryMap[$it['kp_code']] = [
  434. 'level' => floatval($it['mastery_level'] ?? 0),
  435. 'delta' => isset($it['mastery_change']) ? floatval($it['mastery_change']) : null,
  436. ];
  437. }
  438. @endphp
  439. @if($hasParentMastery)
  440. <div class="relation-board">
  441. <div style="font-size:12px; color:#334155; margin-bottom:6px; font-weight:600;">父子知识点关系</div>
  442. @foreach($parentMasteryLevels as $parentData)
  443. @php
  444. $childrenAll = $parentData['children_all'] ?? [];
  445. $children = $parentData['children'] ?? []; // 命中子节点
  446. $childCount = count($childrenAll);
  447. $hitCount = count($children);
  448. $hitAvg = $parentData['children_hit_avg_mastery'] ?? null;
  449. $parentPct = number_format(floatval($parentData['mastery_percentage'] ?? 0), 1);
  450. $parentLevel = floatval($parentData['mastery_level'] ?? 0);
  451. $parentClass = $parentLevel >= 0.8 ? 'high' : ($parentLevel >= 0.6 ? 'mid' : 'low');
  452. $delta = $parentData['mastery_change'] ?? null;
  453. $hitNames = array_values(array_map(fn($c) => $c['kp_name'] ?? ($c['kp_code'] ?? ''), $children));
  454. $allChildrenPerfect = !empty($childrenAll) && count(array_filter($childrenAll, function ($c) {
  455. return floatval($c['mastery_level'] ?? 0) >= 0.999;
  456. })) === count($childrenAll);
  457. @endphp
  458. <div class="relation-block">
  459. <div class="relation-row">
  460. <div class="tree-left">
  461. <div class="tree-parent">{{ $parentData['kp_name'] ?? $parentData['kp_code'] }}</div>
  462. @if(!empty($childrenAll))
  463. <div class="tree-lines">
  464. @foreach($childrenAll as $child)
  465. @php
  466. $isHit = !empty($child['is_hit']);
  467. $m = floatval($child['mastery_level'] ?? 0);
  468. $badgeClass = $m >= 0.8 ? 'high' : ($m >= 0.6 ? 'mid' : ($m > 0 ? 'low' : 'miss'));
  469. $badgeText = number_format($m * 100, 1) . '%';
  470. @endphp
  471. <div class="tree-line {{ $isHit ? 'hit' : '' }}">
  472. └─ {{ $child['kp_name'] }}
  473. <span class="tree-line-badge {{ $badgeClass }}">{{ $badgeText }}</span>
  474. </div>
  475. @endforeach
  476. </div>
  477. @else
  478. <div class="muted">无命中子知识点</div>
  479. @endif
  480. </div>
  481. <div class="tree-right">
  482. <div class="detail-card">
  483. <div class="detail-head">
  484. <div class="detail-title">{{ $parentData['kp_name'] ?? $parentData['kp_code'] }}</div>
  485. <div class="detail-mastery {{ $parentClass }}">{{ $parentPct }}%</div>
  486. </div>
  487. <div class="detail-meta">
  488. 父节点变化:
  489. @if($delta !== null)
  490. <span class="{{ $delta >= 0 ? 'detail-change-up' : 'detail-change-down' }}">
  491. {{ $delta >= 0 ? '↑ ' : '↓ ' }}{{ number_format(abs($delta) * 100, 1) }}%
  492. </span>
  493. @else
  494. -
  495. @endif
  496. </div>
  497. <div class="detail-meta" style="margin-top: 3px;">
  498. 本次重点子节点:
  499. @if($hitCount > 0)
  500. <span class="node-tags">
  501. @foreach($hitNames as $hitName)
  502. @if(!empty(trim($hitName)))
  503. <span class="node-tag">{{ $hitName }}</span>
  504. @endif
  505. @endforeach
  506. </span>
  507. @else
  508. @endif
  509. </div>
  510. <div class="detail-meta">
  511. 子节点总数 {{ $childCount }} 个,本次命中 {{ $hitCount }} 个,命中均值 {{ $hitAvg !== null ? number_format(floatval($hitAvg) * 100, 1) . '%' : '-' }}(命中表示本次覆盖,不等于已掌握)
  512. </div>
  513. </div>
  514. </div>
  515. </div>
  516. </div>
  517. @endforeach
  518. </div>
  519. @php
  520. $allParentPerfect = !empty($parentMasteryLevels) && count(array_filter($parentMasteryLevels, function ($p) {
  521. return floatval($p['mastery_level'] ?? 0) >= 0.999;
  522. })) === count($parentMasteryLevels);
  523. $allHitChildrenPerfect = !empty($filteredMasteryItems) && count(array_filter($filteredMasteryItems, function ($it) {
  524. return floatval($it['mastery_level'] ?? 0) >= 0.999;
  525. })) === count($filteredMasteryItems);
  526. $isAllPerfect = $allParentPerfect && $allHitChildrenPerfect;
  527. // 1) 优先:本次命中子知识点中的低掌握度(<60%)
  528. $hitWeakChildren = [];
  529. $hitWeakKeys = [];
  530. foreach (($filteredMasteryItems ?? []) as $hitItem) {
  531. $level = floatval($hitItem['mastery_level'] ?? 0);
  532. $name = trim((string) ($hitItem['kp_name'] ?? $hitItem['kp_code'] ?? ''));
  533. if ($name === '' || $level >= 0.6) {
  534. continue;
  535. }
  536. $key = (string) ($hitItem['kp_code'] ?? $name);
  537. $hitWeakChildren[$key] = [
  538. 'name' => $name,
  539. 'level' => $level,
  540. ];
  541. $hitWeakKeys[$key] = true;
  542. }
  543. $hitWeakChildren = array_values($hitWeakChildren);
  544. usort($hitWeakChildren, function ($a, $b) {
  545. return $a['level'] <=> $b['level'];
  546. });
  547. // 2) 兜底:若命中子知识点都 >=60%,再从其他低掌握度子知识点补
  548. $otherWeakChildren = [];
  549. foreach (($parentMasteryLevels ?? []) as $pData) {
  550. foreach (($pData['children_all'] ?? []) as $child) {
  551. $level = floatval($child['mastery_level'] ?? 0);
  552. $name = trim((string) ($child['kp_name'] ?? $child['kp_code'] ?? ''));
  553. if ($name === '' || $level >= 0.6) {
  554. continue;
  555. }
  556. $key = ($child['kp_code'] ?? $name);
  557. if (isset($hitWeakKeys[$key])) {
  558. continue;
  559. }
  560. $otherWeakChildren[$key] = [
  561. 'name' => $name,
  562. 'level' => $level,
  563. ];
  564. }
  565. }
  566. $otherWeakChildren = array_values($otherWeakChildren);
  567. usort($otherWeakChildren, function ($a, $b) {
  568. return $a['level'] <=> $b['level'];
  569. });
  570. // 3) 最终展示:总数不超过5
  571. $globalWeakChildren = [];
  572. if (!empty($hitWeakChildren)) {
  573. $globalWeakChildren = array_slice($hitWeakChildren, 0, 5);
  574. } else {
  575. $globalWeakChildren = array_slice($otherWeakChildren, 0, 5);
  576. }
  577. @endphp
  578. <div style="margin-top: 12px; padding: 8px; background: #fefce8; border-left: 4px solid #eab308; border-radius: 4px;">
  579. <div style="font-size: 12px; color: #854d0e; line-height: 1.6;">
  580. <strong>学习建议:</strong>
  581. @if($isAllPerfect)
  582. 本次学案表现非常出色,相关知识点掌握稳定且完整。建议继续进入新的知识点专题学习,优先选择同层级未覆盖内容或更高难度综合题,保持进阶节奏。
  583. @else
  584. 建议重点关注掌握度较低的知识点,通过专项练习提升整体学习水平。优先练习掌握度低于60%的知识点。
  585. @endif
  586. @if(!empty($globalWeakChildren))
  587. <div class="weak-kp-tags">
  588. @foreach($globalWeakChildren as $weakChild)
  589. <span class="weak-kp-tag">{{ $weakChild['name'] }}({{ number_format($weakChild['level'] * 100, 1) }}%)</span>
  590. @endforeach
  591. </div>
  592. @endif
  593. </div>
  594. </div>
  595. @else
  596. <div class="muted">暂无父节点掌握度数据</div>
  597. <div style="margin-top: 8px; font-size: 12px; color: #64748b;">
  598. 当前分析主要基于具体知识点掌握度。完整的层级掌握度分析需要在系统中建立完整的知识点层级关系。
  599. </div>
  600. @endif
  601. </div>
  602. @php
  603. $insightMap = [];
  604. foreach (($question_insights ?? []) as $insight) {
  605. $no = $insight['question_number'] ?? $insight['question_id'] ?? null;
  606. if ($no !== null) {
  607. $insightMap[$no] = $insight;
  608. }
  609. }
  610. $analysisWrongMap = [];
  611. foreach (($analysis_data['question_analysis'] ?? []) as $qa) {
  612. $qid = $qa['question_bank_id'] ?? $qa['question_id'] ?? null;
  613. if ($qid === null || $qid === '') {
  614. continue;
  615. }
  616. $rawCorrect = $qa['is_correct'] ?? null;
  617. $isWrongFromAnalysis = false;
  618. if (is_array($rawCorrect)) {
  619. $isWrongFromAnalysis = in_array(0, $rawCorrect, true);
  620. } elseif ($rawCorrect !== null) {
  621. $isWrongFromAnalysis = !boolval($rawCorrect);
  622. }
  623. if ($isWrongFromAnalysis) {
  624. $analysisWrongMap[(string)$qid] = true;
  625. }
  626. }
  627. $wrongQuestions = [];
  628. foreach (($questions ?? []) as $qItem) {
  629. $studentAnswerProbe = $qItem['student_answer'] ?? null;
  630. $correctAnswerProbe = $qItem['answer'] ?? ($qItem['correct_answer'] ?? null);
  631. $isCorrectProbe = $qItem['is_correct'] ?? null;
  632. if ($isCorrectProbe === null && !empty($studentAnswerProbe) && !empty($correctAnswerProbe)) {
  633. $isCorrectProbe = (trim((string)$studentAnswerProbe) === trim((string)$correctAnswerProbe)) ? 1 : 0;
  634. }
  635. $normalizedCorrect = $isCorrectProbe;
  636. if ($isCorrectProbe !== null) {
  637. $normalizedCorrect = is_bool($isCorrectProbe) ? ($isCorrectProbe ? 1 : 0) : intval($isCorrectProbe);
  638. }
  639. $qidProbe = (string)($qItem['question_bank_id'] ?? $qItem['question_id'] ?? '');
  640. $isWrongByAnalysis = ($qidProbe !== '' && isset($analysisWrongMap[$qidProbe]));
  641. if ($normalizedCorrect === 0 || $isWrongByAnalysis) {
  642. $wrongQuestions[] = $qItem;
  643. }
  644. }
  645. // 错题知识点聚合统计(同知识点错几题/共几题)
  646. $kpStats = [];
  647. foreach (($questions ?? []) as $qItem) {
  648. $kpName = trim((string)($qItem['knowledge_point_name'] ?? $qItem['knowledge_point'] ?? '未标注知识点'));
  649. if ($kpName === '') {
  650. $kpName = '未标注知识点';
  651. }
  652. if (!isset($kpStats[$kpName])) {
  653. $kpStats[$kpName] = ['total' => 0, 'wrong' => 0];
  654. }
  655. $kpStats[$kpName]['total']++;
  656. }
  657. foreach ($wrongQuestions as $qItem) {
  658. $kpName = trim((string)($qItem['knowledge_point_name'] ?? $qItem['knowledge_point'] ?? '未标注知识点'));
  659. if ($kpName === '') {
  660. $kpName = '未标注知识点';
  661. }
  662. if (!isset($kpStats[$kpName])) {
  663. $kpStats[$kpName] = ['total' => 0, 'wrong' => 0];
  664. }
  665. $kpStats[$kpName]['wrong']++;
  666. }
  667. $kpWrongStats = [];
  668. foreach ($kpStats as $kpName => $stat) {
  669. if (($stat['wrong'] ?? 0) <= 0) {
  670. continue;
  671. }
  672. $total = max(1, intval($stat['total'] ?? 0));
  673. $wrong = intval($stat['wrong'] ?? 0);
  674. $kpWrongStats[] = [
  675. 'kp_name' => $kpName,
  676. 'wrong' => $wrong,
  677. 'total' => $total,
  678. 'rate' => $wrong / $total,
  679. ];
  680. }
  681. usort($kpWrongStats, function ($a, $b) {
  682. if ($a['rate'] === $b['rate']) {
  683. return $b['wrong'] <=> $a['wrong'];
  684. }
  685. return $b['rate'] <=> $a['rate'];
  686. });
  687. @endphp
  688. @if(!empty($wrongQuestions))
  689. <div class="card">
  690. <div class="section-title">错题列表</div>
  691. @if(!empty($kpWrongStats))
  692. <div style="margin-bottom:8px; padding:8px; border:1px solid #e5e7eb; border-radius:6px; background:#f8fafc;">
  693. <div style="font-size:12px; font-weight:600; color:#111827; margin-bottom:6px;">知识点错误率</div>
  694. <div style="font-size:12px; color:#475569; line-height:1.7;">
  695. @foreach($kpWrongStats as $item)
  696. <span class="error-kp-tag {{ $item['rate'] > 0.5 ? 'high-risk' : '' }}">{{ $item['kp_name'] }}:{{ $item['wrong'] }}/{{ $item['total'] }}({{ number_format($item['rate'] * 100, 1) }}%)</span>
  697. @endforeach
  698. </div>
  699. </div>
  700. @endif
  701. @foreach($wrongQuestions as $q)
  702. @php
  703. // 【修复】从题目数据中获取学生答案、正确答案和判分结果
  704. $studentAnswer = $q['student_answer'] ?? $q['student_answer'] ?? null;
  705. $correctAnswer = $q['answer'] ?? $q['correct_answer'] ?? null;
  706. $isCorrect = $q['is_correct'] ?? null; // 1=正确,0=错误,null=未判
  707. // 如果未判分但有学生答案和正确答案,自动比较判断
  708. if ($isCorrect === null && !empty($studentAnswer) && !empty($correctAnswer)) {
  709. $isCorrect = (trim($studentAnswer) === trim($correctAnswer)) ? 1 : 0;
  710. }
  711. // 判分状态显示逻辑
  712. $statusText = '';
  713. $statusColor = '';
  714. if ($isCorrect === 1) {
  715. $statusText = '正确';
  716. $statusColor = '#10b981';
  717. } elseif ($isCorrect === 0) {
  718. $statusText = '错误';
  719. $statusColor = '#ef4444';
  720. }
  721. $showStatus = $statusText !== '';
  722. $insight = $insightMap[$q['question_number']] ?? ($insightMap[$q['display_number'] ?? null] ?? []);
  723. // 【修复】得分显示:答错显示实际得分,答对显示满分
  724. $fullScore = $insight['full_score'] ?? ($q['score'] ?? null);
  725. if ($isCorrect === 1) {
  726. // 答对了,显示满分
  727. $score = $fullScore;
  728. } elseif ($isCorrect === 0) {
  729. // 答错了,显示实际得分(可能为0分或其他分数)
  730. $score = $q['score_obtained'] ?? 0;
  731. } else {
  732. // 未判分或未答题,不显示得分
  733. $score = null;
  734. }
  735. $analysisRaw = $insight['analysis']
  736. ?? $insight['thinking_process']
  737. ?? $insight['feedback']
  738. ?? $insight['suggestions']
  739. ?? $insight['reason']
  740. ?? ($insight['correct_solution'] ?? null);
  741. // 若有下一步建议,追加
  742. if (empty($analysisRaw) && !empty($insight['next_steps'])) {
  743. $analysisRaw = '后续建议:' . (is_array($insight['next_steps']) ? implode(';', $insight['next_steps']) : $insight['next_steps']);
  744. }
  745. $analysis = is_array($analysisRaw) ? json_encode($analysisRaw, JSON_UNESCAPED_UNICODE) : $analysisRaw;
  746. if ($analysis === null || $analysis === '') {
  747. $analysis = '暂无解题思路,待补充';
  748. }
  749. if (is_string($analysis)) {
  750. $analysis = preg_replace('/^【?\s*解题思路\s*】?\s*[::]?\s*/u', '', $analysis);
  751. }
  752. $formatSolutionLikeGrading = function ($text) {
  753. if (!is_string($text) || trim($text) === '') {
  754. return $text;
  755. }
  756. $normalized = preg_replace('/\s*;\s*步骤\s*(\d+)/u', ";\n步骤$1", $text);
  757. $normalized = preg_replace('/\s*。\s*步骤\s*(\d+)/u', "。\n步骤$1", $normalized);
  758. $normalized = preg_replace('/(?<!^)(步骤\s*\d+\s*[::])/u', "\n$1", $normalized);
  759. $normalized = preg_replace('/(?<!^)(第\s*\d+\s*步\s*[::]?)/u', "\n$1", $normalized);
  760. $normalized = preg_replace('/\n{3,}/u', "\n\n", $normalized);
  761. // 去掉每行左侧缩进空白,避免出现“左边空好几个字符”
  762. $normalized = preg_replace('/^[\h\x{3000}]+/mu', '', $normalized);
  763. return trim($normalized);
  764. };
  765. $stepsRaw = $insight['steps'] ?? $insight['solution_steps'] ?? $insight['analysis_steps'] ?? null;
  766. $steps = [];
  767. if (is_array($stepsRaw)) {
  768. $steps = $stepsRaw;
  769. } elseif (is_string($stepsRaw) && trim($stepsRaw) !== '') {
  770. $steps = preg_split('/[\r\n]+/', trim($stepsRaw));
  771. }
  772. $typeMap = ['choice' => '选择题', 'fill' => '填空题', 'answer' => '解答题'];
  773. $typeLabel = $typeMap[$q['question_type'] ?? ''] ?? ($q['question_type'] ?? '题型未标注');
  774. $questionText = is_string($q['question_text']) ? $q['question_text'] : json_encode($q['question_text'], JSON_UNESCAPED_UNICODE);
  775. $solution = $q['solution'] ?? null;
  776. if (is_string($solution)) {
  777. $solution = preg_replace('/^【?\s*解题思路\s*】?\s*[::]?\s*/u', '', $solution);
  778. }
  779. $solution = $formatSolutionLikeGrading($solution);
  780. $analysis = $formatSolutionLikeGrading($analysis);
  781. // 对齐判卷渲染口径:直接走 MathFormulaProcessor,保留图片与公式标签
  782. $renderLikeGrading = function ($text) {
  783. if (is_array($text)) {
  784. $text = json_encode($text, JSON_UNESCAPED_UNICODE);
  785. }
  786. $text = is_string($text) ? trim($text) : '';
  787. if ($text === '') {
  788. return '';
  789. }
  790. return \App\Services\MathFormulaProcessor::processFormulas($text);
  791. };
  792. // 选择题:选项来自服务端 questions.options / 题干解析;正确答案字母用于打 ✅
  793. $displayCorrectAnswer = is_array($correctAnswer)
  794. ? json_encode($correctAnswer, JSON_UNESCAPED_UNICODE)
  795. : (string) $correctAnswer;
  796. $questionTypeRaw = strtolower(trim((string) ($q['question_type'] ?? '')));
  797. $isChoiceQuestion = in_array($questionTypeRaw, ['choice', 'multiple_choice', 'single_choice', '选择题', 'select'], true);
  798. $normalizedOptions = [];
  799. $correctAnswerLetters = [];
  800. if ($isChoiceQuestion) {
  801. $rawOptions = $q['options'] ?? [];
  802. if (is_string($rawOptions)) {
  803. $decodedOptions = json_decode($rawOptions, true);
  804. $rawOptions = is_array($decodedOptions) ? $decodedOptions : [];
  805. }
  806. if (is_array($rawOptions)) {
  807. foreach ($rawOptions as $optKey => $optValue) {
  808. $letter = null;
  809. if (is_string($optKey) && preg_match('/([A-H])/i', $optKey, $m)) {
  810. $letter = strtoupper($m[1]);
  811. } elseif (is_array($optValue)) {
  812. $candidate = $optValue['label'] ?? $optValue['key'] ?? $optValue['option'] ?? null;
  813. if (is_string($candidate) && preg_match('/([A-H])/i', $candidate, $m)) {
  814. $letter = strtoupper($m[1]);
  815. }
  816. }
  817. if ($letter === null) {
  818. continue;
  819. }
  820. $content = is_array($optValue)
  821. ? ($optValue['content'] ?? $optValue['text'] ?? $optValue['value'] ?? '')
  822. : $optValue;
  823. if (!is_string($content)) {
  824. $content = json_encode($content, JSON_UNESCAPED_UNICODE);
  825. }
  826. $content = trim((string) $content);
  827. if ($content !== '') {
  828. $normalizedOptions[$letter] = $content;
  829. }
  830. }
  831. }
  832. if (trim((string) $correctAnswer) !== '') {
  833. preg_match_all('/[A-H]/i', strtoupper((string) $correctAnswer), $answerMatches);
  834. $correctAnswerLetters = array_values(array_unique($answerMatches[0] ?? []));
  835. }
  836. if (!empty($normalizedOptions) && !empty($correctAnswerLetters)) {
  837. $mappedAnswers = [];
  838. foreach ($correctAnswerLetters as $letter) {
  839. if (isset($normalizedOptions[$letter])) {
  840. $mappedAnswers[] = $letter . '. ' . $normalizedOptions[$letter];
  841. }
  842. }
  843. if (!empty($mappedAnswers)) {
  844. $displayCorrectAnswer = implode(';', $mappedAnswers);
  845. }
  846. }
  847. }
  848. $choiceOptionLetters = !empty($normalizedOptions) ? array_keys($normalizedOptions) : [];
  849. sort($choiceOptionLetters);
  850. $choiceLayoutClass = 'options-grid-1';
  851. $layoutDecider = app(\App\Support\OptionLayoutDecider::class);
  852. if (! empty($normalizedOptions) && ! empty($choiceOptionLetters)) {
  853. $optValuesForLayout = [];
  854. foreach ($choiceOptionLetters as $L) {
  855. $optValuesForLayout[] = $normalizedOptions[$L];
  856. }
  857. $layoutMeta = $layoutDecider->decide($optValuesForLayout, 'grading');
  858. $choiceLayoutClass = $layoutMeta['class'] ?? 'options-grid-1';
  859. }
  860. @endphp
  861. <div class="question-card">
  862. <div style="display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:4px;">
  863. <div style="display:flex; align-items:center; gap:8px; font-weight:600;">
  864. <span class="tag">题号 {{ $q['display_number'] ?? $q['question_number'] }} · {{ $typeLabel }}</span>
  865. @php
  866. $kpName = $q['knowledge_point_name'] ?? $q['knowledge_point'] ?? null;
  867. if (!empty($kpName) && $kpName !== '-' && $kpName !== '未标注') {
  868. echo '<span class="tag" style="background: #eef2ff; color:#4338ca;">' . e($kpName) . '</span>';
  869. }
  870. @endphp
  871. @if($showStatus)
  872. <span class="tag" style="background: {{ $statusColor }}; color:#fff;">{{ $statusText }}</span>
  873. @endif
  874. </div>
  875. @if($score !== null && $fullScore !== null)
  876. <div class="muted">得分 {{ $score }} / {{ $fullScore }}</div>
  877. @endif
  878. </div>
  879. {{-- 题干:数据已在 ExamPdfExportService 中经 processQuestionData(含 <image>→<img>、公式);样式对齐判卷 question-stem --}}
  880. <div class="question-stem math-content" style="margin-bottom:6px;">{!! $questionText !!}</div>
  881. {{-- 选择题:与判卷页相同网格布局(OptionLayoutDecider),正确项旁 ✅ --}}
  882. @if(!empty($isChoiceQuestion) && !empty($normalizedOptions))
  883. <div class="report-options {{ $choiceLayoutClass }}">
  884. @foreach($choiceOptionLetters as $optLetter)
  885. @php
  886. $isCorrectOpt = in_array($optLetter, $correctAnswerLetters ?? [], true);
  887. $rawOpt = (string) ($normalizedOptions[$optLetter] ?? '');
  888. $normalizedOpt = str_replace('\\dfrac', '\\frac', $rawOpt);
  889. $normalizedOpt = str_replace('\\displaystyle', '', $normalizedOpt);
  890. $normalizedOpt = $layoutDecider->normalizeCompactMathForDisplay($normalizedOpt);
  891. $rawOptPlain = html_entity_decode(strip_tags($rawOpt), ENT_QUOTES | ENT_HTML5, 'UTF-8');
  892. $rawOptPlain = preg_replace('/\s+/u', '', $rawOptPlain ?? '');
  893. $isShortOption = mb_strlen((string) $rawOptPlain, 'UTF-8') <= 8;
  894. $valClass = $isShortOption ? 'option-short' : 'option-long';
  895. $renderedOpt = $renderLikeGrading($normalizedOpt);
  896. @endphp
  897. <div class="option option-compact">
  898. <strong>{{ $optLetter }}.</strong>
  899. <span class="option-value {{ $valClass }}">{!! $renderedOpt !!}</span>
  900. @if($isCorrectOpt)
  901. <span style="margin-left:4px; font-size:13px; color:#15803d; font-weight:700;">✅</span>
  902. @endif
  903. </div>
  904. @endforeach
  905. </div>
  906. @endif
  907. {{-- 非选择题,或选择题未能得到选项列表时:显示「正确答案」文字框 --}}
  908. @if(!empty($correctAnswer) && (!$isChoiceQuestion || empty($normalizedOptions)))
  909. <div class="question-block" style="background:#f0fdf4; border-left:3px solid #10b981;">
  910. <div style="font-weight:600; font-size:12px; color:#111827; margin-bottom:3px;">正确答案</div>
  911. <div class="math-content" style="line-height:1.7; color:#374151;">
  912. {!! $renderLikeGrading($displayCorrectAnswer) !!}
  913. </div>
  914. </div>
  915. @endif
  916. {{-- 解题思路:判卷页 answer-meta 口径(单行标题+正文,避免大块色条占行) --}}
  917. @if(!empty($solution))
  918. <div class="report-answer-meta">
  919. <div class="answer-line">
  920. <strong>解题思路:</strong>
  921. <span class="solution-content">{!! $renderLikeGrading($solution) !!}</span>
  922. </div>
  923. </div>
  924. @elseif(!empty($analysis) && $analysis !== '暂无解题思路记录')
  925. <div class="report-answer-meta">
  926. <div class="answer-line">
  927. <strong>解题思路:</strong>
  928. <span class="solution-content">{!! $renderLikeGrading($analysis) !!}</span>
  929. </div>
  930. </div>
  931. @endif
  932. {{-- 解题步骤(如果有) --}}
  933. @if(!empty($steps))
  934. <div style="margin-top:6px; font-size:12px;">
  935. <div style="font-weight:600; margin-bottom:3px;">解题步骤</div>
  936. <ol style="margin:0; padding-left:18px;">
  937. @foreach($steps as $s)
  938. <li style="margin-bottom:2px;">{!! nl2br(e(is_array($s) ? json_encode($s, JSON_UNESCAPED_UNICODE) : $s)) !!}</li>
  939. @endforeach
  940. </ol>
  941. </div>
  942. @endif
  943. </div>
  944. @endforeach
  945. </div>
  946. @endif
  947. </div> {{-- 闭合page div --}}
  948. <script src="/js/katex.min.js"></script>
  949. <script src="/js/auto-render.min.js"></script>
  950. <script>
  951. document.addEventListener('DOMContentLoaded', function() {
  952. try {
  953. renderMathInElement(document.body, {
  954. delimiters: [
  955. {left: "$$", right: "$$", display: true},
  956. {left: "$", right: "$", display: false},
  957. {left: "\\(", right: "\\)", display: false},
  958. {left: "\\[", right: "\\]", display: true}
  959. ],
  960. throwOnError: false,
  961. strict: false,
  962. trust: true
  963. });
  964. } catch (e) {}
  965. });
  966. </script>
  967. </body>
  968. </html>