This commit is contained in:
jxxghp
2023-08-04 19:54:52 +08:00
parent 7beb046d7b
commit 9d2b3a4382
2 changed files with 10 additions and 8 deletions

View File

@@ -72,19 +72,19 @@ async function handleAddSubscribe() {
await getMediaSeasons()
if (!seasonInfos.value) {
$toast.error(`${props.media?.title} 查询剧集信息失败!`)
return
}
// 检查各季的缺失状态
await checkSeasonsNotExists()
if (!tmdbFlag.value)
return
if (seasonInfos.value.length === 1) {
// 添加订阅
addSubscribe(1)
}
else {
// 检查各季的缺失状态
await checkSeasonsNotExists()
if (!tmdbFlag.value)
return
// 弹出季选择列表,支持多选
subscribeSeasonDialog.value = true
}

View File

@@ -49,6 +49,7 @@ async function getMediaDetail() {
isRefreshed.value = true
if (!mediaDetail.value.tmdb_id)
return
// 检查存在状态
if (mediaDetail.value.type === '电影')
checkMovieExists()
@@ -132,7 +133,8 @@ async function checkSeasonsNotExists() {
state = 2
else if (item.episodes.length < item.total_episodes)
state = 1
if (state !== 2)
isExists.value = true
seasonsNotExisted.value[item.season] = state
})
}
@@ -175,9 +177,9 @@ async function addSubscribe(season = 0) {
try {
// 是否洗版
let best_version = isExists.value ? 1 : 0
if (mediaDetail.value?.type === '电视剧' && mediaDetail.value?.tmdb_id)
if (season)
// 全部存在时洗版
best_version = (!seasonsNotExisted.value[season] || seasonsNotExisted.value[season] === 0) ? 1 : 0
best_version = !seasonsNotExisted.value[season] ? 1 : 0
// 请求API
const result: { [key: string]: any } = await api.post('subscribe', {
name: mediaDetail.value?.title,