fix: hide episode sort for movie subscriptions

This commit is contained in:
jxxghp
2026-05-25 11:40:06 +08:00
parent 6da0aae362
commit ff3b5b4232
2 changed files with 35 additions and 8 deletions

View File

@@ -91,15 +91,28 @@ const filterOptions = computed(() => {
})
// 排序选项
const sortOptions = computed<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') },
{ value: 'lack_episode', label: t('subscribe.sort.lackEpisode') },
])
const sortOptions = computed<Array<{ value: SubscribeSortBy; label: string }>>(() => {
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>(() => subscribeSortBy.value || 'date')
const currentSortBy = computed<SubscribeSortBy>(() => {
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

View File

@@ -79,8 +79,18 @@ const selectedSubscribes = ref<number[]>([])
const normalizedKeyword = computed(() => props.keyword?.trim().toLowerCase() || '')
const selectedSubscribesSet = computed(() => new Set(selectedSubscribes.value))
const hasCustomOrder = computed(() => orderConfig.value.length > 0)
// 归一化订阅排序方式,电影订阅不使用缺失集数排序。
const normalizedSortBy = computed<SubscribeSortBy | ''>(() => {
const sortBy = props.sortBy as SubscribeSortBy | ''
if (props.type === '电影' && sortBy === 'lack_episode') {
return 'date'
}
return sortBy
})
const effectiveSortBy = computed<SubscribeSortBy>(() => {
return (props.sortBy as SubscribeSortBy) || (hasCustomOrder.value ? 'custom' : 'date')
return normalizedSortBy.value || (hasCustomOrder.value ? 'custom' : 'date')
})
const canSortContext = computed(
() =>