02272209
This commit is contained in:
parent
1dd03e5b99
commit
a3284f4532
|
@ -14,7 +14,7 @@ export default function FilterSection() {
|
|||
});
|
||||
};
|
||||
return (
|
||||
<div className=" flex z-0 p-6 flex-col rounded-lg mt-4 space-y-6 h-[820px] overscroll-contain overflow-x-hidden">
|
||||
<div className=" flex z-0 p-6 flex-col mt-4 space-y-6 overscroll-contain overflow-x-hidden">
|
||||
{showSearchMode && <SearchModeRadio></SearchModeRadio>}
|
||||
{taxonomies?.map((tax, index) => {
|
||||
const items = Object.entries(selectedTerms).find(
|
||||
|
|
|
@ -11,14 +11,14 @@ export default function SearchModeRadio() {
|
|||
|
||||
return (
|
||||
<Space direction="vertical" align="start" className="mb-2">
|
||||
<h3 className="text-lg font-medium mb-4">搜索模式</h3>
|
||||
<h3 className="text-lg font-medium mb-4">只搜索</h3>
|
||||
<Radio.Group
|
||||
value={searchMode}
|
||||
onChange={handleModeChange}
|
||||
buttonStyle="solid">
|
||||
<Radio.Button value={PostType.COURSE}>课程</Radio.Button>
|
||||
<Radio.Button value={PostType.PATH}>路径</Radio.Button>
|
||||
<Radio.Button value="both">全部</Radio.Button>
|
||||
<Radio.Button value={PostType.COURSE}>视频课程</Radio.Button>
|
||||
<Radio.Button value={PostType.PATH}>思维导图</Radio.Button>
|
||||
<Radio.Button value="both">所有资源</Radio.Button>
|
||||
</Radio.Group>
|
||||
</Space>
|
||||
);
|
||||
|
|
|
@ -86,7 +86,7 @@ export function MainHeader() {
|
|||
window.location.href = "/path/editor";
|
||||
}}
|
||||
icon={<PlusOutlined></PlusOutlined>}>
|
||||
创建学习路径
|
||||
创建思维导图
|
||||
</Button>
|
||||
)}
|
||||
{isAuthenticated ? (
|
||||
|
|
|
@ -11,8 +11,8 @@ export const NavigationMenu = () => {
|
|||
const menuItems = useMemo(() => {
|
||||
const baseItems = [
|
||||
{ key: "home", path: "/", label: "首页" },
|
||||
{ key: "path", path: "/path", label: "学习路径" },
|
||||
{ key: "courses", path: "/courses", label: "全部课程" },
|
||||
{ key: "path", path: "/path", label: "思维导图" },
|
||||
{ key: "courses", path: "/courses", label: "所有课程" },
|
||||
];
|
||||
|
||||
if (!isAuthenticated) {
|
||||
|
|
|
@ -65,7 +65,7 @@ export default function MindEditor({ id }: { id?: string }) {
|
|||
});
|
||||
const canEdit: boolean = useMemo(() => {
|
||||
//登录了且是作者、超管、无id新建模式
|
||||
const isAuth = isAuthenticated && user?.id == post?.author.id
|
||||
const isAuth = isAuthenticated && user?.id == post?.author.id
|
||||
return !Boolean(id) || isAuth || hasSomePermissions(RolePerms.MANAGE_ANY_POST);
|
||||
}, [user])
|
||||
const navigate = useNavigate();
|
||||
|
@ -96,8 +96,8 @@ export default function MindEditor({ id }: { id?: string }) {
|
|||
const mind = new MindElixir({
|
||||
...MIND_OPTIONS,
|
||||
el: containerRef.current,
|
||||
before:{
|
||||
beginEdit(){
|
||||
before: {
|
||||
beginEdit() {
|
||||
return canEdit
|
||||
}
|
||||
},
|
||||
|
@ -107,7 +107,7 @@ export default function MindEditor({ id }: { id?: string }) {
|
|||
nodeMenu: canEdit, // 禁用节点右键菜单
|
||||
keypress: canEdit, // 禁用键盘快捷键
|
||||
});
|
||||
mind.init(MindElixir.new("新学习路径"));
|
||||
mind.init(MindElixir.new("新思维导图"));
|
||||
containerRef.current.hidden = true;
|
||||
setInstance(mind);
|
||||
}, [canEdit]);
|
||||
|
@ -181,14 +181,14 @@ export default function MindEditor({ id }: { id?: string }) {
|
|||
`mind-thumb-${new Date().toString()}`
|
||||
);
|
||||
};
|
||||
useEffect(()=>{
|
||||
containerRef.current.style.height = `${Math.floor(window.innerHeight/1.25)}px`
|
||||
},[])
|
||||
|
||||
useEffect(() => {
|
||||
containerRef.current.style.height = `${Math.floor(window.innerHeight / 1.25)}px`
|
||||
}, [])
|
||||
|
||||
return (
|
||||
|
||||
|
||||
<div className="grid grid-cols-1 flex-col w-[90vw] my-5 h-[80vh] border rounded-lg mx-auto">
|
||||
|
||||
|
||||
{canEdit && taxonomies && (
|
||||
<Form
|
||||
form={form}
|
||||
|
@ -225,7 +225,7 @@ export default function MindEditor({ id }: { id?: string }) {
|
|||
</div>
|
||||
</Form>
|
||||
)}
|
||||
<div ref={containerRef} className="w-full" onContextMenu={(e)=>e.preventDefault()}/>
|
||||
<div ref={containerRef} className="w-full" onContextMenu={(e) => e.preventDefault()} />
|
||||
{canEdit && instance && <NodeMenu mind={instance} />}
|
||||
{isLoading && (
|
||||
<div
|
||||
|
|
Loading…
Reference in New Issue