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..23cd420 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 @@ -43,16 +44,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..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: "注册学员" }, @@ -111,7 +111,7 @@ const HeroSection = () => { { countStatistics > 1 && (
-
+
{platformStats.map((stat, index) => { return stat.value ? (
- + diff --git a/apps/web/src/components/models/course/detail/CourseDetailContext.tsx b/apps/web/src/components/models/course/detail/CourseDetailContext.tsx index 9ba1283..b722f3c 100755 --- a/apps/web/src/components/models/course/detail/CourseDetailContext.tsx +++ b/apps/web/src/components/models/course/detail/CourseDetailContext.tsx @@ -50,10 +50,13 @@ export function CourseDetailProvider({ (api.post as any).findFirst.useQuery( { where: { id: editId }, - include: { - // sections: { include: { lectures: true } }, - enrollments: true, - }, + // include: { + // // sections: { include: { lectures: true } }, + // enrollments: true, + // terms:true + // }, + + select:courseDetailSelect }, { enabled: Boolean(editId) } ); diff --git a/apps/web/src/components/models/course/detail/CourseDetailDescription.tsx b/apps/web/src/components/models/course/detail/CourseDetailDescription.tsx index 6573753..39204fb 100755 --- a/apps/web/src/components/models/course/detail/CourseDetailDescription.tsx +++ b/apps/web/src/components/models/course/detail/CourseDetailDescription.tsx @@ -1,14 +1,16 @@ -import { Course } from "@nice/common"; +import { Course, TaxonomySlug } from "@nice/common"; import React, { useContext, useMemo } from "react"; -import { Image, Typography, Skeleton } from "antd"; // 引入 antd 组件 +import { Image, Typography, Skeleton, Tag } from "antd"; // 引入 antd 组件 import { CourseDetailContext } from "./CourseDetailContext"; import { CalendarOutlined, + EditTwoTone, EyeOutlined, PlayCircleOutlined, + ReloadOutlined, } from "@ant-design/icons"; import dayjs from "dayjs"; -import { useNavigate } from "react-router-dom"; +import { useNavigate, useParams } from "react-router-dom"; export const CourseDetailDescription: React.FC = () => { 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) { 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}