parent
407c1b37f3
commit
80893417ef
@ -0,0 +1,36 @@
|
||||
import { Category, JournalList, HotJournalList } from '@/components';
|
||||
import { apiTagName } from '@/services/server';
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const tagNameList = await apiTagName({ level: 1, state: 1 });
|
||||
|
||||
return tagNameList.map((item: TagName) => {
|
||||
return {
|
||||
category: item.nameEn,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export default async function Journal({ params }: { params: { category: string } }) {
|
||||
const tagNameList = await apiTagName({ level: 1, state: 1 });
|
||||
const currentTag: TagName = tagNameList.find((item: TagName) => item.nameEn === params.category);
|
||||
const page = 1;
|
||||
|
||||
return (
|
||||
<main className="flex flex-row justify-between w-[1200px] mx-auto items-left pt-[80px] pb-[104px] ">
|
||||
{/* 左侧 */}
|
||||
<div className="w-[712px] mt-[50px]">
|
||||
{/* category */}
|
||||
<Category current={currentTag.nameEn} />
|
||||
{/* 期刊列表 */}
|
||||
<JournalList categoryId={currentTag.id} pageNum={page} />
|
||||
</div>
|
||||
|
||||
{/* 右侧 */}
|
||||
<div className="w-[346px] mt-[217px]">
|
||||
<p className="text-[17px] leading-[23.8px]">热门推荐</p>
|
||||
{/* <HotJournalList /> */}
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
import { TagCategory, JournalList } from '@/components';
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<main className="flex flex-row justify-between w-[1200px] mx-auto items-left pt-[80px] pb-[104px] ">
|
||||
{/* 左侧 */}
|
||||
<div className="w-[712px] mt-[50px]">
|
||||
{/* category */}
|
||||
<TagCategory />
|
||||
{/* 期刊列表 */}
|
||||
<JournalList />
|
||||
</div>
|
||||
|
||||
{/* 右侧 */}
|
||||
<div className="w-[346px] mt-[217px]">
|
||||
<p className="text-[17px] leading-[23.8px]">热门推荐</p>
|
||||
<div></div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
@ -1,21 +1,24 @@
|
||||
import Link from 'next/link';
|
||||
|
||||
import { apiTagName } from '@/services/server/journal';
|
||||
|
||||
const Avatar = async () => {
|
||||
const Category = async ({ current = '' }: { current?: string }) => {
|
||||
const tagNameList = await apiTagName({ level: 1, state: 1 });
|
||||
tagNameList.unshift({ id: '0', nameCh: '全部', nameEn: '', level: 1, parentId: '', state: 1 });
|
||||
|
||||
return (
|
||||
<div className={`grid grid-cols-8`}>
|
||||
{tagNameList.map((item: TagName) => (
|
||||
<div
|
||||
<Link
|
||||
href={`/discover/journal/${item.nameEn}`}
|
||||
key={item.id}
|
||||
// className={`w-[80px] h-[35px] mt-[10px] rounded-[120px] text-[13px] leading-[18px] text-center leading-[35px] cursor-pointer ${current === item.id ? 'bg-[#B44343] text-[#fff]' : 'bg-[#F2F3F7] text-[#000]'}`}
|
||||
className={`w-[80px] h-[35px] mt-[10px] rounded-[120px] text-[13px] leading-[18px] text-center leading-[35px] cursor-pointer bg-[#F2F3F7] text-[#000]`}
|
||||
className={`w-[80px] h-[35px] mt-[10px] rounded-[120px] text-[13px] leading-[18px] text-center leading-[35px] cursor-pointer ${current === item.nameEn ? 'bg-[#B44343] text-[#fff]' : 'bg-[#F2F3F7] text-[#000]'}`}
|
||||
>
|
||||
{item.nameCh}
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Avatar;
|
||||
export default Category;
|
@ -0,0 +1,13 @@
|
||||
import Image from 'next/image';
|
||||
|
||||
export default function JournalCard({ title, image, totalCommentReply }: JournalInfo) {
|
||||
return (
|
||||
<div>
|
||||
<Image src={image} alt={title} width={80} height={56} className="w-[80px] h-[56px] rounded-[3px]" />
|
||||
<div>
|
||||
<p className="text-[15px] leading-[21px]">{title}</p>
|
||||
<p className="text-[13px] leading-[18.2px]">{totalCommentReply}</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
Loading…
Reference in new issue