mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-06 16:16:42 +08:00
fix: 完善几处S00订阅相关的问题
This commit is contained in:
@@ -138,7 +138,7 @@ async function handleAddSubscribe() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用API添加订阅,电视剧的话需要指定季
|
// 调用API添加订阅,电视剧的话需要指定季
|
||||||
async function addSubscribe(season: number | null = 0, best_version: number = 0) {
|
async function addSubscribe(season: number | null = null, best_version: number = 0) {
|
||||||
// 开始处理
|
// 开始处理
|
||||||
startNProgress()
|
startNProgress()
|
||||||
try {
|
try {
|
||||||
@@ -184,7 +184,7 @@ async function addSubscribe(season: number | null = 0, best_version: number = 0)
|
|||||||
|
|
||||||
// 弹出添加订阅提示
|
// 弹出添加订阅提示
|
||||||
function showSubscribeAddToast(result: boolean, title: string, season: number | null, message: string, best_version: number) {
|
function showSubscribeAddToast(result: boolean, title: string, season: number | null, message: string, best_version: number) {
|
||||||
if (season) title = `${title} ${formatSeason(season.toString())}`
|
if (season !== null) title = `${title} ${formatSeason(season.toString())}`
|
||||||
|
|
||||||
let subname = t('subscribe.normalSub')
|
let subname = t('subscribe.normalSub')
|
||||||
if (best_version > 0) subname = t('subscribe.versionSub')
|
if (best_version > 0) subname = t('subscribe.versionSub')
|
||||||
@@ -222,7 +222,7 @@ async function removeSubscribe() {
|
|||||||
// 查询当前媒体是否已订阅
|
// 查询当前媒体是否已订阅
|
||||||
async function handleCheckSubscribe() {
|
async function handleCheckSubscribe() {
|
||||||
try {
|
try {
|
||||||
const result = await checkSubscribe(props.media?.season)
|
const result = await checkSubscribe(props.media?.season ?? null)
|
||||||
if (result) isSubscribed.value = true
|
if (result) isSubscribed.value = true
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
@@ -249,7 +249,7 @@ async function handleCheckExists() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用API检查是否已订阅,电视剧需要指定季
|
// 调用API检查是否已订阅,电视剧需要指定季
|
||||||
async function checkSubscribe(season = 0) {
|
async function checkSubscribe(season: number | null) {
|
||||||
try {
|
try {
|
||||||
// AbortController 现在由全局请求优化器自动管理
|
// AbortController 现在由全局请求优化器自动管理
|
||||||
const mediaid = getMediaId()
|
const mediaid = getMediaId()
|
||||||
@@ -300,7 +300,7 @@ function subscribeSeasons(seasons: MediaSeason[], seasonNoExists: { [key: number
|
|||||||
if (season && props.media?.tmdb_id)
|
if (season && props.media?.tmdb_id)
|
||||||
// 全部存在时洗版
|
// 全部存在时洗版
|
||||||
best_version = !seasonNoExists[season.season_number || 0] ? 1 : 0
|
best_version = !seasonNoExists[season.season_number || 0] ? 1 : 0
|
||||||
addSubscribe(season.season_number, best_version)
|
addSubscribe(season.season_number ?? null, best_version)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ async function checkExists() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查询当前媒体是否已订阅
|
// 查询当前媒体是否已订阅
|
||||||
async function checkSubscribe(season = 0) {
|
async function checkSubscribe(season: number | null = null) {
|
||||||
try {
|
try {
|
||||||
const mediaid = getMediaId()
|
const mediaid = getMediaId()
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ async function checkSeasonsSubscribed() {
|
|||||||
if (mediaDetail.value.type !== '电视剧') return
|
if (mediaDetail.value.type !== '电视剧') return
|
||||||
try {
|
try {
|
||||||
mediaDetail.value?.season_info?.forEach(async item => {
|
mediaDetail.value?.season_info?.forEach(async item => {
|
||||||
seasonsSubscribed.value[item.season_number ?? 0] = await checkSubscribe(item.season_number)
|
seasonsSubscribed.value[item.season_number ?? 0] = await checkSubscribe(item.season_number ?? null)
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
@@ -257,13 +257,13 @@ async function checkSeasonsSubscribed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用API添加订阅,电视剧的话需要指定季
|
// 调用API添加订阅,电视剧的话需要指定季
|
||||||
async function addSubscribe(season: number | null = 0) {
|
async function addSubscribe(season: number | null) {
|
||||||
// 开始处理
|
// 开始处理
|
||||||
startNProgress()
|
startNProgress()
|
||||||
try {
|
try {
|
||||||
// 是否洗版
|
// 是否洗版
|
||||||
let best_version = existsItemId.value ? 1 : 0
|
let best_version = existsItemId.value ? 1 : 0
|
||||||
if (season)
|
if (season !== null)
|
||||||
// 全部存在时洗版
|
// 全部存在时洗版
|
||||||
best_version = !seasonsNotExisted.value[season] ? 1 : 0
|
best_version = !seasonsNotExisted.value[season] ? 1 : 0
|
||||||
// 请求API
|
// 请求API
|
||||||
@@ -282,7 +282,7 @@ async function addSubscribe(season: number | null = 0) {
|
|||||||
if (result.success) {
|
if (result.success) {
|
||||||
// 订阅成功
|
// 订阅成功
|
||||||
isSubscribed.value = true
|
isSubscribed.value = true
|
||||||
if (season) seasonsSubscribed.value[season] = true
|
if (season !== null) seasonsSubscribed.value[season] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提示
|
// 提示
|
||||||
@@ -304,7 +304,7 @@ async function addSubscribe(season: number | null = 0) {
|
|||||||
|
|
||||||
// 弹出添加订阅提示
|
// 弹出添加订阅提示
|
||||||
function showSubscribeAddToast(result: boolean, title: string, season: number | null, message: string, best_version: number) {
|
function showSubscribeAddToast(result: boolean, title: string, season: number | null, message: string, best_version: number) {
|
||||||
if (season) title = `${title} ${formatSeason(season.toString())}`
|
if (season !== null) title = `${title} ${formatSeason(season.toString())}`
|
||||||
|
|
||||||
let subname = t('media.subscribe.normal')
|
let subname = t('media.subscribe.normal')
|
||||||
if (best_version > 0) subname = t('media.subscribe.bestVersion')
|
if (best_version > 0) subname = t('media.subscribe.bestVersion')
|
||||||
@@ -313,7 +313,7 @@ function showSubscribeAddToast(result: boolean, title: string, season: number |
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用API取消订阅
|
// 调用API取消订阅
|
||||||
async function removeSubscribe(season: number) {
|
async function removeSubscribe(season: number | null) {
|
||||||
// 开始处理
|
// 开始处理
|
||||||
startNProgress()
|
startNProgress()
|
||||||
try {
|
try {
|
||||||
@@ -327,7 +327,7 @@ async function removeSubscribe(season: number) {
|
|||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
isSubscribed.value = false
|
isSubscribed.value = false
|
||||||
if (season) seasonsSubscribed.value[season] = false
|
if (season !== null) seasonsSubscribed.value[season] = false
|
||||||
$toast.success(`${mediaDetail.value?.title} ${t('media.subscribe.canceled')}`)
|
$toast.success(`${mediaDetail.value?.title} ${t('media.subscribe.canceled')}`)
|
||||||
} else {
|
} else {
|
||||||
$toast.error(`${mediaDetail.value?.title} ${t('media.subscribe.cancelFailed', { reason: result.message })}`)
|
$toast.error(`${mediaDetail.value?.title} ${t('media.subscribe.cancelFailed', { reason: result.message })}`)
|
||||||
@@ -339,7 +339,7 @@ async function removeSubscribe(season: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 订阅按钮响应
|
// 订阅按钮响应
|
||||||
function handleSubscribe(season = 0) {
|
function handleSubscribe(season: number | null = null) {
|
||||||
if (isSubscribed.value) removeSubscribe(season)
|
if (isSubscribed.value) removeSubscribe(season)
|
||||||
else addSubscribe(season)
|
else addSubscribe(season)
|
||||||
}
|
}
|
||||||
@@ -647,7 +647,7 @@ onBeforeMount(() => {
|
|||||||
class="ms-2 mb-2"
|
class="ms-2 mb-2"
|
||||||
:color="getSubscribeColor"
|
:color="getSubscribeColor"
|
||||||
variant="tonal"
|
variant="tonal"
|
||||||
@click="handleSubscribe(0)"
|
@click="handleSubscribe()"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<VIcon :icon="getSubscribeIcon" />
|
<VIcon :icon="getSubscribeIcon" />
|
||||||
@@ -761,7 +761,7 @@ onBeforeMount(() => {
|
|||||||
class="ms-1"
|
class="ms-1"
|
||||||
:color="seasonsSubscribed[season.season_number || 0] ? 'error' : 'warning'"
|
:color="seasonsSubscribed[season.season_number || 0] ? 'error' : 'warning'"
|
||||||
variant="text"
|
variant="text"
|
||||||
@click.stop="handleSubscribe(season.season_number)"
|
@click.stop="handleSubscribe(season.season_number ?? null)"
|
||||||
>
|
>
|
||||||
<VIcon
|
<VIcon
|
||||||
:icon="seasonsSubscribed[season.season_number || 0] ? 'mdi-heart' : 'mdi-heart-outline'"
|
:icon="seasonsSubscribed[season.season_number || 0] ? 'mdi-heart' : 'mdi-heart-outline'"
|
||||||
|
|||||||
Reference in New Issue
Block a user