feat: add play all button to FavoritesPop & WatchLaterPop

This commit is contained in:
hakadao
2024-04-08 01:00:27 +08:00
parent 0657512991
commit dd75b9d038
2 changed files with 41 additions and 13 deletions

View File

@@ -17,12 +17,16 @@ const isLoading = ref<boolean>(false)
const noMoreContent = ref<boolean>(false)
const favoriteVideosWrap = ref<HTMLElement>() as Ref<HTMLElement>
const favoritesPageUrl = computed(() => {
const viewAllUrl = computed((): string => {
return `//space.bilibili.com/${getUserID()}/favlist?fid=${
activatedMediaId.value
}`
})
const playAllUrl = computed((): string => {
return `https://www.bilibili.com/list/ml${activatedMediaId.value}`
})
watch(activatedMediaId, (newVal: number, oldVal: number) => {
if (newVal === oldVal)
return
@@ -148,12 +152,20 @@ defineExpose({
{{ activatedFavoriteTitle }}
</h3>
<a
:href="favoritesPageUrl" :target="isHomePage() ? '_blank' : '_self'" rel="noopener noreferrer"
flex="~" items="center"
>
<span text="sm">{{ $t('common.view_all') }}</span>
</a>
<div flex="~ gap-4">
<a
:href="playAllUrl" :target="isHomePage() ? '_blank' : '_self'" rel="noopener noreferrer"
flex="~" items="center"
>
<span text="sm">{{ $t('common.play_all') }}</span>
</a>
<a
:href="viewAllUrl" :target="isHomePage() ? '_blank' : '_self'" rel="noopener noreferrer"
flex="~" items="center"
>
<span text="sm">{{ $t('common.view_all') }}</span>
</a>
</div>
</header>
<main flex="~" overflow-hidden rounded="$bew-radius">

View File

@@ -7,6 +7,13 @@ import { isHomePage, removeHttpFromUrl } from '~/utils/main'
const watchLaterList = reactive<VideoItem[]>([])
const isLoading = ref<boolean>()
const viewAllUrl = computed((): string => {
return 'https://www.bilibili.com/watchlater/#/list'
})
const playAllUrl = computed((): string => {
return 'https://www.bilibili.com/list/watchlater'
})
onMounted(() => {
getAllWatchLaterList()
})
@@ -65,12 +72,21 @@ function getAllWatchLaterList() {
{{ $t('topbar.watch_later') }}
</div>
</div>
<a
href="https://www.bilibili.com/watchlater/#/list" :target="isHomePage() ? '_blank' : '_self'" rel="noopener noreferrer"
flex="~ items-center"
>
<span text="sm">{{ $t('common.view_all') }}</span>
</a>
<div flex="~ gap-4">
<a
:href="playAllUrl" :target="isHomePage() ? '_blank' : '_self'" rel="noopener noreferrer"
flex="~" items="center"
>
<span text="sm">{{ $t('common.play_all') }}</span>
</a>
<a
:href="viewAllUrl" :target="isHomePage() ? '_blank' : '_self'" rel="noopener noreferrer"
flex="~" items="center"
>
<span text="sm">{{ $t('common.view_all') }}</span>
</a>
</div>
</header>
<!-- watchLater wrapper -->