From fe72a1619ef9ee35184a1b58d3f79798db212d02 Mon Sep 17 00:00:00 2001 From: mackt <1033530438@qq.com> Date: Sat, 2 Nov 2024 21:40:28 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E8=BD=AE=E6=92=AD=E5=9B=BE=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E3=80=81=E5=A4=A7=E5=B0=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../music/[category]/[[...page]]/page.tsx | 4 +-- src/app/(website)/vol/[journalId]/page.tsx | 27 ++++++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/app/(website)/music/[category]/[[...page]]/page.tsx b/src/app/(website)/music/[category]/[[...page]]/page.tsx index 69edabc..18383c2 100644 --- a/src/app/(website)/music/[category]/[[...page]]/page.tsx +++ b/src/app/(website)/music/[category]/[[...page]]/page.tsx @@ -140,11 +140,11 @@ export default async function Journal({ params }: { params: { category?: string; {/* 热门推荐 */} -
+
{!!recommendList?.length && } {!!carouselList?.length && ( - + )}
diff --git a/src/app/(website)/vol/[journalId]/page.tsx b/src/app/(website)/vol/[journalId]/page.tsx index 6128c37..cec2a00 100644 --- a/src/app/(website)/vol/[journalId]/page.tsx +++ b/src/app/(website)/vol/[journalId]/page.tsx @@ -2,8 +2,21 @@ import Link from 'next/link'; import { notFound, redirect, RedirectType } from 'next/navigation'; -import { SongCardList, JournalRecommendList, Comment, CollectButton, VolDetailCoverCard } from '@/components'; -import { apiGetJournalInfoById, apiGetSongsByJournalNo, apiGetJournalRecommendById, apiGetTags } from '@/services'; +import { + SongCardList, + JournalRecommendList, + Comment, + CollectButton, + VolDetailCoverCard, + HomeCarousel, +} from '@/components'; +import { + apiGetJournalInfoById, + apiGetSongsByJournalNo, + apiGetJournalRecommendById, + apiGetTags, + apiCarousel, +} from '@/services'; export async function generateMetadata({ params: { journalId } }: { params: { journalId: string } }) { const res = await apiGetJournalInfoById({ id: journalId }); @@ -12,11 +25,12 @@ export async function generateMetadata({ params: { journalId } }: { params: { jo } const getData = async (journalId: string) => { - const [journalInfoRes, songListRes, recommendList, tagList] = await Promise.all([ + const [journalInfoRes, songListRes, recommendList, tagList, carouselList] = await Promise.all([ apiGetJournalInfoById({ id: journalId }), apiGetSongsByJournalNo({ id: journalId }), apiGetJournalRecommendById({ id: journalId, limit: 8 }), apiGetTags(), + apiCarousel(), ]); if (!(journalInfoRes.code === 200 && songListRes.code === 200)) return notFound(); return { @@ -24,6 +38,7 @@ const getData = async (journalId: string) => { songList: songListRes.data, recommendList: recommendList.data, tagList: tagList.data, + carouselList: carouselList.data?.filter((item: Carousel) => item.outerLink), }; }; @@ -34,7 +49,7 @@ export default async function JournalDetail({ params: { journalId: string }; searchParams: { mobile: string }; }) { - const { journalInfo, songList, recommendList, tagList } = await getData(journalId); + const { journalInfo, songList, recommendList, tagList, carouselList } = await getData(journalId); if (mobile) { redirect(`${process.env.NEXT_PUBLIC_MOBILE_HOST}/journal.html?id=${journalInfo.id}`, RedirectType.replace); @@ -118,6 +133,10 @@ export default async function JournalDetail({
{/* 热门推荐 */} {!!recommendList?.length ? :
} + + {!!carouselList?.length && ( + + )}
);