common-styles.blade.php 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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.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 {
  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: "SimSun", "Times New Roman", serif !important;
  252. font-size: 12px;
  253. font-weight: bold;
  254. dominant-baseline: middle;
  255. text-anchor: middle;
  256. alignment-baseline: central;
  257. paint-order: stroke fill;
  258. stroke: none;
  259. fill: #000;
  260. }
  261. /* SVG中点标签的精确对齐 */
  262. svg text.label-point {
  263. font-size: 14px;
  264. font-weight: bold;
  265. dx: 0;
  266. dy: 0;
  267. }
  268. /* 确保SVG中的圆形和线条正确渲染 */
  269. svg circle, svg line, svg polygon, svg polyline {
  270. shape-rendering: geometricPrecision;
  271. }
  272. /* ==================== 图片容器样式 ==================== */
  273. .pdf-figure {
  274. break-inside: avoid;
  275. page-break-inside: avoid;
  276. -webkit-column-break-inside: avoid;
  277. break-before: avoid;
  278. break-after: avoid;
  279. page-break-before: avoid;
  280. page-break-after: avoid;
  281. margin: 8px 0;
  282. display: block;
  283. min-height: 30px;
  284. max-height: 180mm;
  285. }
  286. .pdf-figure img {
  287. max-width: 100%;
  288. height: auto;
  289. display: block;
  290. margin: 0 auto;
  291. object-fit: contain;
  292. box-sizing: border-box;
  293. }
  294. /* 题干中的图片样式 */
  295. .question-stem img,
  296. .question-main img,
  297. .question-content img {
  298. display: block;
  299. max-width: 100%;
  300. height: auto;
  301. margin: 12px auto;
  302. box-sizing: border-box;
  303. }
  304. /* 选项中的图片样式 */
  305. .option img {
  306. max-width: 100%;
  307. height: auto;
  308. vertical-align: middle;
  309. }
  310. /* ==================== 打印样式 ==================== */
  311. @media print {
  312. .no-print {
  313. display: none;
  314. }
  315. body {
  316. -webkit-print-color-adjust: exact;
  317. }
  318. }
  319. /* ==================== KaTeX数学公式样式 ==================== */
  320. .katex {
  321. font-size: 0.95em !important;
  322. }
  323. .katex-display {
  324. margin: 0.5em 0 !important;
  325. }
  326. </style>