diff --git a/src/api/types.ts b/src/api/types.ts index 04f96f2c..16ad1cc7 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -78,8 +78,6 @@ export interface Subscribe { filter_groups?: string[] // 下载器 downloader?: string - // 可选剧集组 - episode_groups?: Record[] // 自定义剧集组 episode_group?: string } diff --git a/src/components/cards/MediaCard.vue b/src/components/cards/MediaCard.vue index 58ac5c31..e6aeebd6 100644 --- a/src/components/cards/MediaCard.vue +++ b/src/components/cards/MediaCard.vue @@ -79,6 +79,9 @@ const searchMenuShow = ref(false) // 选择站点对话框 const chooseSiteDialog = ref(false) +// 选择的剧集组 +const episodeGroup = ref('') + // 查询所有站点 async function querySites() { try { @@ -146,6 +149,7 @@ async function addSubscribe(season: number = 0, best_version: number = 0) { mediaid: props.media?.media_id ? `${props.media?.mediaid_prefix}:${props.media?.media_id}` : '', season, best_version, + episode_group: episodeGroup.value, }) // 订阅状态 @@ -288,8 +292,9 @@ function handleSubscribe() { } // 订阅多季 -function subscribeSeasons(seasons: MediaSeason[], seasonNoExists: { [key: number]: number }) { +function subscribeSeasons(seasons: MediaSeason[], seasonNoExists: { [key: number]: number }, groudId: string) { subscribeSeasonDialog.value = false + episodeGroup.value = groudId seasonsSelected.value = seasons || [] seasonsSelected.value.forEach(season => { let best_version = 0 diff --git a/src/components/dialog/SubscribeEditDialog.vue b/src/components/dialog/SubscribeEditDialog.vue index b6d5175f..d5023558 100644 --- a/src/components/dialog/SubscribeEditDialog.vue +++ b/src/components/dialog/SubscribeEditDialog.vue @@ -5,7 +5,6 @@ import api from '@/api' import type { DownloaderConf, FilterRuleGroup, Site, Subscribe, TransferDirectoryConf } from '@/api/types' import { useDisplay } from 'vuetify' import { useConfirm } from 'vuetify-use-dialog' -import { VTextarea, VTextField } from 'vuetify/lib/components/index.mjs' // 显示器宽度 const display = useDisplay() @@ -53,6 +52,7 @@ const subscribeForm = ref({ downloader: '', date: '', show_edit_dialog: false, + episode_group: '', }) // 提示框 @@ -61,8 +61,21 @@ const $toast = useToast() // 下载器选项 const downloaderOptions = ref<{ title: string; value: string }[]>([]) +// 所有剧集组 +const episodeGroups = ref<{ [key: string]: any }[]>([]) + // 剧集组选项 -const episodeGroupOptions = ref<{ title: string; subtitle: string; value: number }[]>([]) +const episodeGroupOptions = computed(() => { + return (episodeGroups.value as { id: number; name: string; group_count: number; episode_count: number }[]).map( + item => { + return { + title: item.name, + subtitle: `${item.group_count} 季 • ${item.episode_count} 集`, + value: item.id, + } + }, + ) +}) // 生成1到100季的下拉框选项 const seasonItems = ref( @@ -80,6 +93,15 @@ function episodeGroupItemProps(item: { title: string; subtitle: string }) { } } +// 查询所有剧集组 +async function getEpisodeGroups() { + try { + episodeGroups.value = await api.get(`media/groups/${subscribeForm.value.tmdbid}`) + } catch (error) { + console.error(error) + } +} + async function loadDownloaderSetting() { try { const downloaders: DownloaderConf[] = await api.get('download/clients') @@ -197,19 +219,8 @@ async function getSubscribeInfo() { subscribeForm.value = result subscribeForm.value.best_version = subscribeForm.value.best_version === 1 subscribeForm.value.search_imdbid = subscribeForm.value.search_imdbid === 1 - - // 从result.episode_groups中获取剧集组 - if (result?.episode_groups) { - episodeGroupOptions.value = (result?.episode_groups as { id: number; name: string; episode_count: number }[]).map( - item => { - return { - title: item.name, - subtitle: `${item.episode_count} 集`, - value: item.id, - } - }, - ) - } + // 加载剧集组 + if (subscribeForm.value.type == '电视剧') getEpisodeGroups() } catch (e) { console.log(e) } diff --git a/src/components/dialog/SubscribeSeasonDialog.vue b/src/components/dialog/SubscribeSeasonDialog.vue index 3b4cb730..09d148ef 100644 --- a/src/components/dialog/SubscribeSeasonDialog.vue +++ b/src/components/dialog/SubscribeSeasonDialog.vue @@ -1,6 +1,5 @@ @@ -141,53 +195,57 @@ onMounted(async () => { + - - - - 第 {{ item.season_number }} 季 - - - {{ item.vote_average }} - - {{ getYear(item.air_date || '') }} • {{ item.episode_count }} 集 - - - 《{{ media?.title }}》第 {{ item.season_number }} 季于 {{ formatAirDate(item.air_date || '') }} 首播。 - - - - {{ getExistText(item.season_number || 0) }} - - - - - - +
+ + + + 第 {{ item.season_number }} 季 + + + {{ item.vote_average }} + + {{ getYear(item.air_date || '') }} • {{ item.episode_count }} 集 + + + 《{{ media?.title }}》第 {{ item.season_number }} 季于 {{ formatAirDate(item.air_date || '') }} 首播。 + + + + {{ getExistText(item.season_number || 0) }} + + + + + +
+