From 71706009008e264259ac9cb09e41abb297b96721 Mon Sep 17 00:00:00 2001 From: the1812 Date: Thu, 15 May 2025 09:38:30 +0800 Subject: [PATCH] Update rank data for freshHome (fix #5211) --- .../layouts/categories/content/Bangumi.vue | 43 +- .../categories/content/CompactRankList.vue | 5 +- .../layouts/categories/content/Default.vue | 52 +- .../layouts/categories/content/RankList.vue | 12 +- .../categories/content/VideoSlides.vue | 2 +- .../layouts/categories/content/rank-list.ts | 45 + src/components/utils/categories/data.ts | 9 + src/components/utils/categories/tid-v2.json | 1840 +++++++++++++++++ 8 files changed, 1938 insertions(+), 70 deletions(-) create mode 100644 src/components/utils/categories/tid-v2.json diff --git a/registry/lib/components/style/home-redesign/fresh/layouts/categories/content/Bangumi.vue b/registry/lib/components/style/home-redesign/fresh/layouts/categories/content/Bangumi.vue index 6cfe14975..df3a662f1 100644 --- a/registry/lib/components/style/home-redesign/fresh/layouts/categories/content/Bangumi.vue +++ b/registry/lib/components/style/home-redesign/fresh/layouts/categories/content/Bangumi.vue @@ -18,7 +18,12 @@ - + @@ -30,20 +35,9 @@ import SubHeader from '../../../SubHeader.vue' import RankList from './RankList.vue' import CompactRankList from './CompactRankList.vue' import BangumiTimeline from './BangumiTimeline.vue' -import { RankListCard } from './rank-list' +import { getBangumiRankListCards, PGCSeasonTypeMap } from './rank-list' import { compactRankListMixin } from '../../../../mixin' -const bangumiDataMap = { - anime: { - seasonType: 1, - rankingName: 'bangumi', - }, - guochuang: { - seasonType: 4, - // 你永远不知道"国创"在 b 站代码里有多少种叫法... - rankingName: 'guochan', - }, -} export default Vue.extend({ components: { SubHeader, @@ -62,34 +56,17 @@ export default Vue.extend({ }, data() { const { route } = this.region.category - const { rankingName, seasonType } = bangumiDataMap[route] + const seasonType = PGCSeasonTypeMap[route] return { - bangumiDataMap, route, timelineApi: `https://api.bilibili.com/pgc/web/timeline?types=${seasonType}&before=6&after=6`, rankingsApi: `https://api.bilibili.com/pgc/season/rank/web/list?day=3&season_type=${seasonType}`, - rankingsLink: `https://www.bilibili.com/v/popular/rank/${rankingName}`, + rankingsLink: `https://www.bilibili.com/v/popular/rank/${route}`, } }, methods: { parseJson(json: any) { - const items = (json.data?.list ?? []) as any[] - const cards = items - .map((item): RankListCard => { - const upName = item.new_ep?.index_show ?? item.title - return { - id: item.season_id, - title: item.title, - playCount: item.stat.view, - points: item.stat.follow, - upHref: item.url, - upName, - dynamic: upName, - coverUrl: item.new_ep?.cover ?? item.ss_horizontal_cover, - videoHref: item.url, - } - }) - .slice(0, 10) + const cards = getBangumiRankListCards(json).slice(0, 10) return applyContentFilter(cards) }, }, diff --git a/registry/lib/components/style/home-redesign/fresh/layouts/categories/content/CompactRankList.vue b/registry/lib/components/style/home-redesign/fresh/layouts/categories/content/CompactRankList.vue index 2e58e1d68..31c017f06 100644 --- a/registry/lib/components/style/home-redesign/fresh/layouts/categories/content/CompactRankList.vue +++ b/registry/lib/components/style/home-redesign/fresh/layouts/categories/content/CompactRankList.vue @@ -39,10 +39,10 @@
- - {{ video.points | formatCount }} {{ video.playCount | formatCount }} + + {{ video.danmakuCount | formatCount }}
@@ -82,6 +82,7 @@ export default Vue.extend({ }, computed: { upInfoProps() { + console.log({ bangumiMode: this.bangumiMode }) return { size: 18, icon: this.bangumiMode ? 'mdi-television-classic' : 'up-outline', diff --git a/registry/lib/components/style/home-redesign/fresh/layouts/categories/content/Default.vue b/registry/lib/components/style/home-redesign/fresh/layouts/categories/content/Default.vue index ee1be552a..0b556d505 100644 --- a/registry/lib/components/style/home-redesign/fresh/layouts/categories/content/Default.vue +++ b/registry/lib/components/style/home-redesign/fresh/layouts/categories/content/Default.vue @@ -22,27 +22,26 @@ - - + +