| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>拆卡视频高光时刻展示</title>
- <style>
- body {
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
- background-color: #f4f4f9;
- margin: 0;
- padding: 20px;
- color: #333;
- }
- .container {
- max-width: 900px;
- margin: 0 auto;
- }
- h1 {
- text-align: center;
- color: #4a5568;
- }
- /* 输入区域样式 */
- .input-section {
- background: white;
- padding: 20px;
- border-radius: 12px;
- box-shadow: 0 4px 6px rgba(0,0,0,0.1);
- margin-bottom: 30px;
- }
- textarea {
- width: 100%;
- height: 150px;
- border: 1px solid #ddd;
- border-radius: 8px;
- padding: 10px;
- font-family: monospace;
- box-sizing: border-box; /* 确保padding不撑大宽度 */
- }
- button {
- background-color: #4299e1;
- color: white;
- border: none;
- padding: 10px 20px;
- border-radius: 6px;
- cursor: pointer;
- font-size: 16px;
- margin-top: 10px;
- transition: background 0.3s;
- }
- button:hover {
- background-color: #3182ce;
- }
- /* 列表展示样式 */
- .card-list {
- display: flex;
- flex-direction: column;
- gap: 20px;
- }
- .card-item {
- display: flex;
- background: white;
- border-radius: 12px;
- overflow: hidden;
- box-shadow: 0 4px 6px rgba(0,0,0,0.05);
- transition: transform 0.2s;
- }
- .card-item:hover {
- transform: translateY(-2px);
- box-shadow: 0 8px 12px rgba(0,0,0,0.1);
- }
- .card-image {
- width: 300px;
- background-color: #eee;
- flex-shrink: 0;
- }
- .card-image img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- display: block;
- }
- .card-content {
- padding: 20px;
- flex-grow: 1;
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .timestamp {
- background-color: #edf2f7;
- color: #718096;
- padding: 4px 8px;
- border-radius: 4px;
- font-size: 0.85em;
- display: inline-block;
- margin-bottom: 10px;
- width: fit-content;
- }
- .card-title {
- font-size: 1.4em;
- font-weight: bold;
- margin: 0 0 5px 0;
- color: #2d3748;
- }
- .card-subtitle {
- color: #718096;
- font-size: 1em;
- margin-bottom: 15px;
- }
- .info-row {
- display: flex;
- justify-content: space-between;
- margin-top: auto;
- border-top: 1px solid #edf2f7;
- padding-top: 10px;
- }
- .rarity {
- font-weight: bold;
- color: #e53e3e;
- }
- .series {
- color: #4a5568;
- }
- /* 移动端适配 */
- @media (max-width: 600px) {
- .card-item {
- flex-direction: column;
- }
- .card-image {
- width: 100%;
- height: 200px;
- }
- }
- </style>
- </head>
- <body>
- <div class="container">
- <h1>🃏 拆卡结果展示</h1>
- <!-- 输入区域 -->
- <div class="input-section">
- <h3>粘贴 JSON 数据:</h3>
- <textarea id="jsonInput" placeholder='[
- {
- "time": "00:16:32",
- "card_name_cn": "船长皮卡丘",
- ...
- }
- ]'></textarea>
- <button onclick="renderCards()">生成列表</button>
- </div>
- <!-- 结果区域 -->
- <div id="resultList" class="card-list">
- <!-- 卡片会在这里生成 -->
- </div>
- </div>
- <script>
- function renderCards() {
- const input = document.getElementById('jsonInput').value;
- const container = document.getElementById('resultList');
- // 清空现有列表
- container.innerHTML = '';
- try {
- const data = JSON.parse(input);
- if (!Array.isArray(data)) {
- alert('❌ 输入的不是 JSON 数组格式');
- return;
- }
- data.forEach(item => {
- // 创建卡片 HTML
- const cardHtml = `
- <div class="card-item">
- <div class="card-image">
- ${item.frame_image_path
- ? `<img src="${item.frame_image_path}" alt="${item.card_name_cn}" onerror="this.src='https://via.placeholder.com/300x200?text=Image+Not+Found'">`
- : '<div style="height:100%; display:flex; align-items:center; justify-content:center; color:#999;">无图片</div>'}
- </div>
- <div class="card-content">
- <div class="timestamp">⏰ ${item.time}</div>
- <h2 class="card-title">${item.card_name_cn || '未知中文名'}</h2>
- <div class="card-subtitle">${item.card_name_en || ''}</div>
- <div class="info-row">
- <span class="series">📦 系列: ${item.series || '未知'}</span>
- <span class="rarity">${item.rarity_desc || '未知稀有度'}</span>
- </div>
- </div>
- </div>
- `;
- // 插入 DOM
- container.insertAdjacentHTML('beforeend', cardHtml);
- });
- } catch (e) {
- alert('❌ JSON 解析失败,请检查格式是否正确。\n错误信息: ' + e.message);
- }
- }
- </script>
- </body>
- </html>
|