|
@@ -1,17 +1,7 @@
|
|
|
-import {
|
|
|
- PlusOutlined,
|
|
|
-} from "@ant-design/icons";
|
|
|
-import {
|
|
|
- ProConfigProvider,
|
|
|
- ProLayout,
|
|
|
-} from "@ant-design/pro-components";
|
|
|
+import { PlusOutlined } from "@ant-design/icons";
|
|
|
+import { ProConfigProvider, ProLayout } from "@ant-design/pro-components";
|
|
|
import { css } from "@emotion/css";
|
|
|
-import {
|
|
|
- Space,
|
|
|
- Button,
|
|
|
- ConfigProvider,
|
|
|
- Popover,
|
|
|
-} from "antd";
|
|
|
+import { Space, Button, ConfigProvider, Popover } from "antd";
|
|
|
import React, { useMemo, useRef, useState } from "react";
|
|
|
import { Icon } from "umi";
|
|
|
import { createNew } from "@/utils";
|
|
@@ -22,13 +12,13 @@ import Template from "./Template";
|
|
|
import { GraphType } from "@/enum";
|
|
|
|
|
|
export default () => {
|
|
|
- const currentFolder = useRef('root');
|
|
|
+ const currentFolder = useRef("root");
|
|
|
const [updateKey, setUpdateKey] = useState(0);
|
|
|
|
|
|
const handleCreate = async (type: GraphType) => {
|
|
|
await createNew(type, currentFolder.current);
|
|
|
setUpdateKey(updateKey + 1);
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
const basicGraph = [
|
|
|
{
|
|
@@ -48,7 +38,7 @@ export default () => {
|
|
|
onClick: () => handleCreate(GraphType.mindmap),
|
|
|
},
|
|
|
];
|
|
|
-
|
|
|
+
|
|
|
const appList = [
|
|
|
{
|
|
|
id: "1",
|
|
@@ -87,12 +77,12 @@ export default () => {
|
|
|
onClick: () => handleCreate(GraphType.net),
|
|
|
},
|
|
|
];
|
|
|
-
|
|
|
+
|
|
|
const handleMenuClick = (item: any) => {
|
|
|
console.log("click", item);
|
|
|
item?.onClick?.();
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
const renderBasicItem = (props: {
|
|
|
title: string;
|
|
|
subtitle: string;
|
|
@@ -127,7 +117,7 @@ export default () => {
|
|
|
</div>
|
|
|
);
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
const renderProItem = (props: {
|
|
|
id: string;
|
|
|
title: string;
|
|
@@ -144,7 +134,7 @@ export default () => {
|
|
|
</div>
|
|
|
);
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
const RenderAppList = () => {
|
|
|
return (
|
|
|
<div className="w-460px">
|
|
@@ -158,7 +148,7 @@ export default () => {
|
|
|
|
|
|
const handleChangeFolder = (id: string) => {
|
|
|
currentFolder.current = id;
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
const [pathname, setPathname] = useState("/all");
|
|
|
const routes = [
|
|
@@ -166,7 +156,9 @@ export default () => {
|
|
|
path: "/all",
|
|
|
name: "全部",
|
|
|
icon: <i className="iconfont icon-xitong" />,
|
|
|
- component: <All onChangeCurrentFolder={ handleChangeFolder } updateKey={updateKey} />,
|
|
|
+ component: (
|
|
|
+ <All onChangeCurrentFolder={handleChangeFolder} updateKey={updateKey} />
|
|
|
+ ),
|
|
|
},
|
|
|
{
|
|
|
path: "/recently",
|
|
@@ -205,47 +197,49 @@ export default () => {
|
|
|
headerTitleRender={() => null}
|
|
|
logo={false}
|
|
|
title={"系统设计"}
|
|
|
- collapsedButtonRender={() => <></>}
|
|
|
location={{ pathname }}
|
|
|
route={{
|
|
|
routes,
|
|
|
}}
|
|
|
bgLayoutImgList={[
|
|
|
{
|
|
|
- src: 'https://img.alicdn.com/imgextra/i2/O1CN01O4etvp1DvpFLKfuWq_!!6000000000279-2-tps-609-606.png',
|
|
|
+ src: "https://img.alicdn.com/imgextra/i2/O1CN01O4etvp1DvpFLKfuWq_!!6000000000279-2-tps-609-606.png",
|
|
|
left: 85,
|
|
|
bottom: 100,
|
|
|
- height: '303px',
|
|
|
+ height: "303px",
|
|
|
},
|
|
|
{
|
|
|
- src: 'https://img.alicdn.com/imgextra/i2/O1CN01O4etvp1DvpFLKfuWq_!!6000000000279-2-tps-609-606.png',
|
|
|
+ src: "https://img.alicdn.com/imgextra/i2/O1CN01O4etvp1DvpFLKfuWq_!!6000000000279-2-tps-609-606.png",
|
|
|
bottom: -68,
|
|
|
right: -45,
|
|
|
- height: '303px',
|
|
|
+ height: "303px",
|
|
|
},
|
|
|
{
|
|
|
- src: 'https://img.alicdn.com/imgextra/i3/O1CN018NxReL1shX85Yz6Cx_!!6000000005798-2-tps-884-496.png',
|
|
|
+ src: "https://img.alicdn.com/imgextra/i3/O1CN018NxReL1shX85Yz6Cx_!!6000000005798-2-tps-884-496.png",
|
|
|
bottom: 0,
|
|
|
left: 0,
|
|
|
- width: '331px',
|
|
|
+ width: "331px",
|
|
|
},
|
|
|
]}
|
|
|
- menuHeaderRender={(logo, title) => {
|
|
|
+ menuHeaderRender={(logo, title, props) => {
|
|
|
return (
|
|
|
<div className="flex-1">
|
|
|
- <div className="flex items-center h-20px">
|
|
|
- <span className="mr-8px">{logo}</span>
|
|
|
- {title}
|
|
|
- </div>
|
|
|
- <div className="mt-32px">
|
|
|
+ { !props?.collapsed && (
|
|
|
+ <div className="flex items-center justify-center h-20px">
|
|
|
+ {title}
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ <div style={{ marginTop: props?.collapsed ? 0 : 12}}>
|
|
|
<Popover key="1" placement="left" content={<RenderAppList />}>
|
|
|
<Button
|
|
|
type="primary"
|
|
|
- className="w-full"
|
|
|
+ style={{
|
|
|
+ width: props?.collapsed ? "50px" : "100%",
|
|
|
+ }}
|
|
|
onClick={() => {}}
|
|
|
icon={<PlusOutlined />}
|
|
|
>
|
|
|
- 新建
|
|
|
+ {props?.collapsed ? "" : "新建"}
|
|
|
</Button>
|
|
|
</Popover>
|
|
|
</div>
|