fixed80: 相关推荐10部(豆瓣) + 中间件白名单
Docker Build & Test / build (push) Canceled after 0s
Docker Build & Test / test (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/amd64) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm/v7) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm64) (push) Canceled after 0s
Build & Push Docker image / merge-images (push) Canceled after 0s
Docker Build & Test / build (push) Canceled after 0s
Docker Build & Test / test (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/amd64) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm/v7) (push) Canceled after 0s
Build & Push Docker image / build-and-push (linux/arm64) (push) Canceled after 0s
Build & Push Docker image / merge-images (push) Canceled after 0s
This commit is contained in:
1 parent
574fa99fb4
commit
7a99890425
3 files changed
+78
-1
No files matched your search
@@ -24,6 +24,7 @@ export default function VideoMetaExtra({
|
||||
doubanId,
|
||||
area,
|
||||
lang,
|
||||
isTv,
|
||||
}: {
|
||||
title: string;
|
||||
actor?: string;
|
||||
@@ -34,10 +35,12 @@ export default function VideoMetaExtra({
|
||||
doubanId?: number;
|
||||
area?: string;
|
||||
lang?: string;
|
||||
isTv?: boolean;
|
||||
}) {
|
||||
const [comments, setComments] = useState<DoubanComment[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [dbDetail, setDbDetail] = useState<any>(null);
|
||||
const [related, setRelated] = useState<any[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!doubanId) return;
|
||||
@@ -59,6 +62,13 @@ export default function VideoMetaExtra({
|
||||
if (alive && d?.code === 1) setDbDetail(d);
|
||||
})
|
||||
.catch(() => {});
|
||||
// 相关推荐
|
||||
fetch(`/api/douban-related?id=${encodeURIComponent(String(doubanId))}&type=${isTv ? 'tv' : 'movie'}`)
|
||||
.then((r) => r.json())
|
||||
.then((d) => {
|
||||
if (alive && d?.code === 1) setRelated(d.list || []);
|
||||
})
|
||||
.catch(() => {});
|
||||
return () => {
|
||||
alive = false;
|
||||
};
|
||||
@@ -185,6 +195,34 @@ export default function VideoMetaExtra({
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
{related.length > 0 && (
|
||||
<div className='mt-4'>
|
||||
<div className='text-sm font-semibold mb-2 opacity-80'>相关推荐</div>
|
||||
<div className='grid grid-cols-5 gap-3'>
|
||||
{related.map((r: any) => (
|
||||
<a
|
||||
key={r.id}
|
||||
href={r.url}
|
||||
target='_blank'
|
||||
rel='noreferrer'
|
||||
className='group block'
|
||||
>
|
||||
{r.poster ? (
|
||||
<img
|
||||
src={r.poster}
|
||||
alt={r.title}
|
||||
className='w-full aspect-[2/3] object-cover rounded-md mb-1'
|
||||
/>
|
||||
) : null}
|
||||
<div className='text-xs truncate group-hover:text-blue-500'>{r.title}</div>
|
||||
{r.rating > 0 && (
|
||||
<div className='text-xs text-amber-500'>{r.rating.toFixed(1)}</div>
|
||||
)}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user