@@ -272,18 +336,19 @@ const MainHome: React.FC = () => {
color: "coral",
fontWeight: "bolder",
}}>
- {2}
+ {storageCount}
}
/个
-
-
+
+
+ {
+ navigate("/main/setting")
+ }} className={styles.home_content_icon}/>
+
@@ -323,18 +388,19 @@ const MainHome: React.FC = () => {
color: "lightblue",
fontWeight: "bolder",
}}>
- {2}
+ {bucketCount}
}
/个
-
-
+
+
+ {
+ navigate("/main/bucket")
+ }} className={styles.home_content_icon}/>
+
@@ -365,27 +431,40 @@ const MainHome: React.FC = () => {
文件
+
+
-
- {
-
- {2}
-
- }
- /个
+
+ {" "}
+
+
+ {uploadFile}
+
+
+
+
+ {" "}
+
+
+ {downloadFile}
-
-
-
@@ -413,30 +492,43 @@ const MainHome: React.FC = () => {
fontWeight: "bolder",
}}>
{" "}
- 总量
-
-
-
-
- {
-
- {2}
-
- }
- /M
+ 流量
-
-
+
+
+
+ {" "}
+
+
+ {uploadFlow}
+
+
+
+
+ {" "}
+
+
+ {downloadFlow}
+
+
@@ -445,7 +537,7 @@ const MainHome: React.FC = () => {
{
}}
title={"文件上传热力图"}>
{
+ if(value!==null) {
+ message.open({
+
+ content: (<>
+
+
+ 日期:{value.date}
+
+
+ 数量:{value.count}
+
+
+ >),
+ type:"success",
+ duration: 2,
+ }).then();
+ }
+
+ }}
monthLabels={[
"一月",
"二月",
@@ -499,101 +611,107 @@ const MainHome: React.FC = () => {
"周六",
]}
gutterSize={3}
- values={
- [
- { date: "2024-01-02", count: 12 },
- { date: "2024-05-3", count: 122 },
- { date: "2024-06-30", count: 38 },
- ] as any
- }>
+ values={fileHeatmap}>
-
+ {
- console.log(key, record, originRow);
- return true;
- },
- }}
- onDataSourceChange={setDataSource}
+ dataSource={recentUploadFile}
metas={{
title: {
- dataIndex: "name",
+ dataIndex: "fileName",
},
avatar: {
- dataIndex: "image",
- editable: false,
+ render: (text: any,record: any) => {
+ if(record.fileName) {
+ return (<>
+
+ >)
+ }else {
+ return (<>
+
+ >)
+ }
+
+ }
},
description: {
- dataIndex: "desc",
- },
- subTitle: {
- render: () => {
- return (
-
- Ant Design
- TechUI
-
- );
- },
+ dataIndex: "size",
+ valueType: "text"
},
+ content: {
+ dataIndex: "time"
+ }
}}
/>
-
+ {
- console.log(key, record, originRow);
- return true;
- },
- }}
- onDataSourceChange={setDataSource}
+ dataSource={recentPreviewFile}
metas={{
title: {
- dataIndex: "name",
+ dataIndex: "fileName",
},
avatar: {
- dataIndex: "image",
- editable: false,
+ render: (text: any,record: any) => {
+ if(record.fileName) {
+ return (<>
+
+ >)
+ }else {
+ return (<>
+
+ >)
+ }
+
+ }
},
description: {
- dataIndex: "desc",
- },
- subTitle: {
- render: () => {
- return (
-
- Ant Design
- TechUI
-
- );
- },
+ dataIndex: "size",
+ valueType: "text",
},
+ content: {
+ dataIndex: "time"
+ }
}}
/>
@@ -603,4 +721,4 @@ const MainHome: React.FC = () => {
>
);
};
-export default MainHome;
+export default memo(MainHome);
diff --git a/src/components/Main/Settings/components/AliSettings.tsx b/src/components/Main/Settings/components/AliSettings.tsx
index c278024..93cc816 100644
--- a/src/components/Main/Settings/components/AliSettings.tsx
+++ b/src/components/Main/Settings/components/AliSettings.tsx
@@ -3,7 +3,8 @@ import { PlusOutlined } from "@ant-design/icons";
import type { ActionType, ProColumns } from "@ant-design/pro-components";
import { ProTable, TableDropdown } from "@ant-design/pro-components";
import { Button, Col, Drawer, Form, Input, Row, Space } from "antd";
-import React, { useRef, useState } from "react";
+import React, { useEffect, useRef, useState } from "react";
+import { getAllAliOSSConfig } from "@/api/oss/ali";
type AliOssConfigItem = {
id: number;
@@ -12,21 +13,9 @@ type AliOssConfigItem = {
accessKeyId: string;
accessKeySecret: string;
createdTime: string;
- updatedTime: string;
+ updateTime: string;
status: string;
};
-const data: AliOssConfigItem[] = [
- {
- id: 1,
- userId: 1,
- endpoint: "https://oss.aliyuncs.com",
- accessKeyId: "LTAI5tG3",
- accessKeySecret: "G3",
- createdTime: "2024-06-28 10:51:59",
- updatedTime: "2024-06-29 10:51:59",
- status: "正常",
- },
-];
const columns: ProColumns[] = [
{
@@ -47,6 +36,7 @@ const columns: ProColumns[] = [
dataIndex: "endpoint",
tooltip: "endpoint",
ellipsis: true,
+ copyable: true,
},
{
disable: true,
@@ -54,6 +44,7 @@ const columns: ProColumns[] = [
dataIndex: "accessKeyId",
tooltip: "access key id",
ellipsis: true,
+ copyable: true,
},
{
disable: true,
@@ -61,12 +52,7 @@ const columns: ProColumns[] = [
dataIndex: "accessKeySecret",
tooltip: "access key secret",
ellipsis: true,
- },
- {
- disable: true,
- title: "状态",
- dataIndex: "status",
- search: true,
+ copyable: true,
},
{
title: "创建时间",
@@ -76,10 +62,16 @@ const columns: ProColumns[] = [
},
{
title: "更新时间",
- dataIndex: "updatedTime",
+ dataIndex: "updateTime",
valueType: "dateTime",
sorter: true,
},
+ {
+ disable: true,
+ title: "状态",
+ dataIndex: "status",
+ search: true,
+ },
{
title: "操作",
valueType: "option",
@@ -112,13 +104,25 @@ const columns: ProColumns[] = [
const AliSettings: React.FC = () => {
const actionRef = useRef();
const [open, setOpen] = useState(false);
+ const [configs, setConfigs] = useState([]);
+
+ async function getAllConfig() {
+ getAllAliOSSConfig(1).then((res) => {
+ console.log(res);
+ if (res && res.success && res.data) {
+ setConfigs(res.data);
+ }
+ });
+ }
const showDrawer = () => {
setOpen(true);
};
-
const onClose = () => {
setOpen(false);
};
+ useEffect(() => {
+ getAllConfig();
+ }, []);
const AddAliOssConfigDrawer = () => {
return (
<>
@@ -179,7 +183,7 @@ const AliSettings: React.FC = () => {
columns={columns}
- dataSource={data}
+ dataSource={configs}
actionRef={actionRef}
cardBordered={true}
editable={{
diff --git a/src/components/Main/Settings/components/MinioSettings.tsx b/src/components/Main/Settings/components/MinioSettings.tsx
index 2f09912..44ba67c 100644
--- a/src/components/Main/Settings/components/MinioSettings.tsx
+++ b/src/components/Main/Settings/components/MinioSettings.tsx
@@ -3,7 +3,8 @@ import { PlusOutlined } from "@ant-design/icons";
import type { ActionType, ProColumns } from "@ant-design/pro-components";
import { ProTable, TableDropdown } from "@ant-design/pro-components";
import { Button, Col, Drawer, Form, Input, Row, Space } from "antd";
-import React, { ReactNode, useRef, useState } from "react";
+import React, { ReactNode, useEffect, useRef, useState } from "react";
+import { getAllMinioConfig } from "@/api/oss/minio";
type MinioOssConfigItem = {
id: number;
@@ -12,21 +13,9 @@ type MinioOssConfigItem = {
accessKey: string;
secretKey: string;
createdTime: string;
- updatedTime: string;
+ updateTime: string;
status: string;
};
-const data: MinioOssConfigItem[] = [
- {
- id: 1,
- userId: 1,
- endpoint: "https://oss.aliyuncs.com",
- accessKey: "LTAI5tG3",
- secretKey: "G3",
- createdTime: "2022-01-01",
- updatedTime: "2022-01-01",
- status: "正常",
- },
-];
const columns: ProColumns[] = [
{
@@ -46,6 +35,7 @@ const columns: ProColumns[] = [
title: "服务地址",
dataIndex: "endpoint",
tooltip: "endpoint",
+ copyable: true,
ellipsis: true,
},
{
@@ -54,6 +44,7 @@ const columns: ProColumns[] = [
dataIndex: "accessKey",
tooltip: "access key",
ellipsis: true,
+ copyable: true,
},
{
disable: true,
@@ -61,6 +52,7 @@ const columns: ProColumns[] = [
dataIndex: "secretKey",
tooltip: "secret key",
ellipsis: true,
+ copyable: true,
},
{
disable: true,
@@ -77,7 +69,7 @@ const columns: ProColumns[] = [
},
{
title: "更新时间",
- dataIndex: "updatedTime",
+ dataIndex: "updateTime",
valueType: "dateTime",
sorter: true,
},
@@ -113,6 +105,7 @@ const columns: ProColumns[] = [
const MinioSettings: React.FC = () => {
const actionRef = useRef();
const [open, setOpen] = useState(false);
+ const [configs, setConfigs] = useState([]);
const showDrawer = () => {
setOpen(true);
};
@@ -120,6 +113,18 @@ const MinioSettings: React.FC = () => {
const onClose = () => {
setOpen(false);
};
+
+ async function getAllConfig() {
+ getAllMinioConfig(1).then((res: any) => {
+ if (res && res.success && res.data) {
+ setConfigs(res.data);
+ }
+ });
+ }
+
+ useEffect(() => {
+ getAllConfig().then();
+ }, []);
const AddMinioOssConfigDrawer = () => {
return (
<>
@@ -180,7 +185,7 @@ const MinioSettings: React.FC = () => {
columns={columns}
- dataSource={data}
+ dataSource={configs}
actionRef={actionRef}
cardBordered={true}
editable={{
diff --git a/src/components/Main/Settings/components/QiniuSettings.tsx b/src/components/Main/Settings/components/QiniuSettings.tsx
index b63e9f6..9d18b17 100644
--- a/src/components/Main/Settings/components/QiniuSettings.tsx
+++ b/src/components/Main/Settings/components/QiniuSettings.tsx
@@ -3,7 +3,8 @@ import { PlusOutlined } from "@ant-design/icons";
import type { ActionType, ProColumns } from "@ant-design/pro-components";
import { ProTable, TableDropdown } from "@ant-design/pro-components";
import { Button, Col, Drawer, Form, Input, Row, Space } from "antd";
-import React, { ReactNode, useRef, useState } from "react";
+import React, { ReactNode, useEffect, useRef, useState } from "react";
+import { getAllQiniuConfigs } from "@/api/oss/qiniu";
type QiniuOssConfigItem = {
id: number;
@@ -12,21 +13,9 @@ type QiniuOssConfigItem = {
accessKey: string;
secretKey: string;
createdTime: string;
- updatedTime: string;
+ updateTime: string;
status: string;
};
-const data: QiniuOssConfigItem[] = [
- {
- id: 1,
- userId: 1,
- bucketName: "https://oss.aliyuncs.com",
- accessKey: "LTAI5tG3",
- secretKey: "G3",
- createdTime: "2022-01-01",
- updatedTime: "2022-01-01",
- status: "正常",
- },
-];
const columns: ProColumns[] = [
{
@@ -46,20 +35,23 @@ const columns: ProColumns[] = [
title: "服务地址",
dataIndex: "endpoint",
tooltip: "endpoint",
+ copyable: true,
ellipsis: true,
},
{
disable: true,
title: "密钥ID",
- dataIndex: "accessKeyId",
+ dataIndex: "accessKey",
tooltip: "access key id",
+ copyable: true,
ellipsis: true,
},
{
disable: true,
title: "密钥值",
- dataIndex: "accessKeySecret",
+ dataIndex: "secretKey",
tooltip: "access key secret",
+ copyable: true,
ellipsis: true,
},
{
@@ -77,7 +69,7 @@ const columns: ProColumns[] = [
},
{
title: "更新时间",
- dataIndex: "updatedTime",
+ dataIndex: "updateTime",
valueType: "dateTime",
sorter: true,
},
@@ -113,6 +105,7 @@ const columns: ProColumns[] = [
const QiniuSettings: React.FC = () => {
const actionRef = useRef();
const [open, setOpen] = useState(false);
+ const [config, setConfig] = useState([]);
const showDrawer = () => {
setOpen(true);
};
@@ -120,6 +113,17 @@ const QiniuSettings: React.FC = () => {
const onClose = () => {
setOpen(false);
};
+ async function getAllCOnfigs() {
+ getAllQiniuConfigs(1).then((res: any) => {
+ if (res && res.success && res.data) {
+ setConfig(res.data);
+ }
+ });
+ }
+
+ useEffect(() => {
+ getAllCOnfigs().then();
+ }, []);
const AddQiniuOssConfigDrawer = () => {
return (
<>
@@ -180,7 +184,7 @@ const QiniuSettings: React.FC = () => {
columns={columns}
- dataSource={data}
+ dataSource={config}
actionRef={actionRef}
cardBordered={true}
editable={{
diff --git a/src/components/Main/Settings/components/TencentSettings.tsx b/src/components/Main/Settings/components/TencentSettings.tsx
index d401523..3807ba7 100644
--- a/src/components/Main/Settings/components/TencentSettings.tsx
+++ b/src/components/Main/Settings/components/TencentSettings.tsx
@@ -3,30 +3,18 @@ import { PlusOutlined } from "@ant-design/icons";
import type { ActionType, ProColumns } from "@ant-design/pro-components";
import { ProTable, TableDropdown } from "@ant-design/pro-components";
import { Button, Col, Drawer, Form, Input, Row, Space } from "antd";
-import React, { ReactNode, useRef, useState } from "react";
+import React, { ReactNode, useEffect, useRef, useState } from "react";
+import { getAllTencentOSsConfig } from "@/api/oss/tencent";
type TencentOssConfigItem = {
id: number;
userId: number;
- bucketName: string;
secretId: string;
secretKey: string;
createdTime: string;
- updatedTime: string;
+ updateTime: string;
status: string;
};
-const data: TencentOssConfigItem[] = [
- {
- id: 1,
- userId: 1,
- bucketName: "https://oss.aliyuncs.com",
- secretId: "LTAI5tG3",
- secretKey: "G3",
- createdTime: "2022-01-01",
- updatedTime: "2022-01-01",
- status: "正常",
- },
-];
const columns: ProColumns[] = [
{
@@ -41,17 +29,11 @@ const columns: ProColumns[] = [
ellipsis: true,
tooltip: "Id",
},
- {
- disable: true,
- title: "存储桶",
- dataIndex: "bucketName",
- tooltip: "bucketName",
- ellipsis: true,
- },
{
disable: true,
title: "密钥ID",
dataIndex: "secretId",
+ copyable: true,
tooltip: "secret Id",
ellipsis: true,
},
@@ -60,6 +42,7 @@ const columns: ProColumns[] = [
title: "密钥值",
dataIndex: "secretKey",
tooltip: "secret Key",
+ copyable: true,
ellipsis: true,
},
{
@@ -77,7 +60,7 @@ const columns: ProColumns[] = [
},
{
title: "更新时间",
- dataIndex: "updatedTime",
+ dataIndex: "updateTime",
valueType: "dateTime",
sorter: true,
},
@@ -113,6 +96,7 @@ const columns: ProColumns[] = [
const TencentSettings: React.FC = () => {
const actionRef = useRef();
const [open, setOpen] = useState(false);
+ const [configs, setConfigs] = useState([]);
const showDrawer = () => {
setOpen(true);
};
@@ -120,6 +104,17 @@ const TencentSettings: React.FC = () => {
const onClose = () => {
setOpen(false);
};
+ async function getAllConfigs() {
+ getAllTencentOSsConfig(5).then((res: any) => {
+ if (res && res.success && res.data) {
+ setConfigs(res.data);
+ }
+ });
+ }
+
+ useEffect(() => {
+ getAllConfigs().then();
+ }, []);
const AddTencentOssConfigDrawer = () => {
return (
<>
@@ -170,7 +165,7 @@ const TencentSettings: React.FC = () => {
columns={columns}
- dataSource={data}
+ dataSource={configs}
actionRef={actionRef}
cardBordered={true}
editable={{
diff --git a/src/components/Main/Settings/settings.ts b/src/components/Main/Settings/settings.ts
index cb0be71..9e2c2b0 100644
--- a/src/components/Main/Settings/settings.ts
+++ b/src/components/Main/Settings/settings.ts
@@ -8,53 +8,53 @@ const selectOptions = [
name: "腾讯云COS",
value: "tencent",
},
- {
- name: "华为云OBS",
- value: "huawei",
- },
- {
- name: "百度云BOS",
- value: "baidu",
- },
+ // {
+ // name: "华为云OBS",
+ // value: "huawei",
+ // },
+ // {
+ // name: "百度云BOS",
+ // value: "baidu",
+ // },
{
name: "MinIO",
value: "minio",
},
- {
- name: "京东云OSS",
- value: "jd",
- },
- {
- name: "亚马逊S3",
- value: "aws",
- },
- {
- name: "网易数帆NOS",
- value: "wangyi",
- },
+ // {
+ // name: "京东云OSS",
+ // value: "jd",
+ // },
+ // {
+ // name: "亚马逊S3",
+ // value: "aws",
+ // },
+ // {
+ // name: "网易数帆NOS",
+ // value: "wangyi",
+ // },
{
name: "七牛云Kodo",
value: "qiniu",
},
- {
- name: "又拍云USS",
- value: "up",
- },
- {
- name: "平安云OSS",
- value: "pinan",
- },
- {
- name: "青云QingCloud",
- value: "qingyun",
- },
- {
- name: "UCloud US3",
- value: "ucloud",
- },
- {
- name: "金山云OBS",
- value: "jinshan",
- },
+ // {
+ // name: "又拍云USS",
+ // value: "up",
+ // },
+ // {
+ // name: "平安云OSS",
+ // value: "pinan",
+ // },
+ // {
+ // name: "青云QingCloud",
+ // value: "qingyun",
+ // },
+ // {
+ // name: "UCloud US3",
+ // value: "ucloud",
+ // },
+ // {
+ // name: "金山云OBS",
+ // value: "jinshan",
+ // },
];
export default selectOptions;
diff --git a/src/components/Main/Share/components/ShareAdd/ShareAdd.tsx b/src/components/Main/Share/components/ShareAdd/ShareAdd.tsx
index aafacc1..6f36243 100644
--- a/src/components/Main/Share/components/ShareAdd/ShareAdd.tsx
+++ b/src/components/Main/Share/components/ShareAdd/ShareAdd.tsx
@@ -29,6 +29,15 @@ const ShareAdd: React.FunctionComponent = () => {
enable: true,
items: ["ai", "Bold", "Italic", "Underline", "Strike", "code", "comment"],
},
+ ai: {
+ models: {
+ wenxin: {
+ access_token: "****",
+ protocol: "ws",
+ version: "v3.5",
+ },
+ },
+ },
onChange: async (value: any) => {
fromRef.current.setFieldsValue({
content: value.getHtml(),
diff --git a/src/components/Main/Share/components/ShareList/ShareList.tsx b/src/components/Main/Share/components/ShareList/ShareList.tsx
index 69ca4ee..12456aa 100644
--- a/src/components/Main/Share/components/ShareList/ShareList.tsx
+++ b/src/components/Main/Share/components/ShareList/ShareList.tsx
@@ -128,7 +128,7 @@ export default () => {
vertical={false}
align={"center"}
justify={"space-between"}
- style={{ width: "25%" }}>
+ style={{ width: "300px" }}>
{
const navigate = useNavigate();
const [open, setOpen] = useState(false);
- // const showDrawer = () => {
- // setOpen(true);
- // };
const onClose = () => {
setOpen(false);
diff --git a/src/components/Main/User/UserInfo/index.tsx b/src/components/Main/User/UserInfo/index.tsx
index 607c9f2..edfd402 100644
--- a/src/components/Main/User/UserInfo/index.tsx
+++ b/src/components/Main/User/UserInfo/index.tsx
@@ -1,125 +1,163 @@
-/** @format */
-import { FunctionComponent, useEffect, useState } from "react";
-import { Avatar, Card, Empty, List, Skeleton } from "antd";
-import {
- AntDesignOutlined,
- BankOutlined,
- BulbOutlined,
- EnvironmentOutlined,
-} from "@ant-design/icons";
-import styles from "./index.module.less";
-import { ProCard } from "@ant-design/pro-components";
-import Meta from "antd/es/card/Meta";
-import gitee from "@/assets/icons/gitee.svg";
-import { Link } from "react-router-dom";
-
-const UserInfo: FunctionComponent = () => {
- const [loading, setLoading] = useState(true);
- const data = [
- {
- title: "Ant Design Title 1",
- },
- {
- title: "Ant Design Title 2",
- },
- {
- title: "Ant Design Title 3",
- },
- {
- title: "Ant Design Title 4",
- },
- ];
- useEffect(() => {
- setTimeout(() => {
- setLoading(false);
- }, 2000);
- }, []);
- return (
- <>
-
-
-
}
- />
-
用户名
-
-
- 前端架构师
-
-
- 成都
-
-
- 成都市上城
-
-
-
-
-
-
查看更多}>
-
-
- }
- title="Card title"
- description="This is the description"
- />
-
-
-
-
-
-
-
-
- }
- title="Card title"
- description="This is the description"
- />
-
-
-
-
-
-
查看更多}>
-
- (
-
-
- }
- title={{item.title}}
- description="Ant Design, a design language for background applications, is refined by Ant UED Team"
- />
-
- )}
- />
-
-
-
-
-
-
- >
- );
-};
-export default UserInfo;
+/** @format */
+import { FunctionComponent, useEffect, useState } from "react";
+import { Avatar, Card, Empty, Flex, List, Skeleton } from "antd";
+import {
+ AntDesignOutlined,
+ BankOutlined,
+ BulbOutlined,
+ EnvironmentOutlined,
+} from "@ant-design/icons";
+import styles from "./index.module.less";
+import { ProCard } from "@ant-design/pro-components";
+import Meta from "antd/es/card/Meta";
+import gitee from "@/assets/icons/gitee.svg";
+import { Link, useNavigate } from "react-router-dom";
+import { getAllStorage } from "@/api/oss";
+import StorageIcon from "@/constant/stroage-icon.ts";
+import { getUserInfoApi } from "@/api/user";
+
+const UserInfo: FunctionComponent = () => {
+ const navigate = useNavigate();
+ const [loading, setLoading] = useState(true);
+ const [userStorage, setUserStorage] = useState([]);
+ const [userInfo, setUserInfo] = useState({} as any);
+ const data = [
+ {
+ title: "Ant Design Title 1",
+ },
+ {
+ title: "Ant Design Title 2",
+ },
+ {
+ title: "Ant Design Title 3",
+ },
+ {
+ title: "Ant Design Title 4",
+ },
+ ];
+ async function getUserStorage() {
+ const res = await getAllStorage("1");
+ if (res.success) {
+ setUserStorage(res.data);
+ setLoading(false);
+ }
+ }
+ const getUserInfo = async () => {
+ const res = await getUserInfoApi("9");
+ if (res.success) {
+ setUserInfo(res.data);
+ }
+ };
+ useEffect(() => {
+ getUserInfo().then();
+ getUserStorage().then();
+ }, []);
+ return (
+ <>
+
+
+
}
+ />
+
用户名
+
+
+ 前端架构师
+
+
+ 成都
+
+
+ 成都市上城
+
+
+
+
+
+
查看更多}>
+
+
+ {userStorage.map((item: any, index: number) => {
+ return (
+ <>
+ {
+ navigate(`/main/setting/${item.ossType}`);
+ }}
+ style={{ width: 350, marginTop: 16, marginLeft: 10 }}
+ hoverable={true}>
+ }
+ title={item.name}
+ description={
+ <>
+ 配置:{item.configCount}
+
+ 存储桶: {item.bucketCount}
+
+ >
+ }>
+
+ >
+ );
+ })}
+
+
+
+
+
+
+
+
+ }
+ title="Card title"
+ description="This is the description"
+ />
+
+
+
+
+
+
查看更多}>
+
+ (
+
+
+ }
+ title={{item.title}}
+ description="Ant Design, a design language for background applications, is refined by Ant UED Team"
+ />
+
+ )}
+ />
+
+
+
+
+
+
+ >
+ );
+};
+export default UserInfo;
diff --git a/src/store/modules/file.ts b/src/store/modules/file.ts
index e4d8b3c..0344822 100644
--- a/src/store/modules/file.ts
+++ b/src/store/modules/file.ts
@@ -5,7 +5,7 @@ import { isHydrated, makePersistable } from "mobx-persist-store";
import { handleLocalforage } from "@/utils/localforage";
export class useFileStore {
- filePath: [any] = ["/root"];
+ filePath: [any] = [];
constructor() {
makeObservable(this, {
@@ -14,6 +14,8 @@ export class useFileStore {
getFilePath: action,
clearFilePath: action,
getFilePathSecondLast: action,
+ getMiddlePath: action,
+ clearAllFilePath: action,
isHydrated: action,
});
makePersistable(
@@ -54,10 +56,21 @@ export class useFileStore {
}
this.filePath.pop();
}
+ // 清空所有文件路径
+ clearAllFilePath() {
+ this.filePath.splice(0);
+ }
// 获取文件路径倒数第二个
getFilePathSecondLast() {
return this.filePath.slice(0, -1).pop();
}
+ // 获取文件路径中间路径
+ getMiddlePath() {
+ if (this.filePath.length <= 2) {
+ return " ";
+ }
+ return this.filePath.slice(1, this.filePath.length - 1).join("/");
+ }
isHydrated() {
return isHydrated(this);
diff --git a/src/views/Main/index.tsx b/src/views/Main/index.tsx
index 0d7c582..3cb2e71 100644
--- a/src/views/Main/index.tsx
+++ b/src/views/Main/index.tsx
@@ -6,7 +6,13 @@ import {
LogoutOutlined,
QuestionCircleFilled,
} from "@ant-design/icons";
-import { DefaultFooter, PageContainer, ProCard, ProLayout } from "@ant-design/pro-components";
+import {
+ DefaultFooter,
+ PageContainer,
+ ProCard,
+ ProLayout,
+ SettingDrawer,
+} from "@ant-design/pro-components";
import { Link, Outlet, useLocation } from "react-router-dom";
import logo from "@/assets/images/logo.png";
import { Suspense } from "react";