From e4af05cd561695b9f1fbcef01985664a5715176a Mon Sep 17 00:00:00 2001 From: jxxghp Date: Thu, 16 Jan 2025 17:52:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AA=92=E4=BD=93=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E4=B8=AD=E7=9A=84=E5=90=88=E9=9B=86=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=92=8CID=EF=BC=8C=E4=BC=98=E5=8C=96=E5=AA=92=E4=BD=93?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E7=9A=84=E8=B7=B3=E8=BD=AC=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=90=9C=E7=B4=A2=E7=B3=BB=E5=88=97?= =?UTF-8?q?=E5=90=88=E9=9B=86=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/types.ts | 4 +- src/components/cards/MediaCard.vue | 122 ++++++++++++++++++++--------- src/views/system/SearchBarView.vue | 18 +++++ 3 files changed, 108 insertions(+), 36 deletions(-) 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() {