From d3d3236a9bd79f05fb9b3eb8d0d522c268681213 Mon Sep 17 00:00:00 2001 From: fadeaway Date: Sat, 25 May 2024 21:19:24 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=AE=98=E7=BD=91=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{ => (website)}/about/about.module.css | 58 ++--- src/app/{ => (website)}/about/page.tsx | 246 +++++++++--------- .../download/components/DownloadCard.tsx | 0 .../download/components/index.module.css | 0 src/app/{ => (website)}/download/page.tsx | 2 +- src/app/{ => (website)}/favicon.ico | Bin src/app/{ => (website)}/globals.css | 112 ++++---- src/app/{ => (website)}/layout.tsx | 0 src/app/{ => (website)}/loading.tsx | 14 +- .../music/[category]/[[...page]]/page.tsx | 202 +++++++------- .../my/collect/index.module.css | 0 src/app/{ => (website)}/my/collect/layout.tsx | 90 +++---- .../{ => (website)}/my/collect/song/page.tsx | 0 .../{ => (website)}/my/collect/vol/page.tsx | 0 .../{ => (website)}/vol/[journalId]/page.tsx | 210 +++++++-------- 15 files changed, 467 insertions(+), 467 deletions(-) rename src/app/{ => (website)}/about/about.module.css (95%) rename src/app/{ => (website)}/about/page.tsx (97%) rename src/app/{ => (website)}/download/components/DownloadCard.tsx (100%) rename src/app/{ => (website)}/download/components/index.module.css (100%) rename src/app/{ => (website)}/download/page.tsx (97%) rename src/app/{ => (website)}/favicon.ico (100%) rename src/app/{ => (website)}/globals.css (93%) rename src/app/{ => (website)}/layout.tsx (100%) rename src/app/{ => (website)}/loading.tsx (96%) rename src/app/{ => (website)}/music/[category]/[[...page]]/page.tsx (97%) rename src/app/{ => (website)}/my/collect/index.module.css (100%) rename src/app/{ => (website)}/my/collect/layout.tsx (96%) rename src/app/{ => (website)}/my/collect/song/page.tsx (100%) rename src/app/{ => (website)}/my/collect/vol/page.tsx (100%) rename src/app/{ => (website)}/vol/[journalId]/page.tsx (97%) diff --git a/src/app/about/about.module.css b/src/app/(website)/about/about.module.css similarity index 95% rename from src/app/about/about.module.css rename to src/app/(website)/about/about.module.css index f91ee27..70b2775 100644 --- a/src/app/about/about.module.css +++ b/src/app/(website)/about/about.module.css @@ -1,29 +1,29 @@ -.halo { - position: absolute; - top: 160px; - left: 240px; - width: 560px; - height: 280px; - margin-left: 30px; - background: linear-gradient(135.88deg, rgba(255, 240, 240, 0.0126) 31.88%, rgba(255, 53, 53, 0.06) 75.38%); - filter: blur(50px); - transform: matrix(1, -0.09, -0.02, 1, 0, 0); -} - -.weibo { - position: relative; - color: #000; - font-size: 20px; - line-height: 28px; -} - -.weibo::after { - content: ''; - display: block; - left: 83px; - bottom: -2px; - position: absolute; - width: 24px; - height: 24px; - background: url('/img/icon/arrow-right.svg'); -} +.halo { + position: absolute; + top: 160px; + left: 240px; + width: 560px; + height: 280px; + margin-left: 30px; + background: linear-gradient(135.88deg, rgba(255, 240, 240, 0.0126) 31.88%, rgba(255, 53, 53, 0.06) 75.38%); + filter: blur(50px); + transform: matrix(1, -0.09, -0.02, 1, 0, 0); +} + +.weibo { + position: relative; + color: #000; + font-size: 20px; + line-height: 28px; +} + +.weibo::after { + content: ''; + display: block; + left: 83px; + bottom: -2px; + position: absolute; + width: 24px; + height: 24px; + background: url('/img/icon/arrow-right.svg'); +} diff --git a/src/app/about/page.tsx b/src/app/(website)/about/page.tsx similarity index 97% rename from src/app/about/page.tsx rename to src/app/(website)/about/page.tsx index e42e62b..fe54db1 100644 --- a/src/app/about/page.tsx +++ b/src/app/(website)/about/page.tsx @@ -1,123 +1,123 @@ -import Image from 'next/image'; - -import styles from './about.module.css'; - -import { ContributorCard } from '@/components'; -import { apiThanks } from '@/services'; - -import type { Metadata } from 'next'; - -export const metadata: Metadata = { - title: '关于我们', -}; -export interface ContributorCardType { - id: string; - nickName: string; - avatar: string; - contributorRole: string; -} - -async function getContributorList() { - const result = await apiThanks(); - if (result.code === 200) return result.data; -} - -export default async function About() { - const contributorList = await getContributorList(); - - return ( -
-
- {/* about */} -
-

关于雀乐

-

原「落网APP」

-

- 雀乐是由一群喜欢并热爱独立音乐的人共同创建的,我们致力于传播来自世界各地的独立音乐。我们秉着音乐里独立自主的精神表达内核,希望把雀乐建设成为泛华语地区最好的独立音乐传播平台。 -

-
- 2003年03月 落网音乐网站诞生。 -
- 2008年07月 由于数据库出错,所有数据丢失,一切从零开始。 -
2010年10月 推出落网的下属站点巴士电台。 -
2013年11月 落网网站改版上线,并推出音乐App,涵盖Android、iOS、Windows Phone三大平台。 -
2014年01月 落网用户规模超过100万。 -
2017年09月 推出emo情绪音乐App。 -
2017年12月 落网用户规模超过670万。 -
- 2018年01月 因经营问题,落网关闭。 -
- 2023年09月 发布重启计划。 -
- 2024年03月 落网改名为雀乐,并发布内测版本App,一周内用户超过万人。 -
…… -
-
- - {/* contributor */} -
-

贡献者

- -
- - 贡献者 - -
-

- 无论是过去的“落网”还是现在的“雀乐”,到现在为止已经走过了二十多个年头。这一路走来充满着艰辛和不易,但是无论再多的苦难,我们终究还是坚持了下来。当然,止步不前的坚持是毫无意义的,我们想去创造更好的未来。我们想让更多真诚的音乐能够让更多的人接触到、想让更多的独立音乐人能够通过自己的创作获得应有的报酬和尊重、想让雀乐成为国内最好的独立音乐传播平台。 -

-
-

- 值得庆幸的是,虽然外面的世界多变且让人充满着畏惧。但是人更多的时候是充满着善意的。 -
- - 以下的这些朋友们在我们最困难的时候用自己力所能及的方式支持着我们达成一个个目标,是他们无私的奉献,才有着“雀乐”一步步拓实的脚印以面对这复杂的世界、才有着上面的想法能够逐步实现。 - -

-
-

- 如果你也想加入我们,无论是提供技术、资金或是其他任何方式的支持,都可以加微信号  - indier -  联系到我们。
- 感谢音乐,感谢遇见,感谢所有的贡献者。还有感谢那些途中参与过,给予我们帮助的人们。所有的奉献都值得被铭记。 -

-
- -

- 雀乐团队

-
- -
- {!!contributorList?.length && - contributorList.map((contributor) => )} -
- - {/* contributor wall */} -
- - {/* 联系我们 */} -
-

联系我们

- -
-

商务合作

- - rock@indie.cn - -
- -
-

Weibo

- - 官方微博 - -
- -
- wechat qrCode -

雀乐公众号

-
-
-
-
- ); -} +import Image from 'next/image'; + +import styles from './about.module.css'; + +import { ContributorCard } from '@/components'; +import { apiThanks } from '@/services'; + +import type { Metadata } from 'next'; + +export const metadata: Metadata = { + title: '关于我们', +}; +export interface ContributorCardType { + id: string; + nickName: string; + avatar: string; + contributorRole: string; +} + +async function getContributorList() { + const result = await apiThanks(); + if (result.code === 200) return result.data; +} + +export default async function About() { + const contributorList = await getContributorList(); + + return ( +
+
+ {/* about */} +
+

关于雀乐

+

原「落网APP」

+

+ 雀乐是由一群喜欢并热爱独立音乐的人共同创建的,我们致力于传播来自世界各地的独立音乐。我们秉着音乐里独立自主的精神表达内核,希望把雀乐建设成为泛华语地区最好的独立音乐传播平台。 +

+
+ 2003年03月 落网音乐网站诞生。 +
+ 2008年07月 由于数据库出错,所有数据丢失,一切从零开始。 +
2010年10月 推出落网的下属站点巴士电台。 +
2013年11月 落网网站改版上线,并推出音乐App,涵盖Android、iOS、Windows Phone三大平台。 +
2014年01月 落网用户规模超过100万。 +
2017年09月 推出emo情绪音乐App。 +
2017年12月 落网用户规模超过670万。 +
+ 2018年01月 因经营问题,落网关闭。 +
+ 2023年09月 发布重启计划。 +
+ 2024年03月 落网改名为雀乐,并发布内测版本App,一周内用户超过万人。 +
…… +
+
+ + {/* contributor */} +
+

贡献者

+ +
+ + 贡献者 + +
+

+ 无论是过去的“落网”还是现在的“雀乐”,到现在为止已经走过了二十多个年头。这一路走来充满着艰辛和不易,但是无论再多的苦难,我们终究还是坚持了下来。当然,止步不前的坚持是毫无意义的,我们想去创造更好的未来。我们想让更多真诚的音乐能够让更多的人接触到、想让更多的独立音乐人能够通过自己的创作获得应有的报酬和尊重、想让雀乐成为国内最好的独立音乐传播平台。 +

+
+

+ 值得庆幸的是,虽然外面的世界多变且让人充满着畏惧。但是人更多的时候是充满着善意的。 +
+ + 以下的这些朋友们在我们最困难的时候用自己力所能及的方式支持着我们达成一个个目标,是他们无私的奉献,才有着“雀乐”一步步拓实的脚印以面对这复杂的世界、才有着上面的想法能够逐步实现。 + +

+
+

+ 如果你也想加入我们,无论是提供技术、资金或是其他任何方式的支持,都可以加微信号  + indier +  联系到我们。
+ 感谢音乐,感谢遇见,感谢所有的贡献者。还有感谢那些途中参与过,给予我们帮助的人们。所有的奉献都值得被铭记。 +

+
+ +

- 雀乐团队

+
+ +
+ {!!contributorList?.length && + contributorList.map((contributor) => )} +
+ + {/* contributor wall */} +
+ + {/* 联系我们 */} +
+

联系我们

+ +
+

商务合作

+ + rock@indie.cn + +
+ +
+

Weibo

+ + 官方微博 + +
+ +
+ wechat qrCode +

雀乐公众号

+
+
+
+
+ ); +} diff --git a/src/app/download/components/DownloadCard.tsx b/src/app/(website)/download/components/DownloadCard.tsx similarity index 100% rename from src/app/download/components/DownloadCard.tsx rename to src/app/(website)/download/components/DownloadCard.tsx diff --git a/src/app/download/components/index.module.css b/src/app/(website)/download/components/index.module.css similarity index 100% rename from src/app/download/components/index.module.css rename to src/app/(website)/download/components/index.module.css diff --git a/src/app/download/page.tsx b/src/app/(website)/download/page.tsx similarity index 97% rename from src/app/download/page.tsx rename to src/app/(website)/download/page.tsx index 07c9cfb..4a1f265 100644 --- a/src/app/download/page.tsx +++ b/src/app/(website)/download/page.tsx @@ -1,6 +1,6 @@ import Image from 'next/image'; -import DownloadCard from '@/app/download/components/DownloadCard'; +import DownloadCard from '@/app/(website)/download/components/DownloadCard'; import type { Metadata } from 'next'; diff --git a/src/app/favicon.ico b/src/app/(website)/favicon.ico similarity index 100% rename from src/app/favicon.ico rename to src/app/(website)/favicon.ico diff --git a/src/app/globals.css b/src/app/(website)/globals.css similarity index 93% rename from src/app/globals.css rename to src/app/(website)/globals.css index df9090d..9c39728 100644 --- a/src/app/globals.css +++ b/src/app/(website)/globals.css @@ -1,56 +1,56 @@ -@import '@unocss/reset/tailwind.css'; -@unocss all; -@font-face { - font-family: 'D-DINExp'; - src: url('/fonts/D-DINExp.otf') format('opentype'); -} - -:root { - --body-bg-color: #fff; - --primary-color: #c43737; -} - -@media (prefers-color-scheme: dark) { - :root { - } -} - -html, -body { - min-height: 100%; -} - -body { - background: var(--body-bg-color); - font-family: - 'D-DINExp', - -apple-system, - BlinkMacSystemFont, - 'PingFang SC', - 'Helvetica Neue', - STHeiti, - 'Microsoft Yahei', - Tahoma, - Simsun, - sans-serif; - /* padding-bottom: constant(safe-area-inset-bottom); - padding-bottom: env(safe-area-inset-bottom); */ -} - -input { - outline: none; -} - -input::placeholder { - color: [rgba(0, 0, 0, 0.7)]; -} - -textarea { - outline: none; -} - -@layer utilities { - .text-balance { - text-wrap: balance; - } -} +@import '@unocss/reset/tailwind.css'; +@unocss all; +@font-face { + font-family: 'D-DINExp'; + src: url('/fonts/D-DINExp.otf') format('opentype'); +} + +:root { + --body-bg-color: #fff; + --primary-color: #c43737; +} + +@media (prefers-color-scheme: dark) { + :root { + } +} + +html, +body { + min-height: 100%; +} + +body { + background: var(--body-bg-color); + font-family: + 'D-DINExp', + -apple-system, + BlinkMacSystemFont, + 'PingFang SC', + 'Helvetica Neue', + STHeiti, + 'Microsoft Yahei', + Tahoma, + Simsun, + sans-serif; + /* padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); */ +} + +input { + outline: none; +} + +input::placeholder { + color: [rgba(0, 0, 0, 0.7)]; +} + +textarea { + outline: none; +} + +@layer utilities { + .text-balance { + text-wrap: balance; + } +} diff --git a/src/app/layout.tsx b/src/app/(website)/layout.tsx similarity index 100% rename from src/app/layout.tsx rename to src/app/(website)/layout.tsx diff --git a/src/app/loading.tsx b/src/app/(website)/loading.tsx similarity index 96% rename from src/app/loading.tsx rename to src/app/(website)/loading.tsx index d6f5fa9..bd8a251 100644 --- a/src/app/loading.tsx +++ b/src/app/(website)/loading.tsx @@ -1,7 +1,7 @@ -export default function Loading() { - return ( -
-
正在加载……
-
- ); -} +export default function Loading() { + return ( +
+
正在加载……
+
+ ); +} diff --git a/src/app/music/[category]/[[...page]]/page.tsx b/src/app/(website)/music/[category]/[[...page]]/page.tsx similarity index 97% rename from src/app/music/[category]/[[...page]]/page.tsx rename to src/app/(website)/music/[category]/[[...page]]/page.tsx index 7991958..d232236 100644 --- a/src/app/music/[category]/[[...page]]/page.tsx +++ b/src/app/(website)/music/[category]/[[...page]]/page.tsx @@ -1,101 +1,101 @@ -/** 期刊列表 */ -import { notFound } from 'next/navigation'; - -import { Category, JournalRecommendList, JournalItem, Pagination, RedirectCheck, ButtonFM } from '@/components'; -import { apiSearchCategoryList, apiGetJournalRecommendWithCollect, apiJournalList } from '@/services'; - -export async function generateMetadata({ params: { category } }: { params: { category?: string } }) { - if (category && category !== 'all') { - const categoryList = await getCategoryList(); - const categoryInfo: Category | undefined = categoryList.find((item: Category) => item.nameEn === category); - return { title: categoryInfo?.nameCh, description: categoryInfo?.description }; - } -} - -const getCategoryList = async () => { - const result = await apiSearchCategoryList(); - if (result.code !== 200) return notFound(); - - // 去除空格 - const list: Category[] = result.data.map((item) => { - return { ...item, nameEn: item.nameEn.replace(/ /g, '') }; - }); - - // 添加“全部”tag - list.unshift({ - id: '0', - nameCh: '全部', - nameEn: 'all', - image: '', - thumbnail: '', - description: '', - }); - - return list; -}; - -// 获取评论 -const getRecommendList = async () => { - const result = await apiGetJournalRecommendWithCollect(); - return result.data; -}; - -// 获取期刊 list -const getJournalList = async ({ category, page }: { category: string; page: number }) => { - const res = await apiJournalList({ categoryId: category, journalNoRange: '', pageNum: page, pageSize: 10 }); - if (res.code !== 200) return notFound(); - return res.data; -}; - -export default async function Journal({ params }: { params: { category?: string; page?: number } }) { - const { category = 'all', page = 1 } = params; - - // 获取期刊分类 - const categoryList = await getCategoryList(); - const categoryInfo: Category | undefined = categoryList.find((item: Category) => item.nameEn === category); - - // 获取热门推荐、期刊列表 - const [recommendList, journalList] = await Promise.all([ - getRecommendList(), - getJournalList({ category: categoryInfo?.id ?? '', page: Number(page) }), - ]); - - return ( -
- - -
- {/* category */} - - - {/* header */} -
-
{categoryInfo?.nameCh ?? '全部'}
- -
- - {/* 期刊列表 */} -
- {journalList.rows.map((item: JournalInfo) => ( - - ))} -
- - {/* 分页 */} - -
- - {/* 热门推荐 */} -
- {!!recommendList?.length ? :
} -
-
- ); -} +/** 期刊列表 */ +import { notFound } from 'next/navigation'; + +import { Category, JournalRecommendList, JournalItem, Pagination, RedirectCheck, ButtonFM } from '@/components'; +import { apiSearchCategoryList, apiGetJournalRecommendWithCollect, apiJournalList } from '@/services'; + +export async function generateMetadata({ params: { category } }: { params: { category?: string } }) { + if (category && category !== 'all') { + const categoryList = await getCategoryList(); + const categoryInfo: Category | undefined = categoryList.find((item: Category) => item.nameEn === category); + return { title: categoryInfo?.nameCh, description: categoryInfo?.description }; + } +} + +const getCategoryList = async () => { + const result = await apiSearchCategoryList(); + if (result.code !== 200) return notFound(); + + // 去除空格 + const list: Category[] = result.data.map((item) => { + return { ...item, nameEn: item.nameEn.replace(/ /g, '') }; + }); + + // 添加“全部”tag + list.unshift({ + id: '0', + nameCh: '全部', + nameEn: 'all', + image: '', + thumbnail: '', + description: '', + }); + + return list; +}; + +// 获取评论 +const getRecommendList = async () => { + const result = await apiGetJournalRecommendWithCollect(); + return result.data; +}; + +// 获取期刊 list +const getJournalList = async ({ category, page }: { category: string; page: number }) => { + const res = await apiJournalList({ categoryId: category, journalNoRange: '', pageNum: page, pageSize: 10 }); + if (res.code !== 200) return notFound(); + return res.data; +}; + +export default async function Journal({ params }: { params: { category?: string; page?: number } }) { + const { category = 'all', page = 1 } = params; + + // 获取期刊分类 + const categoryList = await getCategoryList(); + const categoryInfo: Category | undefined = categoryList.find((item: Category) => item.nameEn === category); + + // 获取热门推荐、期刊列表 + const [recommendList, journalList] = await Promise.all([ + getRecommendList(), + getJournalList({ category: categoryInfo?.id ?? '', page: Number(page) }), + ]); + + return ( +
+ + +
+ {/* category */} + + + {/* header */} +
+
{categoryInfo?.nameCh ?? '全部'}
+ +
+ + {/* 期刊列表 */} +
+ {journalList.rows.map((item: JournalInfo) => ( + + ))} +
+ + {/* 分页 */} + +
+ + {/* 热门推荐 */} +
+ {!!recommendList?.length ? :
} +
+
+ ); +} diff --git a/src/app/my/collect/index.module.css b/src/app/(website)/my/collect/index.module.css similarity index 100% rename from src/app/my/collect/index.module.css rename to src/app/(website)/my/collect/index.module.css diff --git a/src/app/my/collect/layout.tsx b/src/app/(website)/my/collect/layout.tsx similarity index 96% rename from src/app/my/collect/layout.tsx rename to src/app/(website)/my/collect/layout.tsx index 080acbd..e679159 100644 --- a/src/app/my/collect/layout.tsx +++ b/src/app/(website)/my/collect/layout.tsx @@ -1,45 +1,45 @@ -'use client'; - -import Link from 'next/link'; -import { usePathname } from 'next/navigation'; - -import styles from './index.module.css'; - -const tabList: Array<{ label: string; value: 'song' | 'vol' }> = [ - { - label: '收藏的单曲', - value: 'song', - }, - { - label: '收藏的期刊', - value: 'vol', - }, -]; - -export default function Layout({ children }: { children: React.ReactNode }) { - const pathname = usePathname(); - const pathList = pathname.split('/'); - const type = pathList[pathList.length - 1]; - - return ( -
- {/* Nav */} - - - {children} - -
-
- ); -} +'use client'; + +import Link from 'next/link'; +import { usePathname } from 'next/navigation'; + +import styles from './index.module.css'; + +const tabList: Array<{ label: string; value: 'song' | 'vol' }> = [ + { + label: '收藏的单曲', + value: 'song', + }, + { + label: '收藏的期刊', + value: 'vol', + }, +]; + +export default function Layout({ children }: { children: React.ReactNode }) { + const pathname = usePathname(); + const pathList = pathname.split('/'); + const type = pathList[pathList.length - 1]; + + return ( +
+ {/* Nav */} + + + {children} + +
+
+ ); +} diff --git a/src/app/my/collect/song/page.tsx b/src/app/(website)/my/collect/song/page.tsx similarity index 100% rename from src/app/my/collect/song/page.tsx rename to src/app/(website)/my/collect/song/page.tsx diff --git a/src/app/my/collect/vol/page.tsx b/src/app/(website)/my/collect/vol/page.tsx similarity index 100% rename from src/app/my/collect/vol/page.tsx rename to src/app/(website)/my/collect/vol/page.tsx diff --git a/src/app/vol/[journalId]/page.tsx b/src/app/(website)/vol/[journalId]/page.tsx similarity index 97% rename from src/app/vol/[journalId]/page.tsx rename to src/app/(website)/vol/[journalId]/page.tsx index 86e2908..4207510 100644 --- a/src/app/vol/[journalId]/page.tsx +++ b/src/app/(website)/vol/[journalId]/page.tsx @@ -1,105 +1,105 @@ -/** 期刊详情 */ -import { notFound, redirect, RedirectType } from 'next/navigation'; - -import { SongCardList, JournalRecommendList, Comment, CollectButton, VolDetailCoverCard } from '@/components'; -import { apiGetJournalInfoById, apiGetSongsByJournalNo, apiGetJournalRecommendById } from '@/services'; - -export async function generateMetadata({ params: { journalId } }: { params: { journalId: string } }) { - const res = await apiGetJournalInfoById({ id: journalId }); - const journalInfo = res.data; - return { title: journalInfo.title, description: journalInfo.summary }; -} - -const getData = async (journalId: string) => { - const [journalInfoRes, songListRes, recommendList] = await Promise.all([ - apiGetJournalInfoById({ id: journalId }), - apiGetSongsByJournalNo({ id: journalId }), - apiGetJournalRecommendById({ id: journalId, limit: 8 }), - ]); - if (!(journalInfoRes.code === 200 && songListRes.code === 200)) return notFound(); - return { journalInfo: journalInfoRes.data, songList: songListRes.data, recommendList: recommendList.data }; -}; - -export default async function JournalDetail({ - params: { journalId }, - searchParams: { mobile }, -}: { - params: { journalId: string }; - searchParams: { mobile: string }; -}) { - const { journalInfo, songList, recommendList } = await getData(journalId); - - if (mobile) { - redirect(`${process.env.NEXT_PUBLIC_MOBILE_HOST}/journal.html?id=${journalInfo.id}`, RedirectType.replace); - } - - return ( -
-
- {/* 封面 */} - -
- {/* 期刊号 & 标签 */} -
-
{`VOL.${journalInfo?.journalNo.toString().padStart(4, '0')}`}
- {journalInfo?.tags.length > 0 && - journalInfo.tags.map((tag: string) => ( - - {tag} - - ))} -
- - {/* 收藏期刊 */} - -
- -
- {/* 标题 */} -
-
- {journalInfo.title} -
- - {/* 作者 & 时间 */} -
-

{journalInfo.editor}

-

{journalInfo.date}

-
-
-
- {/* 内容 */} -
- - {/* 卡片 */} - - - -
- -
- {/* 热门推荐 */} - {!!recommendList?.length ? :
} -
-
- ); -} +/** 期刊详情 */ +import { notFound, redirect, RedirectType } from 'next/navigation'; + +import { SongCardList, JournalRecommendList, Comment, CollectButton, VolDetailCoverCard } from '@/components'; +import { apiGetJournalInfoById, apiGetSongsByJournalNo, apiGetJournalRecommendById } from '@/services'; + +export async function generateMetadata({ params: { journalId } }: { params: { journalId: string } }) { + const res = await apiGetJournalInfoById({ id: journalId }); + const journalInfo = res.data; + return { title: journalInfo.title, description: journalInfo.summary }; +} + +const getData = async (journalId: string) => { + const [journalInfoRes, songListRes, recommendList] = await Promise.all([ + apiGetJournalInfoById({ id: journalId }), + apiGetSongsByJournalNo({ id: journalId }), + apiGetJournalRecommendById({ id: journalId, limit: 8 }), + ]); + if (!(journalInfoRes.code === 200 && songListRes.code === 200)) return notFound(); + return { journalInfo: journalInfoRes.data, songList: songListRes.data, recommendList: recommendList.data }; +}; + +export default async function JournalDetail({ + params: { journalId }, + searchParams: { mobile }, +}: { + params: { journalId: string }; + searchParams: { mobile: string }; +}) { + const { journalInfo, songList, recommendList } = await getData(journalId); + + if (mobile) { + redirect(`${process.env.NEXT_PUBLIC_MOBILE_HOST}/journal.html?id=${journalInfo.id}`, RedirectType.replace); + } + + return ( +
+
+ {/* 封面 */} + +
+ {/* 期刊号 & 标签 */} +
+
{`VOL.${journalInfo?.journalNo.toString().padStart(4, '0')}`}
+ {journalInfo?.tags.length > 0 && + journalInfo.tags.map((tag: string) => ( + + {tag} + + ))} +
+ + {/* 收藏期刊 */} + +
+ +
+ {/* 标题 */} +
+
+ {journalInfo.title} +
+ + {/* 作者 & 时间 */} +
+

{journalInfo.editor}

+

{journalInfo.date}

+
+
+
+ {/* 内容 */} +
+ + {/* 卡片 */} + + + +
+ +
+ {/* 热门推荐 */} + {!!recommendList?.length ? :
} +
+
+ ); +}