diff --git a/apps/web/src/app/main/search/components/SearchContainer.tsx b/apps/web/src/app/main/search/components/SearchContainer.tsx index 7413ce5..d227fba 100755 --- a/apps/web/src/app/main/search/components/SearchContainer.tsx +++ b/apps/web/src/app/main/search/components/SearchContainer.tsx @@ -22,7 +22,7 @@ export default function SearchListContainer() { params={{ pageSize: 12, where: { - type: searchMode === "both" ? undefined : searchMode, + type: searchMode === "both" ? { in: [PostType.COURSE, PostType.PATH] } : searchMode, ...termsCondition, ...searchCondition, deletedAt: null, diff --git a/apps/web/src/components/common/editor/MindEditor.tsx b/apps/web/src/components/common/editor/MindEditor.tsx index 7608c8a..f71f925 100755 --- a/apps/web/src/components/common/editor/MindEditor.tsx +++ b/apps/web/src/components/common/editor/MindEditor.tsx @@ -1,4 +1,4 @@ -import { Button, Empty, Form, Spin } from "antd"; +import { Button, Empty, Form, Modal, Spin } from "antd"; import NodeMenu from "./NodeMenu"; import { api, usePost, useVisitor } from "@nice/client"; import { @@ -20,7 +20,7 @@ import { useTusUpload } from "@web/src/hooks/useTusUpload"; import { useNavigate } from "react-router-dom"; import { useAuth } from "@web/src/providers/auth-provider"; import { MIND_OPTIONS } from "./constant"; -import { LinkOutlined, SaveOutlined } from "@ant-design/icons"; +import { ExclamationCircleFilled, LinkOutlined, SaveOutlined } from "@ant-design/icons"; import JoinButton from "../../models/course/detail/CourseOperationBtns/JoinButton"; import { CourseDetailContext } from "../../models/course/detail/PostDetailContext"; import ReactDOM from "react-dom"; @@ -29,6 +29,7 @@ import { useQueryClient } from "@tanstack/react-query"; import { getQueryKey } from "@trpc/react-query"; export default function MindEditor({ id }: { id?: string }) { const containerRef = useRef(null); + const { confirm } = Modal; const { post, isLoading, @@ -39,9 +40,9 @@ export default function MindEditor({ id }: { id?: string }) { const { isAuthenticated, user, hasSomePermissions } = useAuth(); const { read } = useVisitor(); const queryClient = useQueryClient(); - useEffect(()=>{ - console.log("post",post) - console.log("user",user) + useEffect(() => { + console.log("post", post) + console.log("user", user) console.log(canEdit) }) // const { data: post, isLoading }: { data: PathDto; isLoading: boolean } = @@ -55,7 +56,7 @@ export default function MindEditor({ id }: { id?: string }) { // { enabled: Boolean(id) } // ); const softDeletePostDescendant = api.post.softDeletePostDescendant.useMutation({ - onSuccess:()=>{ + onSuccess: () => { queryClient.invalidateQueries({ queryKey: getQueryKey(api.post) }); } }) @@ -66,8 +67,8 @@ export default function MindEditor({ id }: { id?: string }) { isAuthenticated && (!id || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST)) ); - }, [user,post]); - + }, [user, post]); + const navigate = useNavigate(); const { create, update } = usePost(); @@ -148,7 +149,7 @@ export default function MindEditor({ id }: { id?: string }) { //挂载实例 setInstance(mind); - }, [canEdit,post]); + }, [canEdit, post]); useEffect(() => { handleIcon() }); @@ -163,7 +164,7 @@ export default function MindEditor({ id }: { id?: string }) { } } }, [id, post, instance]); - + //保存 按钮 函数 const handleSave = async () => { if (!instance) return; @@ -236,6 +237,26 @@ export default function MindEditor({ id }: { id?: string }) { }); navigate("/path"); } + + + const showDeleteConfirm = () => { + confirm({ + title: '确定删除该思维导图吗', + icon: , + content: '', + okText: '删除', + okType: 'danger', + cancelText: '取消', + async onOk() { + console.log('OK'); + await handleDelete() + toast.success('思维导图已删除') + }, + onCancel() { + console.log('Cancel'); + }, + }); + }; useEffect(() => { containerRef.current.style.height = `${Math.floor(window.innerHeight - 271)}px`; }, []); @@ -283,7 +304,7 @@ export default function MindEditor({ id }: { id?: string }) { danger icon={} onSubmit={(e) => e.preventDefault()} - onClick={handleDelete}> + onClick={showDeleteConfirm}> 删除 ) diff --git a/apps/web/src/components/common/uploader/ResourceShower.tsx b/apps/web/src/components/common/uploader/ResourceShower.tsx index 213a10b..7641210 100755 --- a/apps/web/src/components/common/uploader/ResourceShower.tsx +++ b/apps/web/src/components/common/uploader/ResourceShower.tsx @@ -98,7 +98,10 @@ export default function ResourcesShower({ href={resource.originalUrl} target="_blank" download={true} - title="点击下载文件"> + title={`点击下载“${resource.title}.${resource.url + .split(".") + .pop() + ?.slice(0, 4)}”`}> {/* 超紧凑卡片容器 */}
{/* 微型文件图标 */} diff --git a/apps/web/src/components/models/course/detail/CourseDetailTitle.tsx b/apps/web/src/components/models/course/detail/CourseDetailTitle.tsx index ff1a30e..f775b31 100755 --- a/apps/web/src/components/models/course/detail/CourseDetailTitle.tsx +++ b/apps/web/src/components/models/course/detail/CourseDetailTitle.tsx @@ -17,10 +17,11 @@ export default function CourseDetailTitle() { lecture, selectedLectureId, } = useContext(CourseDetailContext); + const navigate = useNavigate(); return (
-
- {!selectedLectureId ? course?.title : lecture?.title} +
+ {!selectedLectureId ? course?.title : `${course?.title} : ${lecture?.title}`}
{course?.depts && course?.depts?.length > 0 && ( diff --git a/apps/web/src/components/models/course/detail/PostDetailContext.tsx b/apps/web/src/components/models/course/detail/PostDetailContext.tsx index 8ecf8b2..ad181f6 100755 --- a/apps/web/src/components/models/course/detail/PostDetailContext.tsx +++ b/apps/web/src/components/models/course/detail/PostDetailContext.tsx @@ -106,6 +106,9 @@ export function PostDetailProvider({ } }, [selectedLectureId, editId]); const [isHeaderVisible, setIsHeaderVisible] = useState(true); // 新增 + useEffect(() => { + console.log("post", post); + }, [post]); return ( = ({ // 事件处理 const handlePlay = () => setIsPlaying(true); const handlePause = () => setIsPlaying(false); - const handleEnded = () => setIsPlaying(false); + const handleEnded = () => { + console.log("ended") + setIsPlaying(false) + }; const handleWaiting = () => setBufferingState(true); const handlePlaying = () => setBufferingState(false); const handleLoadedMetadata = () => {