This commit is contained in:
Rao 2025-04-01 21:11:19 +08:00
parent 28f7d40da5
commit c372c28f47
6 changed files with 47 additions and 16 deletions

View File

@ -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,

View File

@ -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<HTMLDivElement>(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,7 +67,7 @@ export default function MindEditor({ id }: { id?: string }) {
isAuthenticated &&
(!id || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST))
);
}, [user,post]);
}, [user, post]);
const navigate = useNavigate();
@ -148,7 +149,7 @@ export default function MindEditor({ id }: { id?: string }) {
//挂载实例
setInstance(mind);
}, [canEdit,post]);
}, [canEdit, post]);
useEffect(() => {
handleIcon()
});
@ -236,6 +237,26 @@ export default function MindEditor({ id }: { id?: string }) {
});
navigate("/path");
}
const showDeleteConfirm = () => {
confirm({
title: '确定删除该思维导图吗',
icon: <ExclamationCircleFilled />,
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={<SaveOutlined></SaveOutlined>}
onSubmit={(e) => e.preventDefault()}
onClick={handleDelete}>
onClick={showDeleteConfirm}>
</Button>
)

View File

@ -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)}`}>
{/* 超紧凑卡片容器 */}
<div className="w-[120px] h-[80px] p-2 flex flex-col items-center justify-between rounded-xl hover:bg-primary-50/40 cursor-pointer">
{/* 微型文件图标 */}

View File

@ -17,10 +17,11 @@ export default function CourseDetailTitle() {
lecture,
selectedLectureId,
} = useContext(CourseDetailContext);
const navigate = useNavigate();
return (
<div className="flex justify-center flex-col items-center gap-2 w-full my-2 px-6">
<div className="flex justify-start w-full text-2xl font-bold">
{!selectedLectureId ? course?.title : lecture?.title}
<div className="flex justify-start w-full text-2xl font-bold ">
{!selectedLectureId ? course?.title : `${course?.title} ${lecture?.title}`}
</div>
<div className="text-gray-600 flex w-full justify-start items-center gap-5">
{course?.depts && course?.depts?.length > 0 && (

View File

@ -106,6 +106,9 @@ export function PostDetailProvider({
}
}, [selectedLectureId, editId]);
const [isHeaderVisible, setIsHeaderVisible] = useState(true); // 新增
useEffect(() => {
console.log("post", post);
}, [post]);
return (
<CourseDetailContext.Provider
value={{

View File

@ -150,7 +150,10 @@ export const VideoDisplay: React.FC<VideoDisplayProps> = ({
// 事件处理
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 = () => {