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) {