From 67d35f2b75ae8674b149635bb89f2d768e145ea8 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Tue, 7 Feb 2023 01:57:41 +0800 Subject: [PATCH] feat: history page --- src/contentScripts/views/App.vue | 11 +- src/contentScripts/views/History/History.vue | 173 +++++++++++++++++++ src/contentScripts/views/History/types.ts | 29 ++++ src/enums/appEnums.ts | 1 + 4 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 src/contentScripts/views/History/History.vue create mode 100644 src/contentScripts/views/History/types.ts diff --git a/src/contentScripts/views/App.vue b/src/contentScripts/views/App.vue index 545ecaa0..bc7084ee 100644 --- a/src/contentScripts/views/App.vue +++ b/src/contentScripts/views/App.vue @@ -6,6 +6,7 @@ import browser from 'webextension-polyfill' import Home from './Home/Home.vue' import Search from './Search/Search.vue' import Anime from './Anime/Anime.vue' +import History from './History/History.vue' import { activatedPage, isShowTopbar } from '~/logic/storage' import { language } from '~/logic' import '~/styles/index.ts' @@ -15,7 +16,7 @@ const { locale } = useI18n() const [showSettings, toggle] = useToggle(false) const isDark = useDark() const toggleDark = useToggle(isDark) -const pages = { Home, Search, Anime } +const pages = { Home, Search, Anime, History } watch(() => activatedPage.value, (newValue, oldValue) => { window.scrollTo({ top: 0, behavior: 'smooth' }) @@ -91,6 +92,14 @@ function changeActivatePage(pageName: AppPage) { + +
diff --git a/src/contentScripts/views/History/History.vue b/src/contentScripts/views/History/History.vue new file mode 100644 index 00000000..0de7771f --- /dev/null +++ b/src/contentScripts/views/History/History.vue @@ -0,0 +1,173 @@ + + + diff --git a/src/contentScripts/views/History/types.ts b/src/contentScripts/views/History/types.ts new file mode 100644 index 00000000..3dc4e09d --- /dev/null +++ b/src/contentScripts/views/History/types.ts @@ -0,0 +1,29 @@ +// https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/history&toview/history.md#%E8%8E%B7%E5%8F%96%E5%8E%86%E5%8F%B2%E8%AE%B0%E5%BD%95%E5%88%97%E8%A1%A8_web%E7%AB%AF +export enum HistoryType { + Archive = 'archive', // archive:稿件 + PGC = 'pgc', // pgc:剧集 (番剧 / 影视) + Live = 'live', // live:直播 + ArticleList = 'article-list', // article-list:文集 + Article = 'article', // article:文章 +} + +export interface HistoryItem { + title: string + cover: string + covers?: Array + history: { + business: HistoryType + epid?: number + bvid?: string + part?: string + oid: number + } + author_name: string + author_face: string + author_mid: string + view_at: number + progress: number + duration: number + kid: number + live_status: 0 | 1 // 0:未开播 1:已开播 +} diff --git a/src/enums/appEnums.ts b/src/enums/appEnums.ts index 84bab70d..9bf8a9c4 100644 --- a/src/enums/appEnums.ts +++ b/src/enums/appEnums.ts @@ -9,4 +9,5 @@ export enum AppPage { Home = 'Home', Search = 'Search', Anime = 'Anime', + History = 'History', }