common-styles.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. {{--
  2. PDF通用样式片段
  3. 被卷子、判卷和知识点讲解模板共享
  4. 包含:
  5. 1. 页面设置 (A4, 页边距, 页眉页脚)
  6. 2. 基础排版样式(不含body,因为知识点讲解有独立容器)
  7. 3. 题目相关通用样式
  8. 4. SVG/数学公式渲染样式
  9. 5. 图片容器样式
  10. 6. 打印相关样式
  11. --}}
  12. <style>
  13. /* ==================== 页面设置 ==================== */
  14. @page {
  15. size: A4;
  16. margin: 2cm 2cm 2.5cm 2cm;
  17. @top-left {
  18. content: string(top-left-text);
  19. font-size: 12px;
  20. color: #666;
  21. }
  22. @top-right {
  23. content: string(top-right-text);
  24. font-size: 12px;
  25. color: #666;
  26. }
  27. @bottom-left {
  28. content: string(bottom-left-text);
  29. font-size: 12px;
  30. color: #666;
  31. }
  32. @bottom-right {
  33. content: counter(page) "/" counter(pages);
  34. font-size: 12px;
  35. color: #666;
  36. }
  37. }
  38. /* ==================== 通用组件样式 ==================== */
  39. /* 大题标题:不与后面内容分开 */
  40. .section-title {
  41. font-size: 16px;
  42. font-weight: bold;
  43. margin-top: 16px;
  44. margin-bottom: 10px;
  45. page-break-after: avoid;
  46. break-after: avoid;
  47. }
  48. /* 题目整体:不分页 */
  49. .question {
  50. margin-bottom: 14px;
  51. page-break-inside: avoid;
  52. break-inside: avoid;
  53. -webkit-column-break-inside: avoid;
  54. }
  55. /* 题目网格:不分页 */
  56. .question-grid {
  57. display: grid;
  58. grid-template-columns: auto 1fr;
  59. column-gap: 4px;
  60. row-gap: 6px;
  61. align-items: flex-start;
  62. page-break-inside: avoid;
  63. break-inside: avoid;
  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.65;
  72. margin-top: 1px;
  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 {
  79. font-size: 14px;
  80. line-height: 1.65;
  81. font-family: inherit;
  82. display: block;
  83. orphans: 3;
  84. widows: 3;
  85. }
  86. .question-score { margin-right: 6px; font-weight: 600; }
  87. .question-score-inline {
  88. display: block;
  89. font-size: 13px;
  90. color: #555;
  91. margin: 0 0 2px 0;
  92. white-space: nowrap;
  93. }
  94. /* 题目内容:防止孤行 */
  95. .question-stem {
  96. display: block;
  97. font-size: 14px;
  98. font-family: inherit;
  99. orphans: 3;
  100. widows: 3;
  101. }
  102. .question-content {
  103. font-size: 14px;
  104. margin-bottom: 8px;
  105. line-height: 1.6;
  106. orphans: 3;
  107. widows: 3;
  108. }
  109. /* ==================== 选项样式 ==================== */
  110. /* 选项容器:不分页 */
  111. .options {
  112. display: grid;
  113. row-gap: 8px;
  114. margin-top: 8px;
  115. page-break-inside: avoid;
  116. break-inside: avoid;
  117. }
  118. .options-grid-4 {
  119. display: grid;
  120. grid-template-columns: repeat(4, 1fr);
  121. gap: 8px 12px;
  122. page-break-inside: avoid;
  123. break-inside: avoid;
  124. }
  125. .options-grid-2 {
  126. display: grid;
  127. grid-template-columns: 1fr 1fr;
  128. gap: 8px 20px;
  129. page-break-inside: avoid;
  130. break-inside: avoid;
  131. }
  132. .options-grid-1 {
  133. display: grid;
  134. grid-template-columns: 1fr;
  135. gap: 8px;
  136. page-break-inside: avoid;
  137. break-inside: avoid;
  138. }
  139. /* 单个选项:不分页 */
  140. .option {
  141. width: 100%;
  142. font-size: 14px;
  143. line-height: 1.6;
  144. word-wrap: break-word;
  145. display: flex;
  146. align-items: flex-start;
  147. page-break-inside: avoid;
  148. break-inside: avoid;
  149. }
  150. .option strong { margin-right: 4px; }
  151. .option-inline { display: inline-flex; align-items: baseline; margin-right: 20px; }
  152. .option-compact { font-size: 14px; line-height: 1.6; }
  153. /* ==================== 答案区域样式 ==================== */
  154. /* 答案元信息:不分页 */
  155. .answer-meta {
  156. font-size: 12px;
  157. color: #2f2f2f;
  158. line-height: 1.75;
  159. margin-top: 4px;
  160. page-break-inside: avoid;
  161. break-inside: avoid;
  162. }
  163. .answer-line + .answer-line { margin-top: 4px; }
  164. .solution-step {
  165. align-items: center;
  166. gap: 6px;
  167. }
  168. .step-box { display: inline-block; }
  169. .step-label { white-space: nowrap; }
  170. .solution-heading { font-weight: 700; }
  171. .solution-content { display: inline-block; line-height: 1.75; }
  172. /* 解析区域:不分页 */
  173. .solution-section {
  174. margin-top: 8px;
  175. padding: 6px 8px;
  176. page-break-inside: avoid;
  177. break-inside: avoid;
  178. }
  179. .solution-section strong {
  180. font-size: 13px;
  181. }
  182. .solution-parsed {
  183. margin-top: 6px;
  184. line-height: 1.8;
  185. }
  186. /* 填空线样式 */
  187. .fill-line {
  188. display: inline-block;
  189. border-bottom: 1px solid #000;
  190. width: 100px;
  191. text-align: center;
  192. }
  193. .wavy-underline {
  194. display: inline-block;
  195. min-width: 80px;
  196. height: 22px;
  197. border-bottom: 1.2px dashed #444;
  198. vertical-align: middle;
  199. }
  200. .wavy-underline.short {
  201. min-width: 60px;
  202. }
  203. /* 答案区域样式 */
  204. .answer-area {
  205. position: relative;
  206. margin-top: 12px;
  207. page-break-inside: avoid;
  208. break-inside: avoid;
  209. }
  210. .answer-area .answer-label {
  211. position: absolute;
  212. top: -10px;
  213. left: 10px;
  214. font-size: 10px;
  215. background: #fff;
  216. padding: 0 4px;
  217. color: #555;
  218. letter-spacing: 1px;
  219. }
  220. .answer-area.wavy {
  221. height: 28px;
  222. border-bottom: 1.5px dashed #555;
  223. background-image: repeating-linear-gradient(
  224. -45deg,
  225. rgba(0, 0, 0, 0.35),
  226. rgba(0, 0, 0, 0.35) 4px,
  227. transparent 4px,
  228. transparent 8px
  229. );
  230. background-size: 16px 16px;
  231. background-repeat: repeat-x;
  232. background-position: bottom;
  233. }
  234. .answer-area.boxy {
  235. min-height: 150px;
  236. border: 1.5px solid #444;
  237. border-radius: 6px;
  238. padding: 14px;
  239. }
  240. /* ==================== SVG与数学公式样式 ==================== */
  241. /* 让内嵌 SVG 按比例缩放展示 */
  242. svg, .math-render svg {
  243. max-width: 100%;
  244. height: auto;
  245. display: block;
  246. shape-rendering: geometricPrecision;
  247. text-rendering: geometricPrecision;
  248. }
  249. /* 优化SVG中文字标签的显示 */
  250. svg text {
  251. font-family: "Noto Serif", "Noto Serif CJK SC", "Noto Sans CJK SC", "Noto Sans", "STSongti-SC", "PingFang SC", "Songti SC", serif !important;
  252. font-size: 13px !important;
  253. font-weight: bold;
  254. font-style: normal;
  255. dominant-baseline: middle;
  256. text-anchor: middle;
  257. alignment-baseline: central;
  258. paint-order: stroke fill;
  259. stroke: none;
  260. fill: #000;
  261. }
  262. /* SVG中点标签的精确对齐 */
  263. svg text.label-point {
  264. font-size: 14px;
  265. font-weight: bold;
  266. dx: 0;
  267. dy: 0;
  268. }
  269. /* 确保SVG中的圆形和线条正确渲染 */
  270. svg circle, svg line, svg polygon, svg polyline {
  271. shape-rendering: geometricPrecision;
  272. }
  273. /* ==================== 图片容器样式 ==================== */
  274. .pdf-figure {
  275. break-inside: avoid;
  276. page-break-inside: avoid;
  277. -webkit-column-break-inside: avoid;
  278. break-before: avoid;
  279. break-after: avoid;
  280. page-break-before: avoid;
  281. page-break-after: avoid;
  282. margin: 8px 0;
  283. display: block;
  284. min-height: 30px;
  285. max-height: 82mm;
  286. }
  287. .pdf-figure img {
  288. max-width: min(84%, 420px);
  289. max-height: 82mm;
  290. width: auto;
  291. height: auto;
  292. display: block;
  293. margin: 0 auto;
  294. object-fit: contain;
  295. box-sizing: border-box;
  296. -webkit-print-color-adjust: exact;
  297. print-color-adjust: exact;
  298. image-rendering: -webkit-optimize-contrast;
  299. }
  300. /* 题干中的图片样式 */
  301. .question-stem img,
  302. .question-main img,
  303. .question-content img,
  304. .answer-meta img,
  305. .answer-line img,
  306. .solution-content img,
  307. .solution-section img,
  308. .solution-parsed img {
  309. display: block;
  310. max-width: 220px;
  311. max-height: 60mm;
  312. width: auto;
  313. height: auto;
  314. margin: 6px auto;
  315. box-sizing: border-box;
  316. object-fit: contain;
  317. -webkit-print-color-adjust: exact;
  318. print-color-adjust: exact;
  319. image-rendering: -webkit-optimize-contrast;
  320. }
  321. /* 选项中的图片样式 */
  322. .option img {
  323. max-width: 100%;
  324. height: auto;
  325. vertical-align: middle;
  326. }
  327. /* ==================== 打印样式 ==================== */
  328. @media print {
  329. .no-print {
  330. display: none;
  331. }
  332. body {
  333. -webkit-print-color-adjust: exact;
  334. }
  335. }
  336. /* ==================== KaTeX数学公式样式 ==================== */
  337. .katex {
  338. font-size: 1em !important;
  339. vertical-align: -0.04em;
  340. }
  341. .katex-display {
  342. margin: 0.35em 0 !important;
  343. }
  344. /* 扫描判题卡页(统一PDF时样式需在公共样式中存在) */
  345. .scan-sheet-page {
  346. page-break-before: always;
  347. break-before: page;
  348. }
  349. .scan-sheet-header {
  350. text-align: center;
  351. margin-bottom: 1.5rem;
  352. border-bottom: 2px solid #000;
  353. padding-bottom: 1rem;
  354. }
  355. .scan-sheet-hint {
  356. font-size: 13px;
  357. color: #444;
  358. margin-bottom: 10px;
  359. line-height: 1.5;
  360. }
  361. .scan-sheet-list {
  362. display: grid;
  363. grid-template-columns: 1fr;
  364. gap: 6px;
  365. }
  366. .scan-sheet-item {
  367. border: 1px solid #b5b5b5;
  368. border-radius: 4px;
  369. padding: 6px 8px;
  370. display: grid;
  371. grid-template-columns: auto auto 1fr;
  372. align-items: center;
  373. column-gap: 8px;
  374. font-size: 13px;
  375. line-height: 1.2;
  376. page-break-inside: avoid;
  377. break-inside: avoid;
  378. }
  379. .scan-sheet-page .scan-grade-box {
  380. width: 21px;
  381. height: 21px;
  382. border: 1px solid #333;
  383. display: inline-block;
  384. vertical-align: middle;
  385. box-sizing: border-box;
  386. }
  387. .scan-sheet-no {
  388. font-weight: 700;
  389. text-align: center;
  390. min-width: 44px;
  391. }
  392. .scan-sheet-marks {
  393. display: flex;
  394. align-items: center;
  395. gap: 4px;
  396. justify-content: flex-start;
  397. white-space: nowrap;
  398. }
  399. </style>