Add history pages display (#1866)

This commit is contained in:
the1812 2024-11-10 15:46:03 +08:00
parent b2ed78d5f2
commit beb4e3eedf
2 changed files with 15 additions and 7 deletions

View File

@ -59,7 +59,9 @@
class="progress"
:style="{ width: h.progress * 100 + '%' }"
></div>
<div v-if="h.durationText" class="floating duration">{{ h.durationText }}</div>
<div v-if="h.pages !== undefined && h.pages > 1" class="floating pages">
{{ h.page }}P / {{ h.pages }}P
</div>
</a>
<a class="title" target="_blank" :href="h.url" :title="h.title">{{
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;

View File

@ -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) {