From 57f486ca6eee676e68d6c94352c203591cbfd7fb Mon Sep 17 00:00:00 2001 From: ditiqi Date: Wed, 26 Feb 2025 19:49:50 +0800 Subject: [PATCH] add --- .../app/main/home/components/HeroSection.tsx | 91 ++++++++++++------- .../src/app/main/layout/UserMenu/UserMenu.tsx | 28 ++++-- apps/web/src/app/main/my-duty/page.tsx | 7 ++ apps/web/src/app/main/my-learning/page.tsx | 3 + packages/common/prisma/schema.prisma | 8 -- 5 files changed, 88 insertions(+), 49 deletions(-) create mode 100644 apps/web/src/app/main/my-duty/page.tsx create mode 100644 apps/web/src/app/main/my-learning/page.tsx diff --git a/apps/web/src/app/main/home/components/HeroSection.tsx b/apps/web/src/app/main/home/components/HeroSection.tsx index eca460d..4073109 100755 --- a/apps/web/src/app/main/home/components/HeroSection.tsx +++ b/apps/web/src/app/main/home/components/HeroSection.tsx @@ -1,4 +1,10 @@ -import React, { useRef, useCallback, useEffect, useMemo, useState } from "react"; +import React, { + useRef, + useCallback, + useEffect, + useMemo, + useState, +} from "react"; import { Carousel, Typography } from "antd"; import { TeamOutlined, @@ -30,13 +36,29 @@ interface PlatformStat { const HeroSection = () => { const carouselRef = useRef(null); const { statistics, slides } = useAppConfig(); - const [countStatistics, setCountStatistics] = useState(4) + const [countStatistics, setCountStatistics] = useState(4); const platformStats: PlatformStat[] = useMemo(() => { return [ - { icon: , value: statistics.staffs, label: "注册学员" }, - { icon: , value: statistics.courses, label: "精品课程" }, - { icon: , value: statistics.lectures, label: '课程章节' }, - { icon: , value: statistics.reads, label: "观看次数" }, + { + icon: , + value: statistics.staffs, + label: "注册学员", + }, + { + icon: , + value: statistics.courses, + label: "精品课程", + }, + { + icon: , + value: statistics.lectures, + label: "课程章节", + }, + { + icon: , + value: statistics.reads, + label: "观看次数", + }, ]; }, [statistics]); const handlePrev = useCallback(() => { @@ -48,7 +70,7 @@ const HeroSection = () => { }, []); const countNonZeroValues = (statistics: Record): number => { - return Object.values(statistics).filter(value => value !== 0).length; + return Object.values(statistics).filter((value) => value !== 0).length; }; useEffect(() => { @@ -67,8 +89,8 @@ const HeroSection = () => { dots={{ className: "carousel-dots !bottom-32 !z-20", }}> - {Array.isArray(slides) ? - (slides.map((item, index) => ( + {Array.isArray(slides) ? ( + slides.map((item, index) => (
{
)) - ) : ( -
- )} + ) : ( +
+ )} {/* Navigation Buttons */} @@ -108,31 +130,30 @@ const HeroSection = () => {
{/* Stats Container */} - { - countStatistics > 1 && ( -
-
- {platformStats.map((stat, index) => { - return stat.value - ? (
-
- {stat.icon} -
-
- {stat.value} -
-
- {stat.label} -
+ {countStatistics > 1 && ( +
+
+ {platformStats.map((stat, index) => { + return stat.value ? ( +
+
+ {stat.icon}
- ) : null - })} -
+
+ {stat.value} +
+
+ {stat.label} +
+
+ ) : null; + })}
- ) - } +
+ )} ); }; diff --git a/apps/web/src/app/main/layout/UserMenu/UserMenu.tsx b/apps/web/src/app/main/layout/UserMenu/UserMenu.tsx index ea23902..41da474 100755 --- a/apps/web/src/app/main/layout/UserMenu/UserMenu.tsx +++ b/apps/web/src/app/main/layout/UserMenu/UserMenu.tsx @@ -86,6 +86,20 @@ export function UserMenu() { setModalOpen(true); }, }, + { + icon: , + label: "我创建的课程", + action: () => { + setModalOpen(true); + }, + }, + { + icon: , + label: "我学习的课程", + action: () => { + setModalOpen(true); + }, + }, canManageAnyStaff && { icon: , label: "设置", @@ -222,18 +236,20 @@ export function UserMenu() { focus:ring-2 focus:ring-[#00538E]/20 group relative overflow-hidden active:scale-[0.99] - ${item.label === "注销" + ${ + item.label === "注销" ? "text-[#B22234] hover:bg-red-50/80 hover:text-red-700" : "text-[#00538E] hover:bg-[#E6EEF5] hover:text-[#003F6A]" - }`}> + }`}> + group-hover:translate-x-0.5 ${ + item.label === "注销" + ? "group-hover:text-red-600" + : "group-hover:text-[#003F6A]" + }`}> {item.icon} {item.label} diff --git a/apps/web/src/app/main/my-duty/page.tsx b/apps/web/src/app/main/my-duty/page.tsx new file mode 100644 index 0000000..7871969 --- /dev/null +++ b/apps/web/src/app/main/my-duty/page.tsx @@ -0,0 +1,7 @@ +export default function MyDutyPage() { + + + + return <> + +} diff --git a/apps/web/src/app/main/my-learning/page.tsx b/apps/web/src/app/main/my-learning/page.tsx new file mode 100644 index 0000000..503600c --- /dev/null +++ b/apps/web/src/app/main/my-learning/page.tsx @@ -0,0 +1,3 @@ +export default function MyLearningPage() { + return <>; +} diff --git a/packages/common/prisma/schema.prisma b/packages/common/prisma/schema.prisma index 1c245e2..236c4ab 100755 --- a/packages/common/prisma/schema.prisma +++ b/packages/common/prisma/schema.prisma @@ -288,14 +288,6 @@ model Visit { message Message? @relation(fields: [messageId], references: [id]) messageId String? @map("message_id") lectureId String? @map("lecture_id") // 课时ID - - // 学习数据 - // progress Float? @default(0) @map("progress") // 完成进度(0-100%) - // isCompleted Boolean? @default(false) @map("is_completed") // 是否完成 - // lastPosition Int? @default(0) @map("last_position") // 视频播放位置(秒) - // totalWatchTime Int? @default(0) @map("total_watch_time") // 总观看时长(秒) - // // 时间记录 - // lastWatchedAt DateTime? @map("last_watched_at") // 最后观看时间 createdAt DateTime @default(now()) @map("created_at") // 创建时间 updatedAt DateTime @updatedAt @map("updated_at") // 更新时间 deletedAt DateTime? @map("deleted_at") // 删除时间,可为空