From ff3b5b42327b57eb72e865410b5e93cd3f7bfa18 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 25 May 2026 11:40:06 +0800 Subject: [PATCH] fix: hide episode sort for movie subscriptions --- src/pages/subscribe.vue | 31 ++++++++++++++++++----- src/views/subscribe/SubscribeListView.vue | 12 ++++++++- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/pages/subscribe.vue b/src/pages/subscribe.vue index 338fc612..f27b1eee 100644 --- a/src/pages/subscribe.vue +++ b/src/pages/subscribe.vue @@ -91,15 +91,28 @@ const filterOptions = computed(() => { }) // 排序选项 -const sortOptions = computed>(() => [ - { value: 'custom', label: t('subscribe.sort.custom') }, - { value: 'last_update', label: t('subscribe.sort.lastUpdate') }, - { value: 'date', label: t('subscribe.sort.addTime') }, - { value: 'lack_episode', label: t('subscribe.sort.lackEpisode') }, -]) +const sortOptions = computed>(() => { + const options: Array<{ value: SubscribeSortBy; label: string }> = [ + { value: 'custom', label: t('subscribe.sort.custom') }, + { value: 'last_update', label: t('subscribe.sort.lastUpdate') }, + { value: 'date', label: t('subscribe.sort.addTime') }, + ] + + if (subType !== '电影') { + options.push({ value: 'lack_episode', label: t('subscribe.sort.lackEpisode') }) + } + + return options +}) // 当前选中的排序选项 -const currentSortBy = computed(() => subscribeSortBy.value || 'date') +const currentSortBy = computed(() => { + if (subscribeSortBy.value && sortOptions.value.some(option => option.value === subscribeSortBy.value)) { + return subscribeSortBy.value + } + + return 'date' +}) // 当前选中的筛选选项 const currentFilter = computed(() => { @@ -122,6 +135,10 @@ function selectFilter(value: string) { // 选择订阅排序选项,非自定义排序会退出拖拽排序模式。 function selectSubscribeSort(value: SubscribeSortBy) { + if (!sortOptions.value.some(option => option.value === value)) { + return + } + subscribeSortBy.value = value if (value !== 'custom') { subscribeSortMode.value = false diff --git a/src/views/subscribe/SubscribeListView.vue b/src/views/subscribe/SubscribeListView.vue index 0ba11a27..1c1ab48d 100644 --- a/src/views/subscribe/SubscribeListView.vue +++ b/src/views/subscribe/SubscribeListView.vue @@ -79,8 +79,18 @@ const selectedSubscribes = ref([]) const normalizedKeyword = computed(() => props.keyword?.trim().toLowerCase() || '') const selectedSubscribesSet = computed(() => new Set(selectedSubscribes.value)) const hasCustomOrder = computed(() => orderConfig.value.length > 0) + +// 归一化订阅排序方式,电影订阅不使用缺失集数排序。 +const normalizedSortBy = computed(() => { + const sortBy = props.sortBy as SubscribeSortBy | '' + if (props.type === '电影' && sortBy === 'lack_episode') { + return 'date' + } + + return sortBy +}) const effectiveSortBy = computed(() => { - return (props.sortBy as SubscribeSortBy) || (hasCustomOrder.value ? 'custom' : 'date') + return normalizedSortBy.value || (hasCustomOrder.value ? 'custom' : 'date') }) const canSortContext = computed( () =>