exam-grading.blade.php 7.3 KB

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