From 23ba74dd865c1049fba59bd4fda6a53884c2d33f Mon Sep 17 00:00:00 2001 From: mtvpls Date: Sun, 14 Dec 2025 20:15:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=95=E7=A4=BA=E6=9B=B4=E5=A4=9A=E8=B1=86?= =?UTF-8?q?=E7=93=A3=E8=AF=A6=E6=83=85=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/play/page.tsx | 63 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 5 deletions(-) diff --git a/src/app/play/page.tsx b/src/app/play/page.tsx index 9787c2b..f673ae3 100644 --- a/src/app/play/page.tsx +++ b/src/app/play/page.tsx @@ -339,6 +339,10 @@ function PlayPageClient() { count: number; star_count: number; } | null>(null); + // 豆瓣额外信息 + const [doubanCardSubtitle, setDoubanCardSubtitle] = useState(''); + const [doubanAka, setDoubanAka] = useState([]); + const [doubanYear, setDoubanYear] = useState(''); // 从 pubdate 提取的年份 // 当前源和ID const [currentSource, setCurrentSource] = useState( searchParams.get('source') || '' @@ -443,11 +447,16 @@ function PlayPageClient() { const fetchDoubanRating = async () => { if (!videoDoubanId || videoDoubanId === 0) { setDoubanRating(null); + setDoubanCardSubtitle(''); + setDoubanAka([]); + setDoubanYear(''); return; } try { const doubanData = await getDoubanDetail(videoDoubanId.toString()); + + // 设置评分 if (doubanData.rating) { setDoubanRating({ value: doubanData.rating.value, @@ -457,9 +466,32 @@ function PlayPageClient() { } else { setDoubanRating(null); } + + // 设置 card_subtitle + if (doubanData.card_subtitle) { + setDoubanCardSubtitle(doubanData.card_subtitle); + } + + // 设置 aka(别名) + if (doubanData.aka && doubanData.aka.length > 0) { + setDoubanAka(doubanData.aka); + } + + // 处理 pubdate 获取年份 + if (doubanData.pubdate && doubanData.pubdate.length > 0) { + const pubdateStr = doubanData.pubdate[0]; + // 删除括号中的内容,包括括号 + const yearMatch = pubdateStr.replace(/\([^)]*\)/g, '').trim(); + if (yearMatch) { + setDoubanYear(yearMatch); + } + } } catch (error) { console.error('获取豆瓣评分失败:', error); setDoubanRating(null); + setDoubanCardSubtitle(''); + setDoubanAka([]); + setDoubanYear(''); } }; @@ -4077,7 +4109,21 @@ function PlayPageClient() {
{/* 标题 */}

- {videoTitle || '影片标题'} + 0 ? 'relative group cursor-help' : ''}> + {videoTitle || '影片标题'} + {/* aka 悬浮提示 */} + {doubanAka.length > 0 && ( +
+
又名:
+ {doubanAka.map((name, index) => ( +
+ {name} +
+ ))} +
+
+ )} +

{/* 剧情简介 */} - {detail?.desc && ( + {(doubanCardSubtitle || detail?.desc) && (
- {detail.desc} + {/* card_subtitle 在前,desc 在后 */} + {doubanCardSubtitle && ( +
+ {doubanCardSubtitle} +
+ )} + {detail?.desc}
)}