fresh-mint-pl-vehicle-personnel-photo-demo.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  1. <!doctype html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>Fresh Mint · 车辆/驾押人员照片字段 Demo</title>
  7. <link rel="preconnect" href="https://fonts.googleapis.com" />
  8. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
  9. <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
  10. <style>
  11. :root {
  12. --primary: #10b981;
  13. --primary-dark: #059669;
  14. --primary-bg: #ecfdf5;
  15. --text: #1e293b;
  16. --text-muted: #64748b;
  17. --border: #d9e8e2;
  18. --surface: #ffffff;
  19. --table-head: #f8fafc;
  20. --bg-page: #f8fafc;
  21. --shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  22. --radius: 10px;
  23. --danger: #ef4444;
  24. }
  25. * { box-sizing: border-box; }
  26. body {
  27. margin: 0;
  28. min-height: 100vh;
  29. font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  30. font-size: 14px;
  31. line-height: 1.5;
  32. color: var(--text);
  33. background: var(--bg-page);
  34. }
  35. .demo-page { max-width: 1180px; margin: 0 auto; padding: 32px 24px 96px; }
  36. .demo-head { margin-bottom: 28px; }
  37. .demo-head h1 {
  38. margin: 0 0 8px;
  39. font-size: 24px;
  40. font-weight: 700;
  41. letter-spacing: -0.02em;
  42. }
  43. .demo-head h1 span { color: var(--primary); }
  44. .demo-head p { margin: 0; color: var(--text-muted); max-width: 820px; }
  45. .toc {
  46. display: flex;
  47. flex-wrap: wrap;
  48. gap: 8px;
  49. margin: 20px 0 0;
  50. }
  51. .toc a {
  52. display: inline-flex;
  53. align-items: center;
  54. height: 32px;
  55. padding: 0 12px;
  56. border-radius: 8px;
  57. border: 1px solid var(--border);
  58. background: var(--surface);
  59. color: var(--text);
  60. text-decoration: none;
  61. font-size: 13px;
  62. font-weight: 500;
  63. }
  64. .toc a:hover,
  65. .toc a.rec {
  66. border-color: var(--primary);
  67. color: var(--primary-dark);
  68. background: var(--primary-bg);
  69. }
  70. .section { margin-top: 40px; }
  71. .section-head { margin-bottom: 14px; }
  72. .section-head h2 {
  73. margin: 0 0 4px;
  74. font-size: 18px;
  75. font-weight: 700;
  76. }
  77. .section-head p { margin: 0; color: var(--text-muted); font-size: 13px; max-width: 760px; }
  78. .badge {
  79. display: inline-flex;
  80. align-items: center;
  81. height: 24px;
  82. padding: 0 10px;
  83. border-radius: 999px;
  84. font-size: 12px;
  85. font-weight: 600;
  86. background: var(--primary-bg);
  87. color: var(--primary-dark);
  88. margin-left: 8px;
  89. vertical-align: middle;
  90. }
  91. .panel {
  92. background: var(--surface);
  93. border: 1px solid var(--border);
  94. border-radius: var(--radius);
  95. box-shadow: var(--shadow);
  96. overflow: hidden;
  97. }
  98. .panel-top {
  99. padding: 16px 20px 12px;
  100. border-bottom: 1px solid var(--border);
  101. }
  102. .title-bar-heading {
  103. margin: 0;
  104. font-size: 16px;
  105. font-weight: 700;
  106. display: flex;
  107. align-items: center;
  108. gap: 8px;
  109. }
  110. .title-bar-heading::before {
  111. content: "";
  112. width: 3px;
  113. height: 16px;
  114. border-radius: 2px;
  115. background: var(--primary);
  116. }
  117. .list-toolbar {
  118. padding: 12px 20px;
  119. display: flex;
  120. gap: 8px;
  121. align-items: center;
  122. border-bottom: 1px solid var(--border);
  123. }
  124. .btn {
  125. display: inline-flex;
  126. align-items: center;
  127. gap: 6px;
  128. height: 36px;
  129. padding: 0 14px;
  130. border-radius: 8px;
  131. font-size: 14px;
  132. font-weight: 500;
  133. border: 1px solid var(--border);
  134. background: #fff;
  135. color: var(--text);
  136. cursor: default;
  137. }
  138. .btn-main {
  139. background: var(--primary);
  140. border-color: var(--primary);
  141. color: #fff;
  142. }
  143. .btn-ghost { background: #fff; }
  144. table.list-table {
  145. width: 100%;
  146. border-collapse: collapse;
  147. }
  148. table.list-table th,
  149. table.list-table td {
  150. padding: 12px 14px;
  151. border-bottom: 1px solid #eef2f7;
  152. text-align: center;
  153. font-size: 13px;
  154. }
  155. table.list-table th {
  156. background: var(--table-head);
  157. color: var(--text-muted);
  158. font-weight: 600;
  159. font-size: 12px;
  160. }
  161. table.list-table tr:nth-child(even) td { background: #fbfdff; }
  162. .link { color: var(--primary-dark); font-weight: 600; text-decoration: none; }
  163. .tag {
  164. display: inline-flex;
  165. align-items: center;
  166. height: 22px;
  167. padding: 0 8px;
  168. border-radius: 4px;
  169. font-size: 12px;
  170. font-weight: 600;
  171. background: var(--primary-bg);
  172. color: var(--primary-dark);
  173. }
  174. .tag.muted { background: #f1f5f9; color: var(--text-muted); }
  175. /* 方案 A:列表缩略图 */
  176. .photo-thumb {
  177. width: 48px;
  178. height: 48px;
  179. border-radius: 8px;
  180. object-fit: cover;
  181. border: 1px solid var(--border);
  182. display: inline-block;
  183. vertical-align: middle;
  184. background: #f1f5f9;
  185. }
  186. .photo-thumb.placeholder {
  187. display: inline-flex;
  188. align-items: center;
  189. justify-content: center;
  190. color: #94a3b8;
  191. font-size: 11px;
  192. background: #f8fafc;
  193. }
  194. /* 方案 B:附件卡片紧凑态 */
  195. .attach-compact {
  196. width: 56px;
  197. height: 40px;
  198. border-radius: 6px;
  199. object-fit: cover;
  200. border: 1px solid var(--border);
  201. display: inline-block;
  202. vertical-align: middle;
  203. }
  204. .compare {
  205. display: grid;
  206. grid-template-columns: 1fr 1fr;
  207. gap: 16px;
  208. }
  209. @media (max-width: 900px) {
  210. .compare { grid-template-columns: 1fr; }
  211. }
  212. .option-card {
  213. border: 2px solid var(--border);
  214. border-radius: var(--radius);
  215. background: var(--surface);
  216. overflow: hidden;
  217. cursor: pointer;
  218. transition: border-color 0.15s, box-shadow 0.15s;
  219. }
  220. .option-card:hover { border-color: #6ee7b7; }
  221. .option-card.selected {
  222. border-color: var(--primary);
  223. box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  224. }
  225. .option-card-head {
  226. padding: 12px 16px;
  227. border-bottom: 1px solid var(--border);
  228. display: flex;
  229. align-items: center;
  230. justify-content: space-between;
  231. gap: 8px;
  232. }
  233. .option-card-head h3 { margin: 0; font-size: 15px; }
  234. .option-card-head p { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
  235. .option-card-body { padding: 16px; background: #fbfdff; }
  236. .pick {
  237. width: 18px;
  238. height: 18px;
  239. border-radius: 50%;
  240. border: 2px solid var(--border);
  241. flex-shrink: 0;
  242. position: relative;
  243. }
  244. .option-card.selected .pick {
  245. border-color: var(--primary);
  246. background: var(--primary);
  247. }
  248. .option-card.selected .pick::after {
  249. content: "";
  250. position: absolute;
  251. left: 5px;
  252. top: 2px;
  253. width: 4px;
  254. height: 8px;
  255. border: solid #fff;
  256. border-width: 0 2px 2px 0;
  257. transform: rotate(45deg);
  258. }
  259. /* 弹窗表单 */
  260. .dialog-mask {
  261. border: 1px solid var(--border);
  262. border-radius: var(--radius);
  263. background: rgba(15, 23, 42, 0.28);
  264. padding: 28px 20px;
  265. display: flex;
  266. justify-content: center;
  267. }
  268. .dialog {
  269. width: min(720px, 100%);
  270. background: #fff;
  271. border-radius: 10px;
  272. box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
  273. overflow: hidden;
  274. }
  275. .dialog-header {
  276. padding: 16px 20px;
  277. border-bottom: 1px solid var(--border);
  278. font-weight: 700;
  279. font-size: 16px;
  280. }
  281. .dialog-body { padding: 20px; }
  282. .form-grid-2 {
  283. display: grid;
  284. grid-template-columns: 1fr 1fr;
  285. gap: 16px;
  286. }
  287. .form-item label {
  288. display: block;
  289. font-size: 13px;
  290. font-weight: 600;
  291. margin-bottom: 6px;
  292. color: var(--text);
  293. }
  294. .form-item .control {
  295. height: 36px;
  296. border: 1px solid var(--border);
  297. border-radius: 8px;
  298. background: #fff;
  299. padding: 0 12px;
  300. display: flex;
  301. align-items: center;
  302. color: var(--text-muted);
  303. font-size: 13px;
  304. }
  305. .form-col-span-2 { grid-column: 1 / -1; }
  306. .form-tip {
  307. margin-top: 6px;
  308. font-size: 12px;
  309. color: var(--text-muted);
  310. }
  311. .upload-row {
  312. display: flex;
  313. flex-wrap: wrap;
  314. gap: 12px;
  315. align-items: flex-start;
  316. }
  317. .upload-card {
  318. width: 140px;
  319. height: 96px;
  320. border: 1px dashed #a7f3d0;
  321. border-radius: 8px;
  322. background: #f8fffb;
  323. display: flex;
  324. flex-direction: column;
  325. align-items: center;
  326. justify-content: center;
  327. gap: 6px;
  328. color: var(--primary-dark);
  329. font-size: 13px;
  330. font-weight: 500;
  331. }
  332. .upload-card .plus {
  333. width: 28px;
  334. height: 28px;
  335. border-radius: 50%;
  336. background: var(--primary-bg);
  337. color: var(--primary);
  338. display: flex;
  339. align-items: center;
  340. justify-content: center;
  341. font-size: 20px;
  342. line-height: 1;
  343. }
  344. .attachment-item {
  345. width: 140px;
  346. border: 1px solid var(--border);
  347. border-radius: 8px;
  348. overflow: hidden;
  349. background: #fff;
  350. }
  351. .attachment-preview {
  352. height: 96px;
  353. background: #f1f5f9;
  354. position: relative;
  355. }
  356. .attachment-preview img {
  357. width: 100%;
  358. height: 100%;
  359. object-fit: cover;
  360. display: block;
  361. }
  362. .attachment-footer {
  363. padding: 6px 8px;
  364. display: flex;
  365. align-items: center;
  366. justify-content: space-between;
  367. gap: 4px;
  368. border-top: 1px solid var(--border);
  369. font-size: 12px;
  370. color: var(--text-muted);
  371. }
  372. .attachment-footer .name {
  373. overflow: hidden;
  374. text-overflow: ellipsis;
  375. white-space: nowrap;
  376. flex: 1;
  377. }
  378. .del {
  379. color: var(--danger);
  380. font-size: 12px;
  381. cursor: default;
  382. }
  383. .dialog-footer {
  384. padding: 12px 20px;
  385. border-top: 1px solid var(--border);
  386. display: flex;
  387. justify-content: flex-end;
  388. gap: 8px;
  389. }
  390. .view-block {
  391. display: grid;
  392. grid-template-columns: 120px 1fr;
  393. gap: 16px;
  394. align-items: start;
  395. padding: 16px;
  396. border: 1px solid var(--border);
  397. border-radius: 8px;
  398. background: #fff;
  399. }
  400. .view-photo {
  401. width: 120px;
  402. height: 120px;
  403. border-radius: 10px;
  404. object-fit: cover;
  405. border: 1px solid var(--border);
  406. background: #f1f5f9;
  407. }
  408. .kv { display: grid; grid-template-columns: 88px 1fr; gap: 8px 12px; font-size: 13px; }
  409. .kv dt { color: var(--text-muted); }
  410. .kv dd { margin: 0; font-weight: 500; }
  411. .note {
  412. margin-top: 12px;
  413. padding: 12px 14px;
  414. border-radius: 8px;
  415. background: var(--primary-bg);
  416. color: var(--primary-dark);
  417. font-size: 13px;
  418. }
  419. .note strong { font-weight: 700; }
  420. .scope-grid {
  421. display: grid;
  422. grid-template-columns: repeat(4, 1fr);
  423. gap: 12px;
  424. }
  425. @media (max-width: 900px) {
  426. .scope-grid { grid-template-columns: 1fr 1fr; }
  427. .form-grid-2 { grid-template-columns: 1fr; }
  428. }
  429. .scope-item {
  430. border: 1px solid var(--border);
  431. border-radius: 8px;
  432. padding: 14px;
  433. background: #fff;
  434. text-align: center;
  435. }
  436. .scope-item .label { font-weight: 700; margin-bottom: 4px; }
  437. .scope-item .field { font-size: 12px; color: var(--text-muted); }
  438. .scope-item .field code {
  439. font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  440. font-size: 11px;
  441. color: var(--primary-dark);
  442. background: var(--primary-bg);
  443. padding: 1px 6px;
  444. border-radius: 4px;
  445. }
  446. .result-bar {
  447. position: sticky;
  448. bottom: 0;
  449. margin-top: 32px;
  450. padding: 14px 18px;
  451. border: 1px solid var(--border);
  452. border-radius: 10px;
  453. background: #fff;
  454. box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06);
  455. display: flex;
  456. align-items: center;
  457. justify-content: space-between;
  458. gap: 12px;
  459. flex-wrap: wrap;
  460. }
  461. .result-bar .summary { font-size: 13px; color: var(--text-muted); }
  462. .result-bar .summary b { color: var(--text); }
  463. </style>
  464. </head>
  465. <body>
  466. <div class="demo-page">
  467. <header class="demo-head">
  468. <h1><span>Fresh Mint</span> · 车辆 / 驾押人员照片字段</h1>
  469. <p>
  470. 覆盖四个列表页:三方车辆、山峡自有车辆、三方驾押人员、山峡驾押人员。
  471. 车辆与人员各增加一个照片字段,默认只存 <strong>1 张</strong>图片(MinIO URL)。
  472. 请点击下方方案卡片选择偏好,便于后续落地实现。
  473. </p>
  474. <nav class="toc">
  475. <a href="#scope">覆盖范围</a>
  476. <a href="#list-style" class="rec">列表展示</a>
  477. <a href="#form">新增/编辑表单</a>
  478. <a href="#view">查看弹窗</a>
  479. </nav>
  480. </header>
  481. <section class="section" id="scope">
  482. <div class="section-head">
  483. <h2>1. 覆盖范围 <span class="badge">两表四页</span></h2>
  484. <p>底层两张表各加一字段;四个页面共用同一套上传控件(AttachmentUploadField,limit=1,accept=image/*)。</p>
  485. </div>
  486. <div class="scope-grid">
  487. <div class="scope-item">
  488. <div class="label">三方车辆</div>
  489. <div class="field">表 <code>pl_vehicle</code><br />字段建议 <code>photo_urls</code></div>
  490. </div>
  491. <div class="scope-item">
  492. <div class="label">山峡自有车辆</div>
  493. <div class="field">同表 <code>pl_vehicle</code><br />车辆照片</div>
  494. </div>
  495. <div class="scope-item">
  496. <div class="label">三方驾押人员</div>
  497. <div class="field">表 <code>pl_personnel</code><br />字段建议 <code>photo_urls</code></div>
  498. </div>
  499. <div class="scope-item">
  500. <div class="label">山峡驾押人员</div>
  501. <div class="field">同表 <code>pl_personnel</code><br />人员照片</div>
  502. </div>
  503. </div>
  504. <div class="note">
  505. <strong>存储约定:</strong>与现有附件一致,库字段存逗号分隔 URL;前端 limit=1,实际默认只保留一张。上传 folder 建议:
  506. <code>pl/vehicle-photo</code> / <code>pl/personnel-photo</code>。
  507. </div>
  508. </section>
  509. <section class="section" id="list-style">
  510. <div class="section-head">
  511. <h2>2. 列表展示形态 <span class="badge">请点选</span></h2>
  512. <p>照片列放在主标识列(车牌号 / 姓名)附近。请选择更偏好的列表展示方式。</p>
  513. </div>
  514. <div class="compare">
  515. <div class="option-card selected" data-group="list" data-value="A" onclick="pick(this)">
  516. <div class="option-card-head">
  517. <div>
  518. <h3>方案 A · 方形缩略图(推荐)</h3>
  519. <p>48×48,object-fit: cover,无图显示「未上传」</p>
  520. </div>
  521. <div class="pick"></div>
  522. </div>
  523. <div class="option-card-body">
  524. <div class="panel">
  525. <div class="panel-top"><h2 class="title-bar-heading">三方车辆</h2></div>
  526. <div class="list-toolbar">
  527. <span class="btn btn-main">+ 新增车辆</span>
  528. <span class="btn btn-ghost">编辑</span>
  529. </div>
  530. <table class="list-table">
  531. <thead>
  532. <tr>
  533. <th style="width:72px">照片</th>
  534. <th>车牌号</th>
  535. <th>状态</th>
  536. <th>承运商</th>
  537. </tr>
  538. </thead>
  539. <tbody>
  540. <tr>
  541. <td>
  542. <img class="photo-thumb" alt="车辆照片"
  543. src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%2394a3b8'/%3E%3Cstop offset='1' stop-color='%23cbd5e1'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect fill='url(%23g)' width='96' height='96'/%3E%3Crect x='18' y='42' width='60' height='28' rx='4' fill='%23334155'/%3E%3Ccircle cx='32' cy='70' r='8' fill='%231e293b'/%3E%3Ccircle cx='64' cy='70' r='8' fill='%231e293b'/%3E%3C/svg%3E" />
  544. </td>
  545. <td><a class="link" href="#">皖H12345 / 皖H12346</a></td>
  546. <td><span class="tag">可用</span></td>
  547. <td>承运商1</td>
  548. </tr>
  549. <tr>
  550. <td><span class="photo-thumb placeholder">未上传</span></td>
  551. <td><a class="link" href="#">皖P09872 / 皖S90921</a></td>
  552. <td><span class="tag">可用</span></td>
  553. <td>隆鑫运输</td>
  554. </tr>
  555. </tbody>
  556. </table>
  557. </div>
  558. </div>
  559. </div>
  560. <div class="option-card" data-group="list" data-value="B" onclick="pick(this)">
  561. <div class="option-card-head">
  562. <div>
  563. <h3>方案 B · 附件卡片紧凑态</h3>
  564. <p>对齐证书附件列样式,略扁的预览卡</p>
  565. </div>
  566. <div class="pick"></div>
  567. </div>
  568. <div class="option-card-body">
  569. <div class="panel">
  570. <div class="panel-top"><h2 class="title-bar-heading">山峡驾押人员</h2></div>
  571. <div class="list-toolbar">
  572. <span class="btn btn-main">+ 新增人员</span>
  573. <span class="btn btn-ghost">编辑</span>
  574. </div>
  575. <table class="list-table">
  576. <thead>
  577. <tr>
  578. <th style="width:80px">照片</th>
  579. <th>姓名</th>
  580. <th>类型</th>
  581. <th>状态</th>
  582. </tr>
  583. </thead>
  584. <tbody>
  585. <tr>
  586. <td>
  587. <img class="attach-compact" alt="人员照片"
  588. src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='112' height='80'%3E%3Crect fill='%23e2e8f0' width='112' height='80'/%3E%3Ccircle cx='56' cy='30' r='14' fill='%2394a3b8'/%3E%3Cpath d='M28 68c4-16 20-22 28-22s24 6 28 22' fill='%2394a3b8'/%3E%3C/svg%3E" />
  589. </td>
  590. <td><a class="link" href="#">王驾驶</a></td>
  591. <td><span class="tag">驾驶员</span></td>
  592. <td><span class="tag">在职</span></td>
  593. </tr>
  594. <tr>
  595. <td><span class="tag muted">—</span></td>
  596. <td><a class="link" href="#">李押运</a></td>
  597. <td><span class="tag muted">押运员</span></td>
  598. <td><span class="tag">在职</span></td>
  599. </tr>
  600. </tbody>
  601. </table>
  602. </div>
  603. </div>
  604. </div>
  605. </div>
  606. </section>
  607. <section class="section" id="form">
  608. <div class="section-head">
  609. <h2>3. 新增 / 编辑弹窗</h2>
  610. <p>沿用协议附件卡片化布局:上传触发卡片 140×96,虚线边框;limit=1,仅图片;与业务字段同表单。</p>
  611. </div>
  612. <div class="dialog-mask">
  613. <div class="dialog">
  614. <div class="dialog-header">新增自有车辆</div>
  615. <div class="dialog-body">
  616. <div class="form-grid-2">
  617. <div class="form-item">
  618. <label>车牌号</label>
  619. <div class="control">请输入车牌号</div>
  620. </div>
  621. <div class="form-item">
  622. <label>挂车号</label>
  623. <div class="control">请输入挂车号</div>
  624. </div>
  625. <div class="form-item">
  626. <label>承运商</label>
  627. <div class="control">请选择承运商</div>
  628. </div>
  629. <div class="form-item">
  630. <label>载重(吨)</label>
  631. <div class="control">如 32</div>
  632. </div>
  633. <div class="form-item form-col-span-2">
  634. <label>车辆照片</label>
  635. <div class="upload-row">
  636. <div class="upload-card" title="已上传 1 张时隐藏此触发区">
  637. <div class="plus">+</div>
  638. <span>上传附件</span>
  639. </div>
  640. <!-- 演示:已上传一张时的状态(实际 limit=1 时上传卡可隐藏) -->
  641. <div class="attachment-item" style="display:none" id="demo-filled">
  642. <div class="attachment-preview">
  643. <img alt="车辆照片"
  644. src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='96'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%2394a3b8'/%3E%3Cstop offset='1' stop-color='%23cbd5e1'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect fill='url(%23g)' width='140' height='96'/%3E%3Crect x='30' y='40' width='80' height='32' rx='4' fill='%23334155'/%3E%3Ccircle cx='50' cy='72' r='9' fill='%231e293b'/%3E%3Ccircle cx='90' cy='72' r='9' fill='%231e293b'/%3E%3C/svg%3E" />
  645. </div>
  646. <div class="attachment-footer">
  647. <span class="name">vehicle-front.jpg</span>
  648. <span class="del">删除</span>
  649. </div>
  650. </div>
  651. </div>
  652. <div class="form-tip">仅支持图片,最多 1 张;上传后立即保存到对象存储。</div>
  653. </div>
  654. </div>
  655. </div>
  656. <div class="dialog-footer">
  657. <span class="btn btn-ghost">✕ 取消</span>
  658. <span class="btn btn-main">✓ 确定</span>
  659. </div>
  660. </div>
  661. </div>
  662. <div class="compare" style="margin-top:16px">
  663. <div class="option-card selected" data-group="form" data-value="optional" onclick="pick(this)">
  664. <div class="option-card-head">
  665. <div>
  666. <h3>照片非必填(推荐)</h3>
  667. <p>可先建档后补图,与当前证书附件策略一致</p>
  668. </div>
  669. <div class="pick"></div>
  670. </div>
  671. </div>
  672. <div class="option-card" data-group="form" data-value="required" onclick="pick(this)">
  673. <div class="option-card-head">
  674. <div>
  675. <h3>照片必填</h3>
  676. <p>新增/编辑提交时校验必须有 1 张图</p>
  677. </div>
  678. <div class="pick"></div>
  679. </div>
  680. </div>
  681. </div>
  682. </section>
  683. <section class="section" id="view">
  684. <div class="section-head">
  685. <h2>4. 查看弹窗中的照片</h2>
  686. <p>只读预览:左侧大图,右侧基础信息;无图时显示占位。</p>
  687. </div>
  688. <div class="panel" style="padding:20px">
  689. <div class="view-block">
  690. <img class="view-photo" alt="人员照片"
  691. src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Crect fill='%23e2e8f0' width='120' height='120'/%3E%3Ccircle cx='60' cy='44' r='22' fill='%2394a3b8'/%3E%3Cpath d='M22 108c8-28 28-38 38-38s30 10 38 38' fill='%2394a3b8'/%3E%3C/svg%3E" />
  692. <dl class="kv">
  693. <dt>姓名</dt><dd>王驾驶</dd>
  694. <dt>手机号</dt><dd>13089012212</dd>
  695. <dt>人员类型</dt><dd><span class="tag">驾驶员</span></dd>
  696. <dt>归属</dt><dd>山峡驾押人员</dd>
  697. <dt>状态</dt><dd><span class="tag">在职</span></dd>
  698. </dl>
  699. </div>
  700. </div>
  701. </section>
  702. <div class="result-bar">
  703. <div class="summary">
  704. 当前选择:列表 <b id="sel-list">方案 A · 方形缩略图</b> · 校验 <b id="sel-form">非必填</b>
  705. </div>
  706. <div style="font-size:12px;color:var(--text-muted)">文件:docs/fresh-mint-pl-vehicle-personnel-photo-demo.html</div>
  707. </div>
  708. </div>
  709. <script>
  710. const labels = {
  711. list: { A: '方案 A · 方形缩略图', B: '方案 B · 附件卡片紧凑态' },
  712. form: { optional: '非必填', required: '必填' }
  713. }
  714. const state = { list: 'A', form: 'optional' }
  715. function pick(el) {
  716. const group = el.dataset.group
  717. const value = el.dataset.value
  718. document.querySelectorAll('.option-card[data-group="' + group + '"]').forEach(function (card) {
  719. card.classList.toggle('selected', card === el)
  720. })
  721. state[group] = value
  722. document.getElementById('sel-list').textContent = labels.list[state.list]
  723. document.getElementById('sel-form').textContent = labels.form[state.form]
  724. if (window.parent !== window) {
  725. try {
  726. window.parent.postMessage({ type: 'demo-select', group: group, value: value, state: state }, '*')
  727. } catch (e) {}
  728. }
  729. }
  730. </script>
  731. </body>
  732. </html>