|
|
|
@ -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({
|
|
|
|
|
<div className="w-[346px]">
|
|
|
|
|
{/* 热门推荐 */}
|
|
|
|
|
{!!recommendList?.length ? <JournalRecommendList list={recommendList} /> : <div />}
|
|
|
|
|
|
|
|
|
|
{!!carouselList?.length && (
|
|
|
|
|
<HomeCarousel className="mt-30px w-290px h-102px rounded-3px overflow-hidden" list={carouselList} />
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</main>
|
|
|
|
|
);
|
|
|
|
|