exam-grading.blade.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. @php
  2. // 复用题目数据并开启判卷模式(显示方框+答案+思路)
  3. $grading = true;
  4. @endphp
  5. <!DOCTYPE html>
  6. <html lang="zh-CN">
  7. <head>
  8. <meta charset="UTF-8">
  9. <title>{{ $paper->paper_name ?? '判卷预览' }}</title>
  10. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css">
  11. <style>
  12. @page { size: A4; margin: 2cm; }
  13. :root {
  14. --question-gap: 6px;
  15. }
  16. body {
  17. font-family: "SimSun", "Songti SC", serif;
  18. line-height: 1.65;
  19. color: #000;
  20. background: #fff;
  21. font-size: 14px;
  22. }
  23. .page {
  24. max-width: 720px;
  25. margin: 0 auto;
  26. padding: 0 12px;
  27. }
  28. .header { text-align: center; margin-bottom: 1.5rem; border-bottom: 2px solid #000; padding-bottom: 1rem; }
  29. .section-title { font-size: 16px; font-weight: bold; margin-top: 16px; margin-bottom: 10px; }
  30. .question { margin-bottom: 14px; page-break-inside: avoid; }
  31. .question-grid {
  32. display: grid;
  33. grid-template-columns: auto 1fr;
  34. column-gap: 4px;
  35. row-gap: 6px;
  36. align-items: flex-start;
  37. }
  38. .question-lead {
  39. display: flex;
  40. gap: 4px;
  41. align-items: flex-start;
  42. font-weight: 600;
  43. font-size: 14px;
  44. line-height: 1.6;
  45. margin-top: 2px;
  46. }
  47. .question-lead.spacer { visibility: hidden; }
  48. .question-number { white-space: nowrap; margin-right: 2px; }
  49. .grading-boxes { gap: 4px; flex-wrap: wrap; align-items: center; }
  50. .grading-boxes span { vertical-align: middle; }
  51. .question-main { font-size: 14px; line-height: 1.65; font-family: inherit; display: block; }
  52. .question-score { margin-right: 6px; font-weight: 600; }
  53. .question-stem { display: inline-block; font-size: 14px; font-family: inherit; }
  54. .options { display: grid; row-gap: 8px; margin-top: 8px; }
  55. .options-grid-2 {
  56. display: grid;
  57. grid-template-columns: 1fr 1fr;
  58. gap: 8px 20px;
  59. }
  60. .option { display: flex; align-items: flex-start; font-size: 14px; line-height: 1.6; }
  61. .option strong { margin-right: 4px; }
  62. .option-compact { font-size: 14px; line-height: 1.6; }
  63. .answer-area { position: relative; margin-top: 4px; }
  64. .answer-area.boxy {
  65. min-height: 150px;
  66. border: 1.5px solid #444;
  67. border-radius: 6px;
  68. padding: 14px;
  69. }
  70. .answer-label {
  71. position: absolute;
  72. top: -10px;
  73. left: 10px;
  74. font-size: 10px;
  75. background: #fff;
  76. padding: 0 4px;
  77. color: #555;
  78. letter-spacing: 1px;
  79. }
  80. .answer-meta {
  81. font-size: 12px;
  82. color: #2f2f2f;
  83. line-height: 1.75;
  84. margin-top: 4px;
  85. }
  86. .answer-line + .answer-line { margin-top: 4px; }
  87. .solution-step {
  88. align-items: center;
  89. gap: 6px;
  90. }
  91. .step-box { display: inline-block; }
  92. .step-label { white-space: nowrap; }
  93. .solution-heading { font-weight: 700; }
  94. .solution-content { display: inline-block; line-height: 1.75; }
  95. .solution-section {
  96. margin-top: 8px;
  97. padding: 6px 8px;
  98. background: #f5f5f5;
  99. border-left: 3px solid #4163ff;
  100. border-radius: 3px;
  101. }
  102. .solution-section strong {
  103. color: #4163ff;
  104. font-size: 13px;
  105. }
  106. .solution-parsed {
  107. margin-top: 6px;
  108. line-height: 1.8;
  109. }
  110. svg, .math-render svg {
  111. max-width: 100%;
  112. height: auto;
  113. display: block;
  114. /* 确保SVG中的文字和图形元素正确对齐 */
  115. shape-rendering: geometricPrecision;
  116. text-rendering: geometricPrecision;
  117. }
  118. /* 优化SVG中文字标签的显示 */
  119. svg text {
  120. font-family: "SimSun", "Times New Roman", serif !important;
  121. font-size: 12px;
  122. font-weight: bold;
  123. dominant-baseline: middle;
  124. text-anchor: middle;
  125. alignment-baseline: central;
  126. /* 确保文字在点的正中央 */
  127. paint-order: stroke fill;
  128. stroke: none;
  129. fill: #000;
  130. }
  131. /* SVG中点标签的精确对齐 */
  132. svg text.label-point {
  133. font-size: 14px;
  134. font-weight: bold;
  135. dx: 0;
  136. dy: 0;
  137. }
  138. /* 确保SVG中的圆形和线条正确渲染 */
  139. svg circle, svg line, svg polygon, svg polyline {
  140. shape-rendering: geometricPrecision;
  141. }
  142. </style>
  143. </head>
  144. <body>
  145. <div class="page">
  146. <div class="header">
  147. <div style="font-size:22px;font-weight:bold;">判卷专用</div>
  148. <div style="font-size:18px;">{{ $paper->paper_name ?? '未命名试卷' }}</div>
  149. <div style="display:flex;justify-content:space-between;font-size:14px;margin-top:8px;">
  150. <span>老师:{{ $teacher['name'] ?? '________' }}</span>
  151. <span>年级:{{ $student['grade'] ?? '________' }}</span>
  152. <span>姓名:{{ $student['name'] ?? '________' }}</span>
  153. <span>得分:________</span>
  154. </div>
  155. </div>
  156. @include('components.exam.paper-body', ['questions' => $questions, 'grading' => true])
  157. </div>
  158. <!-- KaTeX -->
  159. <script src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js"></script>
  160. <script src="https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/contrib/auto-render.min.js"></script>
  161. <script>
  162. document.addEventListener('DOMContentLoaded', function() {
  163. try {
  164. renderMathInElement(document.body, {
  165. delimiters: [
  166. {left: '$$', right: '$$', display: true},
  167. {left: '$', right: '$', display: false},
  168. {left: '\\\\(', right: '\\\\)', display: false},
  169. {left: '\\\\[', right: '\\\\]', display: true}
  170. ],
  171. throwOnError: false,
  172. strict: false,
  173. trust: true
  174. });
  175. } catch(e) {}
  176. });
  177. </script>
  178. </body>
  179. </html>