feat(web): split video and up rankings and add about page
This commit is contained in:
1 parent
5a656d42a8
commit
c0b0286395
9 files changed
+298
-98
No files matched your search
@@ -9,7 +9,8 @@ import {
|
||||
import { replaceQuery } from "../router.js";
|
||||
|
||||
const SORTS = [
|
||||
["view", "播放"], ["latest", "最新发布"], ["interaction", "互动率"],
|
||||
["view", "播放"], ["efficiency", "内容效率"], ["latest", "最新发布"],
|
||||
["interaction", "互动率"],
|
||||
];
|
||||
|
||||
function sortedVideos(videos, sort) {
|
||||
@@ -18,6 +19,8 @@ function sortedVideos(videos, sort) {
|
||||
items.sort((a, b) => b.pubdate - a.pubdate);
|
||||
} else if (sort === "interaction") {
|
||||
items.sort((a, b) => (b.interaction_rate || 0) - (a.interaction_rate || 0));
|
||||
} else if (sort === "efficiency") {
|
||||
items.sort((a, b) => (b.efficiency || 0) - (a.efficiency || 0));
|
||||
} else {
|
||||
items.sort((a, b) => (b.metrics?.view || 0) - (a.metrics?.view || 0));
|
||||
}
|
||||
@@ -35,7 +38,7 @@ export async function renderUp(root, { params, query }) {
|
||||
|
||||
root.innerHTML = `<section class="page up-page">
|
||||
<header class="page-head">
|
||||
<a class="back-link" href="/rank?scope=up&sort=avg_views">← 返回 UP 榜</a>
|
||||
<a class="back-link" href="/ups">← 返回 UP 榜</a>
|
||||
<a class="button ghost" href="${escapeAttr(up.space_url)}" target="_blank" rel="noreferrer">B 站空间</a>
|
||||
</header>
|
||||
|
||||
@@ -53,10 +56,14 @@ export async function renderUp(root, { params, query }) {
|
||||
|
||||
<div class="mini-stats up-stats">
|
||||
<div><span>视频数</span><strong>${formatCount(up.video_count)}</strong></div>
|
||||
<div><span>总时长</span><strong>${up.content_hours == null ? "—" : `${formatCount(up.content_hours)} 小时`}</strong></div>
|
||||
<div><span>播放/小时</span><strong>${formatCount(up.views_per_hour)}</strong></div>
|
||||
<div><span>总播放</span><strong>${formatCount(up.total_views)}</strong></div>
|
||||
<div><span>平均播放</span><strong>${formatCount(up.avg_views)}</strong></div>
|
||||
<div><span>总互动</span><strong>${formatCount(up.total_interactions)}</strong></div>
|
||||
<div><span>平均互动率</span><strong>${formatPercent(up.avg_interaction)}</strong></div>
|
||||
<div><span>粉丝(入库时)</span><strong>${formatCount(up.up_follower)}</strong></div>
|
||||
<div><span>当前粉丝</span><strong>${formatCount(up.follower_latest)}</strong></div>
|
||||
</div>
|
||||
|
||||
<section class="panel chart-panel">
|
||||
|
||||
Reference in new issue
Block a user