diff --git a/src/api/types.ts b/src/api/types.ts index 4e4ddcda..5192a0af 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -186,7 +186,7 @@ export interface TransferHistory { export interface MediaInfo { // 来源:themoviedb、douban、bangumi source?: string - // 类型 电影、电视剧 + // 类型 电影、电视剧、合集 type?: string // 媒体标题 title?: string @@ -206,6 +206,8 @@ export interface MediaInfo { douban_id?: string // Bangumi ID bangumi_id?: string + // 合集ID + collection_id?: number // 媒体原语种 original_language?: string // 媒体原发行标题 diff --git a/src/components/cards/MediaCard.vue b/src/components/cards/MediaCard.vue index 649b703b..91bc0318 100644 --- a/src/components/cards/MediaCard.vue +++ b/src/components/cards/MediaCard.vue @@ -59,11 +59,11 @@ const seasonInfos = ref([]) // 选中的订阅季 const seasonsSelected = ref([]) -let abortController: AbortController | null = null; +let abortController: AbortController | null = null -abortController = new AbortController(); -registerAbortController(abortController); -const { signal } = abortController; +abortController = new AbortController() +registerAbortController(abortController) +const { signal } = abortController // 来源角标字典 const sourceIconDict: { [key: string]: any } = { themoviedb: tmdbImage, @@ -219,7 +219,6 @@ async function removeSubscribe() { // 查询当前媒体是否已订阅 async function handleCheckSubscribe() { try { - const result = await checkSubscribe(props.media?.season) if (result) isSubscribed.value = true } catch (error) { @@ -230,7 +229,6 @@ async function handleCheckSubscribe() { // 查询当前媒体是否已入库 async function handleCheckExists() { try { - const result: { [key: string]: any } = await api.get('mediaserver/exists', { params: { tmdbid: props.media?.tmdb_id, @@ -239,7 +237,7 @@ async function handleCheckExists() { season: props.media?.season, mtype: props.media?.type, }, - signal + signal, }) if (result.success) isExists.value = true @@ -251,7 +249,6 @@ async function handleCheckExists() { // 调用API检查是否已订阅,电视剧需要指定季 async function checkSubscribe(season = 0) { try { - const mediaid = getMediaId() const result: Subscribe = await api.get(`subscribe/media/${mediaid}`, { @@ -259,7 +256,7 @@ async function checkSubscribe(season = 0) { season, title: props.media?.title, }, - signal + signal, }) return result.id || null @@ -351,13 +348,24 @@ function getExistText(season: number) { // 打开详情页 function goMediaDetail(isHovering = false) { if (isHovering) { - router.push({ - path: '/media', - query: { - mediaid: getMediaId(), - type: props.media?.type, - }, - }) + if (props.media?.collection_id) { + // 跳转到合集列表 + router.push({ + path: `/browse/tmdb/collection/${props.media?.collection_id}`, + query: { + title: props.media?.title, + }, + }) + } else { + // 跳转到媒体详情页 + router.push({ + path: '/media', + query: { + mediaid: getMediaId(), + type: props.media?.type, + }, + }) + } } } @@ -376,6 +384,9 @@ function handleSearch() { // 懒加载检查 function handleCheckLazy() { + if (props.media?.collection_id) { + return + } handleCheckSubscribe() handleCheckExists() } @@ -453,13 +464,25 @@ function onRemoveSubscribe() {