rht
This commit is contained in:
parent
28f7d40da5
commit
c372c28f47
|
@ -22,7 +22,7 @@ export default function SearchListContainer() {
|
||||||
params={{
|
params={{
|
||||||
pageSize: 12,
|
pageSize: 12,
|
||||||
where: {
|
where: {
|
||||||
type: searchMode === "both" ? undefined : searchMode,
|
type: searchMode === "both" ? { in: [PostType.COURSE, PostType.PATH] } : searchMode,
|
||||||
...termsCondition,
|
...termsCondition,
|
||||||
...searchCondition,
|
...searchCondition,
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Button, Empty, Form, Spin } from "antd";
|
import { Button, Empty, Form, Modal, Spin } from "antd";
|
||||||
import NodeMenu from "./NodeMenu";
|
import NodeMenu from "./NodeMenu";
|
||||||
import { api, usePost, useVisitor } from "@nice/client";
|
import { api, usePost, useVisitor } from "@nice/client";
|
||||||
import {
|
import {
|
||||||
|
@ -20,7 +20,7 @@ import { useTusUpload } from "@web/src/hooks/useTusUpload";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useAuth } from "@web/src/providers/auth-provider";
|
import { useAuth } from "@web/src/providers/auth-provider";
|
||||||
import { MIND_OPTIONS } from "./constant";
|
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 JoinButton from "../../models/course/detail/CourseOperationBtns/JoinButton";
|
||||||
import { CourseDetailContext } from "../../models/course/detail/PostDetailContext";
|
import { CourseDetailContext } from "../../models/course/detail/PostDetailContext";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
|
@ -29,6 +29,7 @@ import { useQueryClient } from "@tanstack/react-query";
|
||||||
import { getQueryKey } from "@trpc/react-query";
|
import { getQueryKey } from "@trpc/react-query";
|
||||||
export default function MindEditor({ id }: { id?: string }) {
|
export default function MindEditor({ id }: { id?: string }) {
|
||||||
const containerRef = useRef<HTMLDivElement>(null);
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
|
const { confirm } = Modal;
|
||||||
const {
|
const {
|
||||||
post,
|
post,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
@ -39,9 +40,9 @@ export default function MindEditor({ id }: { id?: string }) {
|
||||||
const { isAuthenticated, user, hasSomePermissions } = useAuth();
|
const { isAuthenticated, user, hasSomePermissions } = useAuth();
|
||||||
const { read } = useVisitor();
|
const { read } = useVisitor();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
useEffect(()=>{
|
useEffect(() => {
|
||||||
console.log("post",post)
|
console.log("post", post)
|
||||||
console.log("user",user)
|
console.log("user", user)
|
||||||
console.log(canEdit)
|
console.log(canEdit)
|
||||||
})
|
})
|
||||||
// const { data: post, isLoading }: { data: PathDto; isLoading: boolean } =
|
// const { data: post, isLoading }: { data: PathDto; isLoading: boolean } =
|
||||||
|
@ -55,7 +56,7 @@ export default function MindEditor({ id }: { id?: string }) {
|
||||||
// { enabled: Boolean(id) }
|
// { enabled: Boolean(id) }
|
||||||
// );
|
// );
|
||||||
const softDeletePostDescendant = api.post.softDeletePostDescendant.useMutation({
|
const softDeletePostDescendant = api.post.softDeletePostDescendant.useMutation({
|
||||||
onSuccess:()=>{
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries({ queryKey: getQueryKey(api.post) });
|
queryClient.invalidateQueries({ queryKey: getQueryKey(api.post) });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -66,8 +67,8 @@ export default function MindEditor({ id }: { id?: string }) {
|
||||||
isAuthenticated &&
|
isAuthenticated &&
|
||||||
(!id || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST))
|
(!id || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST))
|
||||||
);
|
);
|
||||||
}, [user,post]);
|
}, [user, post]);
|
||||||
|
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { create, update } = usePost();
|
const { create, update } = usePost();
|
||||||
|
@ -148,7 +149,7 @@ export default function MindEditor({ id }: { id?: string }) {
|
||||||
//挂载实例
|
//挂载实例
|
||||||
setInstance(mind);
|
setInstance(mind);
|
||||||
|
|
||||||
}, [canEdit,post]);
|
}, [canEdit, post]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleIcon()
|
handleIcon()
|
||||||
});
|
});
|
||||||
|
@ -163,7 +164,7 @@ export default function MindEditor({ id }: { id?: string }) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [id, post, instance]);
|
}, [id, post, instance]);
|
||||||
|
|
||||||
//保存 按钮 函数
|
//保存 按钮 函数
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
if (!instance) return;
|
if (!instance) return;
|
||||||
|
@ -236,6 +237,26 @@ export default function MindEditor({ id }: { id?: string }) {
|
||||||
});
|
});
|
||||||
navigate("/path");
|
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(() => {
|
useEffect(() => {
|
||||||
containerRef.current.style.height = `${Math.floor(window.innerHeight - 271)}px`;
|
containerRef.current.style.height = `${Math.floor(window.innerHeight - 271)}px`;
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -283,7 +304,7 @@ export default function MindEditor({ id }: { id?: string }) {
|
||||||
danger
|
danger
|
||||||
icon={<SaveOutlined></SaveOutlined>}
|
icon={<SaveOutlined></SaveOutlined>}
|
||||||
onSubmit={(e) => e.preventDefault()}
|
onSubmit={(e) => e.preventDefault()}
|
||||||
onClick={handleDelete}>
|
onClick={showDeleteConfirm}>
|
||||||
删除
|
删除
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
|
|
|
@ -98,7 +98,10 @@ export default function ResourcesShower({
|
||||||
href={resource.originalUrl}
|
href={resource.originalUrl}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
download={true}
|
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">
|
<div className="w-[120px] h-[80px] p-2 flex flex-col items-center justify-between rounded-xl hover:bg-primary-50/40 cursor-pointer">
|
||||||
{/* 微型文件图标 */}
|
{/* 微型文件图标 */}
|
||||||
|
|
|
@ -17,10 +17,11 @@ export default function CourseDetailTitle() {
|
||||||
lecture,
|
lecture,
|
||||||
selectedLectureId,
|
selectedLectureId,
|
||||||
} = useContext(CourseDetailContext);
|
} = useContext(CourseDetailContext);
|
||||||
|
const navigate = useNavigate();
|
||||||
return (
|
return (
|
||||||
<div className="flex justify-center flex-col items-center gap-2 w-full my-2 px-6">
|
<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">
|
<div className="flex justify-start w-full text-2xl font-bold ">
|
||||||
{!selectedLectureId ? course?.title : lecture?.title}
|
{!selectedLectureId ? course?.title : `${course?.title} : ${lecture?.title}`}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-gray-600 flex w-full justify-start items-center gap-5">
|
<div className="text-gray-600 flex w-full justify-start items-center gap-5">
|
||||||
{course?.depts && course?.depts?.length > 0 && (
|
{course?.depts && course?.depts?.length > 0 && (
|
||||||
|
|
|
@ -106,6 +106,9 @@ export function PostDetailProvider({
|
||||||
}
|
}
|
||||||
}, [selectedLectureId, editId]);
|
}, [selectedLectureId, editId]);
|
||||||
const [isHeaderVisible, setIsHeaderVisible] = useState(true); // 新增
|
const [isHeaderVisible, setIsHeaderVisible] = useState(true); // 新增
|
||||||
|
useEffect(() => {
|
||||||
|
console.log("post", post);
|
||||||
|
}, [post]);
|
||||||
return (
|
return (
|
||||||
<CourseDetailContext.Provider
|
<CourseDetailContext.Provider
|
||||||
value={{
|
value={{
|
||||||
|
|
|
@ -150,7 +150,10 @@ export const VideoDisplay: React.FC<VideoDisplayProps> = ({
|
||||||
// 事件处理
|
// 事件处理
|
||||||
const handlePlay = () => setIsPlaying(true);
|
const handlePlay = () => setIsPlaying(true);
|
||||||
const handlePause = () => setIsPlaying(false);
|
const handlePause = () => setIsPlaying(false);
|
||||||
const handleEnded = () => setIsPlaying(false);
|
const handleEnded = () => {
|
||||||
|
console.log("ended")
|
||||||
|
setIsPlaying(false)
|
||||||
|
};
|
||||||
const handleWaiting = () => setBufferingState(true);
|
const handleWaiting = () => setBufferingState(true);
|
||||||
const handlePlaying = () => setBufferingState(false);
|
const handlePlaying = () => setBufferingState(false);
|
||||||
const handleLoadedMetadata = () => {
|
const handleLoadedMetadata = () => {
|
||||||
|
|
Loading…
Reference in New Issue