From fa7edff855f15b87536b56380cc5b0ede17b857e Mon Sep 17 00:00:00 2001 From: Rao <1227431568@qq.com> Date: Wed, 26 Feb 2025 12:16:24 +0800 Subject: [PATCH 1/3] rht02261216 --- apps/web/src/app/main/home/components/HeroSection.tsx | 2 +- .../src/components/models/term/term-parent-selector.tsx | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/web/src/app/main/home/components/HeroSection.tsx b/apps/web/src/app/main/home/components/HeroSection.tsx index 17aa228..f920926 100755 --- a/apps/web/src/app/main/home/components/HeroSection.tsx +++ b/apps/web/src/app/main/home/components/HeroSection.tsx @@ -53,7 +53,7 @@ const HeroSection = () => { useEffect(() => { const count = countNonZeroValues(statistics); - console.log(count); + //console.log(count); setCountStatistics(count); }, [statistics]); return ( diff --git a/apps/web/src/components/models/term/term-parent-selector.tsx b/apps/web/src/components/models/term/term-parent-selector.tsx index f4b365d..b604390 100644 --- a/apps/web/src/components/models/term/term-parent-selector.tsx +++ b/apps/web/src/components/models/term/term-parent-selector.tsx @@ -2,7 +2,6 @@ import { api } from "@nice/client/"; import { Checkbox, Form } from "antd"; import { TermDto } from "@nice/common"; import { useCallback, useEffect, useState } from "react"; - export default function TermParentSelector({ value, onChange, @@ -13,11 +12,7 @@ export default function TermParentSelector({ domainId, style, }: any) { - const utils = api.useUtils(); const [selectedValues, setSelectedValues] = useState([]); // 用于存储选中的值 - const [termsData, setTermsData] = useState([]); - - const { data, isLoading, @@ -42,7 +37,7 @@ export default function TermParentSelector({ {data?.map((category) => (
- + {category.name}
From dbabef92b8f3bea08890f58683f53884b1f8daba Mon Sep 17 00:00:00 2001 From: Li1304553726 <1304553726@qq.com> Date: Wed, 26 Feb 2025 13:10:01 +0800 Subject: [PATCH 2/3] add .Li --- apps/web/src/app/main/courses/components/CourseCard.tsx | 7 +++---- apps/web/src/app/main/home/components/CategorySection.tsx | 2 +- apps/web/src/app/main/home/components/CoursesSection.tsx | 6 +++--- apps/web/src/app/main/home/components/HeroSection.tsx | 2 +- apps/web/src/app/main/layout/MainLayout.tsx | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/apps/web/src/app/main/courses/components/CourseCard.tsx b/apps/web/src/app/main/courses/components/CourseCard.tsx index d830c4d..cbdb80c 100755 --- a/apps/web/src/app/main/courses/components/CourseCard.tsx +++ b/apps/web/src/app/main/courses/components/CourseCard.tsx @@ -24,8 +24,7 @@ export default function CourseCard({ course }: CourseCardProps) { onClick={() => handleClick(course)} key={course.id} hoverable - className="group overflow-hidden rounded-2xl border border-gray-200 bg-white - shadow-xl hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2" + className="group overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-xl hover:shadow-2xl transition-all duration-300 transform hover:-translate-y-2" cover={
{ return (
-
+
diff --git a/apps/web/src/app/main/home/components/CoursesSection.tsx b/apps/web/src/app/main/home/components/CoursesSection.tsx index 902e979..e890b62 100755 --- a/apps/web/src/app/main/home/components/CoursesSection.tsx +++ b/apps/web/src/app/main/home/components/CoursesSection.tsx @@ -43,16 +43,16 @@ const CoursesSection: React.FC<CoursesSectionProps> = ({ type: TaxonomySlug.CATEGORY, }); return ( - <section className="relative py-20 overflow-hidden bg-gradient-to-b from-gray-50 to-white"> + <section className="relative py-16 overflow-hidden bg-gray-200"> + <div className="absolute inset-0 bg-white max-w-screen-2xl mx-auto px-6"></div> <div className="max-w-screen-2xl mx-auto px-6 relative"> - <div className="flex justify-between items-end mb-16"> + <div className="flex justify-between items-end mb-16 "> <div> <Title level={2} className="font-bold text-5xl mb-6 bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent"> {title} - diff --git a/apps/web/src/app/main/home/components/HeroSection.tsx b/apps/web/src/app/main/home/components/HeroSection.tsx index 17aa228..192761f 100755 --- a/apps/web/src/app/main/home/components/HeroSection.tsx +++ b/apps/web/src/app/main/home/components/HeroSection.tsx @@ -111,7 +111,7 @@ const HeroSection = () => { { countStatistics > 1 && (
-
+
{platformStats.map((stat, index) => { return stat.value ? (
- + From 39fca369f4ca50566a28dd3fee43ea054422f7c3 Mon Sep 17 00:00:00 2001 From: Rao <1227431568@qq.com> Date: Wed, 26 Feb 2025 15:48:11 +0800 Subject: [PATCH 3/3] rht02261548 --- .../main/home/components/CoursesSection.tsx | 3 +- .../app/main/home/components/HeroSection.tsx | 6 +- .../course/detail/CourseDetailContext.tsx | 11 +-- .../course/detail/CourseDetailDescription.tsx | 69 ++++++++++++++++--- .../CourseDetailHeader/CourseDetailHeader.tsx | 6 +- .../editor/context/CourseEditorContext.tsx | 2 +- 6 files changed, 75 insertions(+), 22 deletions(-) diff --git a/apps/web/src/app/main/home/components/CoursesSection.tsx b/apps/web/src/app/main/home/components/CoursesSection.tsx index 902e979..a0aabbc 100755 --- a/apps/web/src/app/main/home/components/CoursesSection.tsx +++ b/apps/web/src/app/main/home/components/CoursesSection.tsx @@ -16,8 +16,9 @@ function useGetTaxonomy({ type }): GetTaxonomyProps { taxonomy: { slug: type, }, + parentId : null }, - take: 10, // 只取前10个 + take: 11, // 只取前10个 }); const categories = useMemo(() => { const allCategories = isLoading diff --git a/apps/web/src/app/main/home/components/HeroSection.tsx b/apps/web/src/app/main/home/components/HeroSection.tsx index f920926..eca460d 100755 --- a/apps/web/src/app/main/home/components/HeroSection.tsx +++ b/apps/web/src/app/main/home/components/HeroSection.tsx @@ -30,7 +30,7 @@ interface PlatformStat { const HeroSection = () => { const carouselRef = useRef(null); const { statistics, slides } = useAppConfig(); - const [countStatistics, setCountStatistics] = useState(0) + const [countStatistics, setCountStatistics] = useState(4) const platformStats: PlatformStat[] = useMemo(() => { return [ { icon: , value: statistics.staffs, label: "注册学员" }, @@ -53,7 +53,7 @@ const HeroSection = () => { useEffect(() => { const count = countNonZeroValues(statistics); - //console.log(count); + console.log(count); setCountStatistics(count); }, [statistics]); return ( @@ -111,7 +111,7 @@ const HeroSection = () => { { countStatistics > 1 && (
-
+
{platformStats.map((stat, index) => { return stat.value ? (
{ const { course, isLoading, selectedLectureId, setSelectedLectureId } = @@ -18,12 +20,14 @@ export const CourseDetailDescription: React.FC = () => { return course?.sections?.[0]?.lectures?.[0]?.id; }, [course]); const navigate = useNavigate(); + const { canEdit } = useContext(CourseDetailContext); + const { id } = useParams(); return ( -
+
{isLoading || !course ? ( ) : ( -
+
{!selectedLectureId && ( <>
@@ -43,16 +47,61 @@ export const CourseDetailDescription: React.FC = () => { )}
{"课程简介:"}
-
+
{course?.subTitle}
-
- -
{course?.meta?.views || 0}
-
+ { + course.terms.map((term) => { + return ( + + {term.name} + + ) + }) + } +
+
+ +
{dayjs(course?.createdAt).format("YYYY年M月D日")}
+
+ + {dayjs(course?.updatedAt).format("YYYY年M月D日")} +
+
+ +
{course?.meta?.views || 0}
+
+ { + canEdit && ( +
{ + const url = id + ? `/course/${id}/editor` + : "/course/editor"; + navigate(url); + }} + > + + {"点击编辑课程"} +
+ ) + }
-
-
+
+
{ navigate("/"); @@ -33,7 +33,7 @@ export function CourseDetailHeader() { className="text-2xl text-primary-500 hover:scale-105 cursor-pointer" /> -
+
{course?.title}
{/* */} diff --git a/apps/web/src/components/models/course/editor/context/CourseEditorContext.tsx b/apps/web/src/components/models/course/editor/context/CourseEditorContext.tsx index 0c8becc..c8171da 100755 --- a/apps/web/src/components/models/course/editor/context/CourseEditorContext.tsx +++ b/apps/web/src/components/models/course/editor/context/CourseEditorContext.tsx @@ -111,7 +111,7 @@ export function CourseFormProvider({ delete formattedValues.sections; delete formattedValues.deptIds; - console.log(course.meta); + console.log(course?.meta); console.log(formattedValues?.meta); try { if (editId) {