exam-grading.blade.php 7.3 KB

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