Merge branch 'main' of http://113.45.157.195:3003/insiinc/re-mooc
This commit is contained in:
commit
eb7206d987
|
@ -11,7 +11,7 @@ export function MainLayout() {
|
||||||
<MainProvider>
|
<MainProvider>
|
||||||
<div className=" min-h-screen bg-gray-100">
|
<div className=" min-h-screen bg-gray-100">
|
||||||
<MainHeader />
|
<MainHeader />
|
||||||
<Content className="min-h-screen flex-grow pt-12 bg-gray-50 ">
|
<Content className="min-h-screen flex-grow pt-14 bg-gray-50 ">
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</Content>
|
</Content>
|
||||||
<MainFooter />
|
<MainFooter />
|
||||||
|
|
|
@ -24,7 +24,7 @@ const MIND_OPTIONS = {
|
||||||
draggable: true,
|
draggable: true,
|
||||||
contextMenu: true,
|
contextMenu: true,
|
||||||
toolBar: true,
|
toolBar: true,
|
||||||
//nodeMenu: true,
|
nodeMenu: true,
|
||||||
keypress: true,
|
keypress: true,
|
||||||
locale: "zh_CN" as const,
|
locale: "zh_CN" as const,
|
||||||
theme: {
|
theme: {
|
||||||
|
@ -66,8 +66,8 @@ export default function MindEditor({ id }: { id?: string }) {
|
||||||
});
|
});
|
||||||
const canEdit: boolean = useMemo(() => {
|
const canEdit: boolean = useMemo(() => {
|
||||||
//登录了且是作者、超管、无id新建模式
|
//登录了且是作者、超管、无id新建模式
|
||||||
const isAuth = isAuthenticated && user?.id == post?.authorId;
|
const isAuth = isAuthenticated && user?.id == post?.author.id
|
||||||
return !id || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST);
|
return !Boolean(id) || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST);
|
||||||
}, [user])
|
}, [user])
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { create, update } = usePost();
|
const { create, update } = usePost();
|
||||||
|
@ -183,14 +183,11 @@ export default function MindEditor({ id }: { id?: string }) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div className=" flex flex-col w-screen max-h-screen border rounded-lg overflow-hidden">
|
<div className="grid grid-cols-1 flex-col w-[90vw] my-5 h-[90vh] border rounded-lg mx-auto">
|
||||||
{canEdit && taxonomies && (
|
{canEdit && taxonomies && (
|
||||||
<Form
|
<Form
|
||||||
onFinish={(values) => {
|
|
||||||
console.log(values);
|
|
||||||
}}
|
|
||||||
form={form}
|
form={form}
|
||||||
className=" bg-white p-2 ">
|
className=" bg-white p-4 ">
|
||||||
<div className="flex items-center justify-between gap-4">
|
<div className="flex items-center justify-between gap-4">
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
{taxonomies.map((tax, index) => (
|
{taxonomies.map((tax, index) => (
|
||||||
|
@ -217,13 +214,13 @@ export default function MindEditor({ id }: { id?: string }) {
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</div>
|
</div>
|
||||||
<Button ghost type="primary" onClick={handleSave}>
|
<Button ghost type="primary" onSubmit={(e) => e.preventDefault()} onClick={handleSave}>
|
||||||
{id ? "更新" : "保存"}
|
{id ? "更新" : "保存"}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
)}
|
)}
|
||||||
<div ref={containerRef} className="mind-editor min-h-screen" onContextMenu={(e)=>e.preventDefault()} />
|
<div ref={containerRef} className="mind-editor" onContextMenu={(e)=>e.preventDefault()} />
|
||||||
{canEdit && instance && <NodeMenu mind={instance} />}
|
{canEdit && instance && <NodeMenu mind={instance} />}
|
||||||
{isLoading && (
|
{isLoading && (
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -8,7 +8,7 @@ export default function CourseCard({ post }: { post: PostDto }) {
|
||||||
post={post}
|
post={post}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
navigate(`/course/${post?.id}/detail`);
|
navigate(`/course/${post?.id}/detail`);
|
||||||
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||||
}}></PostCard>
|
}}></PostCard>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ export default function PathCard({ post }: { post: PostDto }) {
|
||||||
post={post}
|
post={post}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
navigate(`/path/editor/${post?.id}`);
|
navigate(`/path/editor/${post?.id}`);
|
||||||
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||||
}}></PostCard>
|
}}></PostCard>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,6 +162,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.mind-editor {
|
.mind-editor {
|
||||||
height: calc(100vh - 285px);
|
height: calc(82vh);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
Loading…
Reference in New Issue