From f0f15024c02813477199c1c2841ea6834322f15a Mon Sep 17 00:00:00 2001 From: ditiqi Date: Thu, 27 Feb 2025 09:28:16 +0800 Subject: [PATCH 01/46] afff --- .../main/courses/components/CourseCard.tsx | 6 +- .../main/courses/components/FilterSection.tsx | 27 +--- apps/web/src/app/main/layout/MainFooter.tsx | 130 ++++++++++-------- apps/web/src/app/main/layout/MainLayout.tsx | 2 +- .../course/detail/CourseDetailLayout.tsx | 2 +- .../detail/CourseSyllabus/CourseSyllabus.tsx | 4 +- 6 files changed, 80 insertions(+), 91 deletions(-) diff --git a/apps/web/src/app/main/courses/components/CourseCard.tsx b/apps/web/src/app/main/courses/components/CourseCard.tsx index 597caf0..fa4b0d5 100755 --- a/apps/web/src/app/main/courses/components/CourseCard.tsx +++ b/apps/web/src/app/main/courses/components/CourseCard.tsx @@ -87,11 +87,11 @@ export default function CourseCard({ course, edit = false }: CourseCardProps) {
- + {`观看次数 ${course?.meta?.views || 0}`} - + {`学习人数 ${course?.studentIds?.length || 0}`} @@ -102,7 +102,7 @@ export default function CourseCard({ course, edit = false }: CourseCardProps) { size="large" className="w-full shadow-[0_8px_20px_-6px_rgba(59,130,246,0.5)] hover:shadow-[0_12px_24px_-6px_rgba(59,130,246,0.6)] transform hover:translate-y-[-2px] transition-all duration-500 ease-out"> - {edit ? "进行编辑" : "立即学习"} + {edit ? "编辑" : "立即学习"}
diff --git a/apps/web/src/app/main/courses/components/FilterSection.tsx b/apps/web/src/app/main/courses/components/FilterSection.tsx index b437058..110ba8c 100755 --- a/apps/web/src/app/main/courses/components/FilterSection.tsx +++ b/apps/web/src/app/main/courses/components/FilterSection.tsx @@ -19,7 +19,7 @@ export default function FilterSection() { }); }; return ( -
+
{taxonomies?.map((tax, index) => { const items = Object.entries(selectedTerms).find( ([key, items]) => key === tax.slug @@ -31,7 +31,7 @@ export default function FilterSection() { handleTermChange( @@ -39,27 +39,8 @@ export default function FilterSection() { selected as string[] ) } - taxonomyId={tax?.id} - > - {/* ( -
{menu}
- )} - dropdownStyle={{ maxHeight: 400, overflow: "auto" }} - multiple - taxonomyId={tax?.id} - onChange={(selected) => - handleTermChange( - tax?.slug, - selected as string[] - ) - }>
- {index < taxonomies.length - 1 && ( - - )} */} + taxonomyId={tax?.id}> +
); })} diff --git a/apps/web/src/app/main/layout/MainFooter.tsx b/apps/web/src/app/main/layout/MainFooter.tsx index 9d060dc..5ebe46f 100755 --- a/apps/web/src/app/main/layout/MainFooter.tsx +++ b/apps/web/src/app/main/layout/MainFooter.tsx @@ -1,68 +1,76 @@ -import { CloudOutlined, FileSearchOutlined, HomeOutlined, MailOutlined, PhoneOutlined } from '@ant-design/icons'; +import { + CloudOutlined, + FileSearchOutlined, + HomeOutlined, + MailOutlined, + PhoneOutlined, +} from "@ant-design/icons"; export function MainFooter() { - return ( -
-
-
- {/* 开发组织信息 */} -
-

- 软件与数据小组 -

-

- 提供技术支持 -

-
+ return ( +
+
+
+ {/* 开发组织信息 */} +
+

+ 软件与数据小组 +

+

+ 提供技术支持 +

+
- {/* 联系方式 */} -
-
- - 628118 -
-
- - gcsjs6@tx3l.nb.kj -
-
+ {/* 联系方式 */} +
+
+ + + 628118 + +
+
+ + + gcsjs6@tx3l.nb.kj + +
+
- {/* 系统链接 */} -
-
- - - - - - + {/* 系统链接 */} +
+ -
-
+ + + +
+
+
- {/* 版权信息 */} -
-

- © {new Date().getFullYear()} 南天烽火. All rights reserved. -

-
-
-
- ); + {/* 版权信息 */} +
+

+ © {new Date().getFullYear()} 南天烽火. All rights + reserved. +

+
+
+ + ); } diff --git a/apps/web/src/app/main/layout/MainLayout.tsx b/apps/web/src/app/main/layout/MainLayout.tsx index f5b462b..fa6627a 100755 --- a/apps/web/src/app/main/layout/MainLayout.tsx +++ b/apps/web/src/app/main/layout/MainLayout.tsx @@ -11,7 +11,7 @@ export function MainLayout() {
- + diff --git a/apps/web/src/components/models/course/detail/CourseDetailLayout.tsx b/apps/web/src/components/models/course/detail/CourseDetailLayout.tsx index cac3bf8..56831e4 100755 --- a/apps/web/src/components/models/course/detail/CourseDetailLayout.tsx +++ b/apps/web/src/components/models/course/detail/CourseDetailLayout.tsx @@ -24,7 +24,7 @@ export default function CourseDetailLayout() { {/* 添加 Header 组件 */} {/* 主内容区域 */} {/* 为了防止 Header 覆盖内容,添加上边距 */} -
+
{" "} {/* 添加这个包装 div */} = ({ style={{ width: isOpen ? "25%" : "0", right: 0, - top: isHeaderVisible ? "64px" : "0", + top: isHeaderVisible ? "56px" : "0", }} - className="fixed top-0 bottom-0 z-20 bg-white shadow-xl"> + className="fixed top-0 bottom-0 z-10 bg-white shadow-xl"> {isOpen && (
From ab6727e23bc563e6102a60c74199be7f70c747cc Mon Sep 17 00:00:00 2001 From: Li1304553726 <1304553726@qq.com> Date: Thu, 27 Feb 2025 09:44:51 +0800 Subject: [PATCH 02/46] add liaohui --- .../main/home/components/CoursesSection.tsx | 60 +++++++++---------- .../src/app/main/layout/UserMenu/UserForm.tsx | 12 +--- .../course/detail/CourseDetailContext.tsx | 10 ++-- .../course/detail/CourseDetailDescription.tsx | 5 +- 4 files changed, 39 insertions(+), 48 deletions(-) diff --git a/apps/web/src/app/main/home/components/CoursesSection.tsx b/apps/web/src/app/main/home/components/CoursesSection.tsx index 999e931..b012fa6 100755 --- a/apps/web/src/app/main/home/components/CoursesSection.tsx +++ b/apps/web/src/app/main/home/components/CoursesSection.tsx @@ -6,45 +6,45 @@ import { CoursesSectionTag } from "./CoursesSectionTag"; import CourseList from "@web/src/components/models/course/list/CourseList"; import LookForMore from "./LookForMore"; interface GetTaxonomyProps { - categories: string[]; - isLoading: boolean; + categories: string[]; + isLoading: boolean; } function useGetTaxonomy({ type }): GetTaxonomyProps { - const { data, isLoading }: { data: TermDto[]; isLoading: boolean } = - api.term.findMany.useQuery({ - where: { - taxonomy: { - slug: type, - }, - parentId : null - }, - take: 11, // 只取前10个 - }); - const categories = useMemo(() => { - const allCategories = isLoading - ? [] - : data?.map((course) => course.name); - return [...Array.from(new Set(allCategories))]; - }, [data]); - return { categories, isLoading }; + const { data, isLoading }: { data: TermDto[]; isLoading: boolean } = + api.term.findMany.useQuery({ + where: { + taxonomy: { + slug: type, + }, + parentId: null + }, + take: 11, // 只取前10个 + }); + const categories = useMemo(() => { + const allCategories = isLoading + ? [] + : data?.map((course) => course.name); + return [...Array.from(new Set(allCategories))]; + }, [data]); + return { categories, isLoading }; } const { Title, Text } = Typography; interface CoursesSectionProps { - title: string; - description: string; - initialVisibleCoursesCount?: number; + title: string; + description: string; + initialVisibleCoursesCount?: number; } const CoursesSection: React.FC = ({ - title, - description, - initialVisibleCoursesCount = 8, + title, + description, + initialVisibleCoursesCount = 8, }) => { const [selectedCategory, setSelectedCategory] = useState("全部"); const gateGory: GetTaxonomyProps = useGetTaxonomy({ type: TaxonomySlug.CATEGORY, }); return ( -
+
@@ -87,10 +87,10 @@ const CoursesSection: React.FC = ({ where: { terms: !(selectedCategory === "全部") ? { - some: { - name: selectedCategory, - }, - } + some: { + name: selectedCategory, + }, + } : {}, }, }} diff --git a/apps/web/src/app/main/layout/UserMenu/UserForm.tsx b/apps/web/src/app/main/layout/UserMenu/UserForm.tsx index efbf12c..a496ed0 100644 --- a/apps/web/src/app/main/layout/UserMenu/UserForm.tsx +++ b/apps/web/src/app/main/layout/UserMenu/UserForm.tsx @@ -12,15 +12,7 @@ import toast from "react-hot-toast"; export default function StaffForm() { const { user } = useAuth(); const { create, update } = useStaff(); // Ensure you have these methods in your hooks - const { - formLoading, - modalOpen, - setModalOpen, - domainId, - setDomainId, - form, - setFormLoading, - } = useContext(UserEditorContext); + const {formLoading,modalOpen,setModalOpen,domainId,setDomainId,form,setFormLoading,} = useContext(UserEditorContext); const { data, isLoading, @@ -76,6 +68,8 @@ export default function StaffForm() { } useEffect(() => { form.resetFields(); + console.log('cc',data); + if (data) { form.setFieldValue("username", data.username); form.setFieldValue("showname", data.showname); diff --git a/apps/web/src/components/models/course/detail/CourseDetailContext.tsx b/apps/web/src/components/models/course/detail/CourseDetailContext.tsx index b722f3c..2738b7b 100755 --- a/apps/web/src/components/models/course/detail/CourseDetailContext.tsx +++ b/apps/web/src/components/models/course/detail/CourseDetailContext.tsx @@ -35,12 +35,8 @@ interface CourseFormProviderProps { editId?: string; // 添加 editId 参数 } -export const CourseDetailContext = - createContext(null); -export function CourseDetailProvider({ - children, - editId, -}: CourseFormProviderProps) { +export const CourseDetailContext =createContext(null); +export function CourseDetailProvider({children,editId}: CourseFormProviderProps) { const navigate = useNavigate(); const { read } = useVisitor(); const { user, hasSomePermissions } = useAuth(); @@ -61,6 +57,7 @@ export function CourseDetailProvider({ { enabled: Boolean(editId) } ); const canEdit = useMemo(() => { + //先判断登陆再判断是否是作者,三个条件满足一个就有编辑权限 const isAuthor = user?.id === course?.authorId; const isDept = course?.depts ?.map((dept) => dept.id) @@ -68,6 +65,7 @@ export function CourseDetailProvider({ const isRoot = hasSomePermissions(RolePerms?.MANAGE_ANY_POST); return isAuthor || isDept || isRoot; }, [user, course]); + const [selectedLectureId, setSelectedLectureId] = useState< string | undefined >(lectureId || undefined); diff --git a/apps/web/src/components/models/course/detail/CourseDetailDescription.tsx b/apps/web/src/components/models/course/detail/CourseDetailDescription.tsx index 39204fb..dbe6ce2 100755 --- a/apps/web/src/components/models/course/detail/CourseDetailDescription.tsx +++ b/apps/web/src/components/models/course/detail/CourseDetailDescription.tsx @@ -13,14 +13,13 @@ import dayjs from "dayjs"; import { useNavigate, useParams } from "react-router-dom"; export const CourseDetailDescription: React.FC = () => { - const { course, isLoading, selectedLectureId, setSelectedLectureId } = + const { course,canEdit, isLoading, selectedLectureId, setSelectedLectureId } = useContext(CourseDetailContext); const { Paragraph, Title } = Typography; const firstLectureId = useMemo(() => { return course?.sections?.[0]?.lectures?.[0]?.id; }, [course]); const navigate = useNavigate(); - const { canEdit } = useContext(CourseDetailContext); const { id } = useParams(); return (
@@ -72,7 +71,7 @@ export const CourseDetailDescription: React.FC = () => { }
- +
From b50e1521f6b5c287b48f5eae7720334d28bfdbcf Mon Sep 17 00:00:00 2001 From: ditiqi Date: Thu, 27 Feb 2025 09:47:31 +0800 Subject: [PATCH 03/46] add --- apps/web/src/app/main/layout/MainFooter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/app/main/layout/MainFooter.tsx b/apps/web/src/app/main/layout/MainFooter.tsx index 5ebe46f..b232752 100755 --- a/apps/web/src/app/main/layout/MainFooter.tsx +++ b/apps/web/src/app/main/layout/MainFooter.tsx @@ -8,7 +8,7 @@ import { export function MainFooter() { return ( -