This commit is contained in:
jxxghp
2023-09-21 21:24:10 +08:00
parent d936b68597
commit 298ae2c354
2 changed files with 56 additions and 54 deletions
+53 -47
View File
@@ -360,14 +360,6 @@ onBeforeMount(() => {
handleCheckExists() handleCheckExists()
}) })
// 订阅季表头
const seasonsHeaders = [
{ title: '季', key: 'title', sortable: false },
{ title: '集数', key: 'episodes', sortable: false },
{ title: '评分', key: 'vote', sortable: false },
{ title: '状态', key: 'status', sortable: false },
]
// 计算图片地址 // 计算图片地址
const getImgUrl: Ref<string> = computed(() => { const getImgUrl: Ref<string> = computed(() => {
if (imageLoadError.value) if (imageLoadError.value)
@@ -379,6 +371,13 @@ const getImgUrl: Ref<string> = computed(() => {
return url return url
}) })
// 拼装季图片地址
function getSeasonPoster(posterPath: string) {
if (!posterPath)
return ''
return `https://image.tmdb.org/t/p/w500${posterPath}`
}
</script> </script>
<template> <template>
@@ -468,54 +467,61 @@ const getImgUrl: Ref<string> = computed(() => {
> >
<VCard title="选择订阅季"> <VCard title="选择订阅季">
<DialogCloseBtn @click="subscribeSeasonDialog = false" /> <DialogCloseBtn @click="subscribeSeasonDialog = false" />
<VCardText style="padding: 0;"> <VCardText class="p-0">
<VDataTable <VList
v-model="seasonsSelected" v-model="seasonsSelected"
:headers="seasonsHeaders" multiple
:items="seasonInfos" lines="three"
item-value="season_number"
return-object
fixed-header
show-select
:items-per-page="100"
height="auto"
> >
<template #item.title="{ item }"> <VListItem v-for="(item, i) in seasonInfos" :key="i">
<span class="d-block whitespace-nowrap text-high-emphasis"> {{ item.raw.season_number }} <template #prepend>
</span> <VImg
</template> height="80"
<template #item.episodes="{ item }"> width="60"
<VChip :src="getSeasonPoster(item.poster_path || '')"
variant="outlined" aspect-ratio="2/3"
> class="object-cover rounded shadow ring-gray-500 me-3"
{{ item.raw.episode_count }} cover
</VChip> >
</template> <template #placeholder>
<template #item.vote="{ item }"> <div class="w-full h-full">
{{ item.raw.vote_average }} <VSkeletonLoader class="object-cover aspect-w-2 aspect-h-3" />
</template> </div>
<template #item.status="{ item }"> </template>
<VChip </VImg>
v-if="seasonsNotExisted" </template>
:color="getExistColor(item.raw.season_number)" <VListItemTitle>
> {{ item.season_number }}
{{ getExistText(item.raw.season_number) }} </VListItemTitle>
</VChip> <VListItemSubtitle class="mt-1">
</template> 评分{{ item.vote_average }}上映日期{{ item.air_date }}
<template #no-data> </VListItemSubtitle>
没有数据 <VListItemSubtitle v-html="item.overview" />
</template> <VListItemSubtitle>
<template #bottom /> <VChip
</VDataTable> v-if="seasonsNotExisted"
class="mt-2"
size="small"
:color="getExistColor(item.season_number || 0)"
>
{{ getExistText(item.season_number || 0) }}
</VChip>
</VListItemSubtitle>
<template #append>
<VListItemAction start>
<VSwitch v-model="seasonsSelected" :value="item.season_number" />
</VListItemAction>
</template>
</VListItem>
</VList>
</VCardText> </VCardText>
<div class="my-2 text-center"> <div class="my-2 text-center">
<VBtn <VBtn
:disabled="seasonsSelected.length === 0" :disabled="seasonsSelected.length === 0"
width="30%" width="30%"
@click="subscribeSeasons" @click="subscribeSeasons"
@keydown.enter="subscribeSeasons"
> >
提交订阅 {{ seasonsSelected.length === 0 ? '请选择订阅季' : '提交订阅' }}
</VBtn> </VBtn>
</div> </div>
</VCard> </VCard>
+3 -7
View File
@@ -75,15 +75,12 @@ async function searchMedias() {
class="mx-auto" class="mx-auto"
width="100%" width="100%"
> >
<VToolbar flat dense> <VToolbar flat class="p-0">
<VTextField <VTextField
v-model="keyword" v-model="keyword"
density="compact"
label="输入名称搜索" label="输入名称搜索"
single-line
hide-details
flat
class="mx-3" class="mx-3"
variant="underlined"
append-inner-icon="mdi-magnify" append-inner-icon="mdi-magnify"
:loading="loading" :loading="loading"
@click:append-inner="searchMedias" @click:append-inner="searchMedias"
@@ -97,7 +94,6 @@ async function searchMedias() {
> >
<template v-for="(item, i) in items" :key="i"> <template v-for="(item, i) in items" :key="i">
<VListItem <VListItem
density="compact"
@click="selectMedia(item)" @click="selectMedia(item)"
> >
<template #prepend> <template #prepend>
@@ -119,7 +115,7 @@ async function searchMedias() {
<VListItemTitle> <VListItemTitle>
{{ item.title }} {{ item.title }}
</VListItemTitle> </VListItemTitle>
<VListItemSubtitle v-html="item.overview" /> <VListItemSubtitle class="mt-2" v-html="item.overview" />
</VListItem> </VListItem>
<VDivider v-if="i < items.length - 1" class="mt-1" inset /> <VDivider v-if="i < items.length - 1" class="mt-1" inset />
</template> </template>