From df9d53bbe10d49e5805234e849f6652edf0f0dcc Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sun, 3 Dec 2023 17:36:13 +0800 Subject: [PATCH] feat: SubscribedSeries page --- src/background/messageListeners/moment.ts | 2 +- src/components/VideoCard/VideoCard.vue | 22 +- src/contentScripts/views/Home/Home.vue | 8 +- .../{Pgc.vue => SubscribedSeries.vue} | 42 +- src/contentScripts/views/Home/types.ts | 2 +- src/models/moment/momentResult.ts | 452 ++++++++++++++++++ 6 files changed, 497 insertions(+), 31 deletions(-) rename src/contentScripts/views/Home/components/{Pgc.vue => SubscribedSeries.vue} (66%) create mode 100644 src/models/moment/momentResult.ts diff --git a/src/background/messageListeners/moment.ts b/src/background/messageListeners/moment.ts index fff09a9f..7a9f13a8 100644 --- a/src/background/messageListeners/moment.ts +++ b/src/background/messageListeners/moment.ts @@ -53,7 +53,7 @@ function handleMessage(message: any) { .catch(error => console.error(error)) } - // https://github.com/SocialSisterYi/bilibili-API-collect/blob/17b7cb85cef19d7f2e94f8d896e68413f6217e26/docs/dynamic/all.md#%E8%8E%B7%E5%8F%96%E5%8A%A8%E6%80%81%E5%88%97%E8%A1%A8 + // https://socialsisteryi.github.io/bilibili-API-collect/docs/dynamic/all.html#%E8%8E%B7%E5%8F%96%E5%8A%A8%E6%80%81%E5%88%97%E8%A1%A8 else if (message.contentScriptQuery === 'getMoments') { const url = `https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/all?timezone_offset=-480&type=${message.type}&offset=${message.offset}&update_baseline=${message.updateBaseline}` return fetch(url) diff --git a/src/components/VideoCard/VideoCard.vue b/src/components/VideoCard/VideoCard.vue index 1d4f23b1..3734a11a 100644 --- a/src/components/VideoCard/VideoCard.vue +++ b/src/components/VideoCard/VideoCard.vue @@ -2,7 +2,7 @@ import { getCSRF, removeHttpFromUrl } from '~/utils/main' import { calcCurrentTime, calcTimeSince, numFormatter } from '~/utils/dataFormatter' -const props = defineProps<{ +interface Props { id: number duration?: number durationStr?: string @@ -20,14 +20,27 @@ const props = defineProps<{ capsuleText?: string bvid?: string aid?: number + epid?: number isFollowed?: boolean horizontal?: boolean tag?: string rank?: number -}>() + topRightContent?: boolean +} + +const props = withDefaults(defineProps(), + { + topRightContent: true, + }, +) const videoUrl = computed(() => { - return `https://www.bilibili.com/video/${props.bvid ?? `av${props.aid}`}` + if (props.bvid || props.aid) + return `https://www.bilibili.com/video/${props.bvid ?? `av${props.aid}`}` + else if (props.epid) + return `https://www.bilibili.com/bangumi/play/ep${props.epid}` + else + return '' }) const isDislike = ref(false) @@ -197,6 +210,7 @@ function handelMouseLeave() {