refactor: optimize video & upper rank page

This commit is contained in:
kairee committed 2026-11-01 23:18:39 +08:00
1 parent cb547e3ced
commit 1b76fdeda1
4 files changed
+132 -125

No files matched your search

+9 -8
View File
@@ -81,7 +81,7 @@ function controls({ scope, sort, within, year, growthDays, q, years }) {
<input class="search-input" type="search" name="q" value="${escapeAttr(q || "")}"
placeholder="${scope === "up" ? "搜索 UP 名" : "搜索标题或 UP"}" autocomplete="off">
<button class="search-button" type="submit" aria-label="搜索" title="搜索">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"
stroke-linecap="round" aria-hidden="true">
<circle cx="11" cy="11" r="7"></circle><path d="m20 20-3.2-3.2"></path>
</svg>
@@ -100,10 +100,10 @@ function controls({ scope, sort, within, year, growthDays, q, years }) {
function videoPrimary(item, sort) {
if (sort === "efficiency") {
return { primary: "efficiency_score", label: "播放/小时·收缩", text: formatCount(item.efficiency_score) };
return { primary: "efficiency_score", label: "播放/小时", text: formatCount(item.efficiency_score) };
}
if (sort === "interaction_efficiency") {
return { primary: "interaction_efficiency_score", label: "互动/小时·收缩", text: formatCount(item.interaction_efficiency_score) };
return { primary: "interaction_efficiency_score", label: "互动/小时", text: formatCount(item.interaction_efficiency_score) };
}
if (sort === "interaction") {
return { primary: "view", label: "互动率", text: formatPercent(item.interaction_rate) };
@@ -143,9 +143,11 @@ function upSecondary(item, sort) {
function listHtml(data, scope, sort, startRank) {
if (!data.items.length) {
const unavailable = data.available === false;
const hint = "换个筛选条件或清空搜索关键词试试。";
return emptyState(
data.available === false ? "当前榜单暂不可用" : (scope === "up" ? "没有匹配的 UP" : "没有匹配的视频"),
data.reason || "换个筛选条件或清空搜索关键词试试。",
unavailable ? "当前榜单暂不可用" : (scope === "up" ? "没有匹配的 UP" : "没有匹配的视频"),
unavailable ? hint : (data.reason || hint),
);
}
if (scope === "up") {
@@ -172,10 +174,9 @@ function durationNote(data) {
const filter = data.duration_filter;
if (!filter) return "";
const shrink = filter.shrink_minutes
? `并按 ${filter.shrink_minutes} 分钟的先验暴露量向全库均值收缩`
? `,按 ${filter.shrink_minutes} 分钟先验向全库均值收缩`
: "";
return `<div class="section-note">内容效率与互动效率仅统计时长 ≥ ${filter.min_duration_seconds} 秒、
发布满 ${filter.maturity_days} 天、播放 ≥ ${filter.min_view} 的视频${shrink};时长缺失的视频不参与排序。</div>`;
return `<div class="section-note">内容效率与互动效率:时长 ≥ ${filter.min_duration_seconds} 秒、发布满 ${filter.maturity_days} 天、播放 ≥ ${filter.min_view}${shrink};时长缺失不参与。</div>`;
}
function bindControls(root) {