view_results.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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>拆卡视频高光时刻展示</title>
  7. <style>
  8. body {
  9. font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  10. background-color: #f4f4f9;
  11. margin: 0;
  12. padding: 20px;
  13. color: #333;
  14. }
  15. .container {
  16. max-width: 900px;
  17. margin: 0 auto;
  18. }
  19. h1 {
  20. text-align: center;
  21. color: #4a5568;
  22. }
  23. /* 输入区域样式 */
  24. .input-section {
  25. background: white;
  26. padding: 20px;
  27. border-radius: 12px;
  28. box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  29. margin-bottom: 30px;
  30. }
  31. textarea {
  32. width: 100%;
  33. height: 150px;
  34. border: 1px solid #ddd;
  35. border-radius: 8px;
  36. padding: 10px;
  37. font-family: monospace;
  38. box-sizing: border-box; /* 确保padding不撑大宽度 */
  39. }
  40. button {
  41. background-color: #4299e1;
  42. color: white;
  43. border: none;
  44. padding: 10px 20px;
  45. border-radius: 6px;
  46. cursor: pointer;
  47. font-size: 16px;
  48. margin-top: 10px;
  49. transition: background 0.3s;
  50. }
  51. button:hover {
  52. background-color: #3182ce;
  53. }
  54. /* 列表展示样式 */
  55. .card-list {
  56. display: flex;
  57. flex-direction: column;
  58. gap: 20px;
  59. }
  60. .card-item {
  61. display: flex;
  62. background: white;
  63. border-radius: 12px;
  64. overflow: hidden;
  65. box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  66. transition: transform 0.2s;
  67. }
  68. .card-item:hover {
  69. transform: translateY(-2px);
  70. box-shadow: 0 8px 12px rgba(0,0,0,0.1);
  71. }
  72. .card-image {
  73. width: 300px;
  74. background-color: #eee;
  75. flex-shrink: 0;
  76. }
  77. .card-image img {
  78. width: 100%;
  79. height: 100%;
  80. object-fit: cover;
  81. display: block;
  82. }
  83. .card-content {
  84. padding: 20px;
  85. flex-grow: 1;
  86. display: flex;
  87. flex-direction: column;
  88. justify-content: center;
  89. }
  90. .timestamp {
  91. background-color: #edf2f7;
  92. color: #718096;
  93. padding: 4px 8px;
  94. border-radius: 4px;
  95. font-size: 0.85em;
  96. display: inline-block;
  97. margin-bottom: 10px;
  98. width: fit-content;
  99. }
  100. .card-title {
  101. font-size: 1.4em;
  102. font-weight: bold;
  103. margin: 0 0 5px 0;
  104. color: #2d3748;
  105. }
  106. .card-subtitle {
  107. color: #718096;
  108. font-size: 1em;
  109. margin-bottom: 15px;
  110. }
  111. .info-row {
  112. display: flex;
  113. justify-content: space-between;
  114. margin-top: auto;
  115. border-top: 1px solid #edf2f7;
  116. padding-top: 10px;
  117. }
  118. .rarity {
  119. font-weight: bold;
  120. color: #e53e3e;
  121. }
  122. .series {
  123. color: #4a5568;
  124. }
  125. /* 移动端适配 */
  126. @media (max-width: 600px) {
  127. .card-item {
  128. flex-direction: column;
  129. }
  130. .card-image {
  131. width: 100%;
  132. height: 200px;
  133. }
  134. }
  135. </style>
  136. </head>
  137. <body>
  138. <div class="container">
  139. <h1>🃏 拆卡结果展示</h1>
  140. <!-- 输入区域 -->
  141. <div class="input-section">
  142. <h3>粘贴 JSON 数据:</h3>
  143. <textarea id="jsonInput" placeholder='[
  144. {
  145. "time": "00:16:32",
  146. "card_name_cn": "船长皮卡丘",
  147. ...
  148. }
  149. ]'></textarea>
  150. <button onclick="renderCards()">生成列表</button>
  151. </div>
  152. <!-- 结果区域 -->
  153. <div id="resultList" class="card-list">
  154. <!-- 卡片会在这里生成 -->
  155. </div>
  156. </div>
  157. <script>
  158. function renderCards() {
  159. const input = document.getElementById('jsonInput').value;
  160. const container = document.getElementById('resultList');
  161. // 清空现有列表
  162. container.innerHTML = '';
  163. try {
  164. const data = JSON.parse(input);
  165. if (!Array.isArray(data)) {
  166. alert('❌ 输入的不是 JSON 数组格式');
  167. return;
  168. }
  169. data.forEach(item => {
  170. // 创建卡片 HTML
  171. const cardHtml = `
  172. <div class="card-item">
  173. <div class="card-image">
  174. ${item.frame_image_path
  175. ? `<img src="${item.frame_image_path}" alt="${item.card_name_cn}" onerror="this.src='https://via.placeholder.com/300x200?text=Image+Not+Found'">`
  176. : '<div style="height:100%; display:flex; align-items:center; justify-content:center; color:#999;">无图片</div>'}
  177. </div>
  178. <div class="card-content">
  179. <div class="timestamp">⏰ ${item.time}</div>
  180. <h2 class="card-title">${item.card_name_cn || '未知中文名'}</h2>
  181. <div class="card-subtitle">${item.card_name_en || ''}</div>
  182. <div class="info-row">
  183. <span class="series">📦 系列: ${item.series || '未知'}</span>
  184. <span class="rarity">${item.rarity_desc || '未知稀有度'}</span>
  185. </div>
  186. </div>
  187. </div>
  188. `;
  189. // 插入 DOM
  190. container.insertAdjacentHTML('beforeend', cardHtml);
  191. });
  192. } catch (e) {
  193. alert('❌ JSON 解析失败,请检查格式是否正确。\n错误信息: ' + e.message);
  194. }
  195. }
  196. </script>
  197. </body>
  198. </html>