From beb4e3eedfdb4fecf7e5755608f7c601b13da420 Mon Sep 17 00:00:00 2001 From: the1812 Date: Sun, 10 Nov 2024 15:46:03 +0800 Subject: [PATCH] Add history pages display (#1866) --- .../style/custom-navbar/history/NavbarHistory.vue | 15 +++++++++------ .../style/custom-navbar/history/types.ts | 7 ++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/registry/lib/components/style/custom-navbar/history/NavbarHistory.vue b/registry/lib/components/style/custom-navbar/history/NavbarHistory.vue index 4e25c4ecc..133144769 100644 --- a/registry/lib/components/style/custom-navbar/history/NavbarHistory.vue +++ b/registry/lib/components/style/custom-navbar/history/NavbarHistory.vue @@ -59,7 +59,9 @@ class="progress" :style="{ width: h.progress * 100 + '%' }" > -
{{ h.durationText }}
+
+ {{ h.page }}P / {{ h.pages }}P +
{{ h.title || h.upName + '的直播间' @@ -360,14 +362,18 @@ export default Vue.extend({ &-items { padding: 0 12px; .floating { - @include round-bar(20); + @include round-bar(16); @include h-center(); background-color: #000c; color: white; justify-content: center; position: absolute; - opacity: 0; font-size: 11px; + padding: 2px 4px; + &.pages { + bottom: 4px; + right: 4px; + } } .time-group-item { display: grid; @@ -391,9 +397,6 @@ export default Vue.extend({ .cover { transform: scale(1.05); } - .floating { - opacity: 1; - } } .history-cover-container { $height: 55px; diff --git a/registry/lib/components/style/custom-navbar/history/types.ts b/registry/lib/components/style/custom-navbar/history/types.ts index 0767b42f1..2cb8ff19f 100644 --- a/registry/lib/components/style/custom-navbar/history/types.ts +++ b/registry/lib/components/style/custom-navbar/history/types.ts @@ -36,8 +36,10 @@ export interface HistoryItem { duration: number /** 时长展示文字 */ durationText: string - /** 视频的分P */ + /** 视频的分 P */ page?: number + /** 视频的分 P 数 */ + pages?: number /** 直播状态: 0 未开播 1 直播中 2 轮播中 (似乎新 API 不会返回 2) */ liveStatus?: number /** 视频的tag/直播的分区名 */ @@ -131,6 +133,7 @@ const parseHistoryItem = (item: any): HistoryItem => { bvid, // 视频 bv号 cid, // 专栏 cv号 oid, // 直播 房间号 / 专栏 cv 号 / 课程神秘标识符 + page, } = item.history const progressParam = item.progress > 0 ? `t=${item.progress}` : 't=0' const progress = item.progress === -1 ? 1 : item.progress / item.duration @@ -189,6 +192,8 @@ const parseHistoryItem = (item: any): HistoryItem => { id: bvid, url: `https://www.bilibili.com/video/${bvid}?p=${item.history.page}&${progressParam}`, type: HistoryType.Video, + page, + pages: item.videos, } } if (cid) {