feat(matrix): 悬停里的每条视频显示自己的赞/评/藏/转
Deploy VitePress site to Pages / build (push) Canceled after 0s
Deploy VitePress site to Pages / Deploy (push) Canceled after 0s

一格合并了多条时,并集只能说明「这天整体怎么样」,哪条是爆款要看每条自己的
数字。后端在 details 里带上各自的最近一轮指标,提示里缩进显示在该条标题下面。
This commit is contained in:
2026-10-25 07:49:09 +08:00
parent 6513e5d4e8
commit 809692a957
3 changed files with 57 additions and 11 deletions
+12 -3
View File
@@ -1549,8 +1549,11 @@ async def daily_tag_matrix(
"cells": {"2026-10-21": {"<hash>": {
"count": 2, "tags": ["大字报", "养号"],
"likes": 120, "comments": 8, "collected": 30, "shares": 4,
"details": [{"title": "…", "tags": ["大字报"]},
{"title": "…", "tags": ["养号"]}], # 按发布时间正序
"details": [{"title": "…", "tags": ["大字报"],
"likes": 80, "comments": 5, "collected": 20, "shares": 4},
{"title": "…", "tags": ["养号"],
"likes": 40, "comments": 3, "collected": 10, "shares": 0}],
# 按发布时间正序
}}}}
``likes/comments/collected/shares`` 是当天这些作品**最近一轮**指标的和;
@@ -1727,17 +1730,23 @@ async def daily_tag_matrix(
},
)
bucket["count"] += 1
metric = latest_metric.get((row.task_id, row.note_id))
# 逐条明细带**各自的**指标。一格合并了多条时,并集只说明「这天整体怎么样」,
# 哪条是爆款要看每条自己的数字 —— 悬停提示里直接看得到。
bucket["details"].append(
{
"title": row.title or row.note_id,
"tags": list(tags_by_note.get(row.note_id, [])),
"likes": metric.liked_count if metric is not None else None,
"comments": metric.comment_count if metric is not None else None,
"collected": metric.collected_count if metric is not None else None,
"shares": metric.share_count if metric is not None else None,
}
)
for tag in tags_by_note.get(row.note_id, []):
if tag not in bucket["tags"]:
bucket["tags"].append(tag)
metric = latest_metric.get((row.task_id, row.note_id))
if metric is not None:
for column, key in (
("liked_count", "likes"),
+26 -4
View File
@@ -236,9 +236,16 @@
border-top: 1px solid var(--line);
white-space: normal;
}
#tip .tip-notes div { line-height: 1.55; }
#tip .tip-note { margin-bottom: 4px; line-height: 1.55; }
#tip .tip-note-title { color: var(--text); }
#tip .tip-note-tags { color: var(--pink); margin-left: 6px; }
/* 每条作品自己的指标。缩进到标题文字下面,一眼对得上是哪条。 */
#tip .tip-note-meta {
padding-left: 14px;
color: var(--muted);
font-variant-numeric: tabular-nums;
}
#tip .tip-note-metrics { margin-right: 8px; }
#tip .tip-note-tags { color: var(--pink); }
#tip .tip-note-more { color: var(--muted); }
</style>
</head>
@@ -415,15 +422,30 @@
for (let index = 0; index < Math.min(details.length, limit); index += 1) {
const item = details[index];
const row = document.createElement('div');
const title = document.createElement('span');
row.className = 'tip-note';
const title = document.createElement('div');
title.className = 'tip-note-title';
title.textContent = index + 1 + '. ' + item.title;
row.appendChild(title);
const meta = document.createElement('div');
meta.className = 'tip-note-meta';
const metrics = document.createElement('span');
metrics.className = 'tip-note-metrics';
metrics.textContent =
'赞 ' + compact(item.likes) +
' · 评 ' + compact(item.comments) +
' · 藏 ' + compact(item.collected) +
' · 转 ' + compact(item.shares);
meta.appendChild(metrics);
const noteTags = document.createElement('span');
noteTags.className = 'tip-note-tags';
noteTags.textContent =
item.tags && item.tags.length ? item.tags.join(' / ') : '无标签';
row.appendChild(noteTags);
meta.appendChild(noteTags);
row.appendChild(meta);
list.appendChild(row);
}
if (details.length > limit) {