report.html.j2 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <!DOCTYPE html>
  2. <html lang="zh-CN" data-theme="dark">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>{{ meta.title }} · 拉片报告</title>
  7. <style>
  8. :root {
  9. --bg:#0a0e17; --surface:#111827; --card:#1a2332; --border:#2a3a52;
  10. --text:#e2e8f0; --muted:#94a3b8; --brand:#3b82f6; --brand-light:#60a5fa;
  11. --green:#10b981; --yellow:#f59e0b; --red:#ef4444; --purple:#8b5cf6;
  12. }
  13. * { margin:0; padding:0; box-sizing:border-box; }
  14. body { font-family:-apple-system,'PingFang SC','Microsoft YaHei',sans-serif;
  15. background:var(--bg); color:var(--text); line-height:1.7; padding-bottom:80px; }
  16. /* === 顶部视频播放器(点击分段跳转对应时间) === */
  17. .video-bar { position:sticky; top:0; z-index:100; background:#000;
  18. border-bottom:1px solid var(--border); }
  19. .video-bar video { width:100%; max-height:56vw; display:block;
  20. object-fit:contain; background:#000; }
  21. @media (min-width:600px){ .video-bar video { max-height:340px; } }
  22. .time-indicator { position:absolute; bottom:8px; right:12px;
  23. background:rgba(0,0,0,.7); color:#fff; padding:2px 8px;
  24. border-radius:4px; font-size:.8rem; }
  25. .main { max-width:960px; margin:0 auto; padding:0 16px; }
  26. .head { text-align:center; margin:24px 0 8px; }
  27. .head h1 { font-size:1.5rem; color:var(--brand-light); }
  28. .head p { color:var(--muted); font-size:.9rem; margin-top:4px; }
  29. .section { margin:32px 0; }
  30. .section > h2 { font-size:1.25rem; font-weight:700; color:var(--brand-light);
  31. padding-bottom:10px; border-bottom:2px solid var(--brand);
  32. margin-bottom:16px; }
  33. .grid3 { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin:12px 0; }
  34. .grid6 { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin:12px 0; }
  35. @media (min-width:600px){ .grid6 { grid-template-columns:repeat(6,1fr); } }
  36. .stat { background:var(--card); border:1px solid var(--border); border-radius:10px;
  37. padding:12px 8px; text-align:center; }
  38. .stat .num { display:block; font-size:1.25rem; font-weight:700; color:var(--brand-light); }
  39. .stat .label { font-size:.75rem; color:var(--muted); }
  40. table { width:100%; border-collapse:collapse; margin:12px 0; font-size:.9rem; }
  41. th, td { padding:10px 12px; text-align:left; border-bottom:1px solid var(--border); }
  42. th { background:var(--surface); color:var(--brand-light); font-weight:600; }
  43. /* === 可折叠分析分段 === */
  44. .seg { background:var(--card); border:1px solid var(--border); border-radius:10px;
  45. margin:12px 0; overflow:hidden; }
  46. .seg-h { display:flex; align-items:center; gap:8px; padding:12px 14px; cursor:pointer;
  47. user-select:none; }
  48. .seg-h:active { background:var(--surface); }
  49. .seg-h .t { color:var(--brand-light); font-weight:600; white-space:nowrap; font-size:.85rem; }
  50. .seg-h .p { flex:1; color:var(--muted); font-size:.85rem; overflow:hidden;
  51. text-overflow:ellipsis; white-space:nowrap; }
  52. .seg-h .a { color:var(--muted); transition:transform .2s; }
  53. .seg.open .seg-h .a { transform:rotate(180deg); }
  54. .seg-b { display:none; padding:4px 14px 14px; }
  55. .seg.open .seg-b { display:block; }
  56. .quote { background:var(--surface); padding:12px; border-radius:8px; margin:8px 0;
  57. border-left:3px solid var(--brand); font-style:italic; font-size:.98rem; }
  58. .frame { width:100%; border-radius:8px; margin:8px 0; border:1px solid var(--border); }
  59. .cap { color:var(--muted); font-size:.8rem; margin:-4px 0 8px; }
  60. .play-btn { background:var(--brand); color:#fff; border:none; padding:6px 14px;
  61. border-radius:6px; cursor:pointer; font-size:.85rem; margin:4px 0 10px; }
  62. .analysis p { margin:8px 0; font-size:.93rem; color:var(--text); }
  63. .analysis .muted { color:var(--muted); }
  64. .tag { display:inline-block; padding:2px 8px; border-radius:4px; font-size:.75rem; margin:2px; }
  65. .tag-blue { background:rgba(59,130,246,.15); color:var(--brand-light); }
  66. .tag-green { background:rgba(16,185,129,.15); color:var(--green); }
  67. .tag-yellow { background:rgba(245,158,11,.15); color:var(--yellow); }
  68. .tag-purple { background:rgba(139,92,246,.15); color:var(--purple); }
  69. .tag-red { background:rgba(239,68,68,.15); color:var(--red); }
  70. code.reuse { display:block; color:var(--brand-light); background:var(--surface);
  71. padding:8px 10px; border-radius:6px; font-size:.85rem; margin-top:6px;
  72. overflow-x:auto; }
  73. .callout { border-left:4px solid var(--brand); background:var(--surface);
  74. padding:12px 14px; border-radius:0 8px 8px 0; margin:12px 0; font-size:.92rem; }
  75. .callout.green { border-color:var(--green); }
  76. /* === 纯CSS条形图 === */
  77. .bar-row { display:flex; align-items:center; gap:8px; margin:6px 0; font-size:.85rem; }
  78. .bar-row .w { width:6.5em; color:var(--muted); text-align:right; flex-shrink:0;
  79. overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  80. .bar-row .track { flex:1; background:var(--surface); border-radius:4px; height:18px; }
  81. .bar-row .fill { height:100%; border-radius:4px; background:var(--brand);
  82. min-width:2px; }
  83. .bar-row .v { width:3.2em; color:var(--muted); font-size:.78rem; flex-shrink:0; }
  84. .comment { background:var(--surface); border-radius:8px; padding:10px 12px; margin:8px 0; }
  85. .comment .u { font-weight:600; font-size:.85rem; color:var(--brand-light); }
  86. .comment .u .lk { color:var(--muted); font-weight:400; margin-left:8px; }
  87. .comment .tx { font-size:.9rem; margin:4px 0; }
  88. .comment .in { font-size:.8rem; color:var(--green); }
  89. .foot { text-align:center; color:var(--muted); font-size:.75rem; margin-top:40px; }
  90. .foot a { color:var(--brand-light); }
  91. </style>
  92. </head>
  93. <body>
  94. <div class="video-bar" id="playerBar">
  95. <video id="mainVideo" controls playsinline preload="metadata">
  96. <source src="video.mp4" type="video/mp4">
  97. </video>
  98. <div class="time-indicator" id="timeDisplay">0:00</div>
  99. </div>
  100. <div class="main">
  101. <div class="head">
  102. <h1>🎬 {{ meta.title }}</h1>
  103. <p>{{ meta.subtitle }}</p>
  104. </div>
  105. <div class="section">
  106. <div class="grid6">
  107. {% for s in stats_cards %}<div class="stat"><span class="num">{{ s.num }}</span><span class="label">{{ s.label }}</span></div>{% endfor %}
  108. </div>
  109. <table>
  110. {% if meta.author %}<tr><td style="width:6em">作者</td><td><strong>{{ meta.author }}</strong>{% if meta.author_signature %} — {{ meta.author_signature }}{% endif %}</td></tr>{% endif %}
  111. {% if meta.tags %}<tr><td>标签</td><td>{% for t in meta.tags %}<span class="tag tag-blue">#{{ t }}</span> {% endfor %}</td></tr>{% endif %}
  112. <tr><td>发布时间</td><td>{{ meta.publish_time or "—" }}</td></tr>
  113. <tr><td>报告信息</td><td>{{ meta.aweme_id or "local" }} · {{ meta.generated_at }} · 平台 {{ meta.platform }} · 分析引擎 {{ meta.llm_engine }}</td></tr>
  114. </table>
  115. </div>
  116. <div class="section">
  117. <h2>📝 逐段拉片({{ segments|length }}段 · 点击展开 · ⏵跳转播放)</h2>
  118. {% for seg in segments %}
  119. <div class="seg{% if loop.first %} open{% endif %}" id="seg{{ loop.index }}">
  120. <div class="seg-h" onclick="toggleSeg(this)">
  121. <span class="t">⏱ {{ seg.t_start }} — {{ seg.t_end }}</span>
  122. <span class="p">{{ seg.preview }}</span>
  123. <span class="a">▼</span>
  124. </div>
  125. <div class="seg-b">
  126. <div class="quote">"{{ seg.text }}"</div>
  127. <button class="play-btn" onclick="seekTo({{ seg.t_start_s }})">⏵ 播放这一段</button>
  128. {% if seg.frame %}
  129. <img class="frame" loading="lazy" src="frames/{{ seg.frame.file }}" alt="f{{ seg.frame.frame }}">
  130. <p class="cap">🖼 抽帧 f{{ seg.frame.frame }} @ {{ seg.frame.t_label }}{% if seg.frame.caption %} — {{ seg.frame.caption }}{% endif %}</p>
  131. {% endif %}
  132. <div class="analysis">
  133. {% if seg.techniques %}<p><strong>🎯 技法:</strong>{% for tc in seg.techniques %}<span class="tag {{ tc.cls }}">{{ tc.label }}</span> {% endfor %}</p>{% endif %}
  134. <p>{{ seg.comment_html }}</p>
  135. {% if seg.reuse %}<p class="muted"><strong>💡 可复用模板:</strong></p><code class="reuse">{{ seg.reuse }}</code>{% endif %}
  136. </div>
  137. </div>
  138. </div>
  139. {% endfor %}
  140. </div>
  141. <div class="section">
  142. <h2>📐 整体结构(起承转合)</h2>
  143. <table>
  144. <tr><th>段</th><th>时间</th><th>功能</th><th>技法</th></tr>
  145. {% for r in structure_rows %}<tr><td>{{ r.stage }}</td><td>{{ r.time }}</td><td>{{ r.func }}</td><td>{{ r.techniques }}</td></tr>{% endfor %}
  146. </table>
  147. {% if summary_html %}<div class="callout"><strong>🎯 核心发现:</strong>{{ summary_html }}</div>{% endif %}
  148. </div>
  149. {% if wordfreq %}
  150. <div class="section">
  151. <h2>📊 词频TOP / 情绪分布</h2>
  152. <div class="grid3">
  153. <div class="stat"><span class="num">{{ meta.word_count }}</span><span class="label">总字数</span></div>
  154. <div class="stat"><span class="num">{{ meta.wpm }}</span><span class="label">语速(字/分)</span></div>
  155. <div class="stat"><span class="num">{{ meta.sentence_count }}</span><span class="label">句数</span></div>
  156. </div>
  157. <h3 style="margin:14px 0 8px;color:var(--text)">高频实词 TOP{{ wordfreq|length }}</h3>
  158. {% for w in wordfreq %}
  159. <div class="bar-row"><span class="w">{{ w.word }}</span><div class="track"><div class="fill" style="width:{{ w.pct }}%;background:var(--brand-light)"></div></div><span class="v">{{ w.count }}</span></div>
  160. {% endfor %}
  161. <h3 style="margin:14px 0 8px;color:var(--text)">情绪分布</h3>
  162. {% for s in sentiment %}
  163. <div class="bar-row"><span class="w">{{ s.label }}</span><div class="track"><div class="fill" style="width:{{ s.pct }}%;background:{{ s.color }}"></div></div><span class="v">{{ s.pct }}%</span></div>
  164. {% endfor %}
  165. </div>
  166. {% endif %}
  167. {% if comments %}
  168. <div class="section">
  169. <h2>💬 评论区VOC分析({{ comment_total }}条)</h2>
  170. <div class="grid3">
  171. {% for s in comment_stats %}<div class="stat"><span class="num" style="color:{{ s.color }}">{{ s.pct }}%</span><span class="label">{{ s.label }}</span></div>{% endfor %}
  172. </div>
  173. <h3 style="margin:14px 0 8px;color:var(--text)">高赞评论 TOP{{ top_comments|length }}</h3>
  174. {% for c in top_comments %}
  175. <div class="comment">
  176. <div class="u">{{ c.nickname }}<span class="lk">👍{{ c.likes }}</span></div>
  177. <div class="tx">{{ c.text }}</div>
  178. {% if c.insight %}<div class="in">💡 {{ c.insight }}</div>{% endif %}
  179. </div>
  180. {% endfor %}
  181. {% if comment_keywords %}
  182. <h3 style="margin:14px 0 8px;color:var(--text)">评论关键词</h3>
  183. {% for w in comment_keywords %}
  184. <div class="bar-row"><span class="w">{{ w.word }}</span><div class="track"><div class="fill" style="width:{{ w.pct }}%;background:var(--green)"></div></div><span class="v">{{ w.count }}</span></div>
  185. {% endfor %}
  186. {% endif %}
  187. </div>
  188. {% endif %}
  189. {% if suggestions %}
  190. <div class="section">
  191. <h2>🛠 可执行建议</h2>
  192. {% for sg in suggestions %}<div class="callout green"><strong>{{ loop.index }}. {{ sg.title }}</strong> — {{ sg.body }}</div>{% endfor %}
  193. </div>
  194. {% endif %}
  195. <p class="foot">由 skill-video-lapian 生成 · 资源全部相对路径, 目录自包含 · 报告ID {{ meta.report_id }}</p>
  196. </div>
  197. <script>
  198. function toggleSeg(h){
  199. var seg = h.parentElement;
  200. seg.classList.toggle('open');
  201. if (seg.classList.contains('open') && window.innerWidth < 600) {
  202. setTimeout(function(){ seg.scrollIntoView({behavior:'smooth', block:'start'}); }, 60);
  203. }
  204. }
  205. function seekTo(sec){
  206. var v = document.getElementById('mainVideo');
  207. if (!v) return;
  208. try { v.currentTime = sec; } catch(e) {}
  209. var p = v.play(); if (p && p.catch) p.catch(function(){});
  210. }
  211. (function(){
  212. var v = document.getElementById('mainVideo'), d = document.getElementById('timeDisplay');
  213. if (v && d) v.addEventListener('timeupdate', function(){
  214. var m = Math.floor(v.currentTime/60), s = Math.floor(v.currentTime%60);
  215. d.textContent = m + ':' + (s<10?'0':'') + s;
  216. });
  217. })();
  218. </script>
  219. </body>
  220. </html>