This commit is contained in:
Rao 2025-02-27 23:11:37 +08:00
parent 711ab6290e
commit f1d4733d2a
3 changed files with 11 additions and 4 deletions

View File

@ -34,14 +34,16 @@ interface CoursesSectionProps {
description: string; description: string;
initialVisibleCoursesCount?: number; initialVisibleCoursesCount?: number;
postType:string; postType:string;
render?:(post)=>ReactNode render?:(post)=>ReactNode;
to:string
} }
const CoursesSection: React.FC<CoursesSectionProps> = ({ const CoursesSection: React.FC<CoursesSectionProps> = ({
title, title,
description, description,
initialVisibleCoursesCount = 8, initialVisibleCoursesCount = 8,
postType, postType,
render render,
to
}) => { }) => {
const [selectedCategory, setSelectedCategory] = useState<string>("全部"); const [selectedCategory, setSelectedCategory] = useState<string>("全部");
const gateGory: GetTaxonomyProps = useGetTaxonomy({ const gateGory: GetTaxonomyProps = useGetTaxonomy({
@ -102,7 +104,7 @@ const CoursesSection: React.FC<CoursesSectionProps> = ({
}} }}
showPagination={false} showPagination={false}
cols={4}></PostList> cols={4}></PostList>
<LookForMore to={"/courses"}></LookForMore> <LookForMore to={to}></LookForMore>
</div> </div>
</section> </section>
); );

View File

@ -11,7 +11,10 @@ export default function LookForMore({to}:{to:string}) {
<div className="flex justify-end"> <div className="flex justify-end">
<Button <Button
type="link" type="link"
onClick={() => navigate(to)} onClick={() => {
navigate(to)
window.scrollTo({top: 0,behavior: "smooth"});
}}
className="flex items-center gap-2 text-gray-600 hover:text-blue-600 font-medium transition-colors duration-300"> className="flex items-center gap-2 text-gray-600 hover:text-blue-600 font-medium transition-colors duration-300">
<ArrowRightOutlined /> <ArrowRightOutlined />

View File

@ -16,12 +16,14 @@ const HomePage = () => {
description="深受追捧的思维导图,点亮你的智慧人生" description="深受追捧的思维导图,点亮你的智慧人生"
postType={PostType.PATH} postType={PostType.PATH}
render={(post)=><PathCard post={post}></PathCard>} render={(post)=><PathCard post={post}></PathCard>}
to={"path"}
/> />
<CoursesSection <CoursesSection
title="推荐课程" title="推荐课程"
description="最受欢迎的精品课程,助你快速成长" description="最受欢迎的精品课程,助你快速成长"
postType={PostType.COURSE} postType={PostType.COURSE}
render={(post)=> <CourseCard post={post}></CourseCard>} render={(post)=> <CourseCard post={post}></CourseCard>}
to={"/courses"}
/> />
<CategorySection /> <CategorySection />