feat: update

This commit is contained in:
landaiqing
2024-07-12 11:33:41 +08:00
parent 59cd675028
commit 8677b975db
4 changed files with 310 additions and 180 deletions

View File

@@ -1,56 +1,50 @@
module.exports = { module.exports = {
"env": { "env": {
"browser": true, "browser": true,
"es2021": true, "es2021": true,
"node": true "node": true
}, },
"extends": [ "extends": [
"eslint:recommended", "eslint:recommended",
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
"plugin:react/recommended", "plugin:react/recommended",
"plugin:prettier/recommended" "plugin:prettier/recommended"
], ],
"overrides": [ "overrides": [
{ {
"env": { "env": {
"node": true "node": true
}, },
"files": [ "files": [
".eslintrc.{js,cjs}" ".eslintrc.{js,cjs}"
], ],
"parserOptions": { "parserOptions": {
"sourceType": "script" "sourceType": "script"
} }
} }
], ],
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"parserOptions": { "parserOptions": {
"ecmaVersion": "latest", "ecmaVersion": "latest",
"sourceType": "module" "sourceType": "module"
}, },
"plugins": [ "plugins": [
"@typescript-eslint", "@typescript-eslint",
"react", "react",
"prettier" "prettier"
], ],
"rules": { "rules": {
"react/jsx-use-react": 0, // React V17开始JSX已经不再需要引入React "react/jsx-use-react": 0, // React V17开始JSX已经不再需要引入React
"react/react-in-jsx-scope": 0, // 同上 "react/react-in-jsx-scope": 0, // 同上
"import/first": 0, // 消除绝对路径必须要在相对路径前引入, "import/first": 0, // 消除绝对路径必须要在相对路径前引入,
// 'no-mixed-spaces-and-tabs': 2, // 禁止空格和 tab 的混合缩进 // 'no-mixed-spaces-and-tabs': 2, // 禁止空格和 tab 的混合缩进
"no-debugger": 2, // 禁止有debugger "no-debugger": 2, // 禁止有debugger
"space-infix-ops": 2, // 要求操作符周围有空格 "space-infix-ops": 2, // 要求操作符周围有空格
"space-before-blocks": 2, // 要求语句块之前有空格 "space-before-blocks": 2, // 要求语句块之前有空格
"@typescript-eslint/explicit-function-return-type": 0, // 禁止函数必须要定义返回类型 "@typescript-eslint/explicit-function-return-type": 0, // 禁止函数必须要定义返回类型
"react/display-name": "off", "react/display-name": "off",
"@typescript-eslint/no-explicit-any": ["off"], "@typescript-eslint/no-explicit-any": ["off"],
"@typescript-eslint/no-var-requires": ["off"], "no-control-regex": "off",
"@typescript-eslint/no-use-before-define": ["off"], "no-eval": 0
"@typescript-eslint/no-empty-function": ["off"], }
"@typescript-eslint/no-empty-interface": ["off"], };
"@typescript-eslint/no-unused-vars": ["off"],
"@typescript-eslint/no-non-null-assertion": ["off"],
"no-control-regex": "off",
"no-eval": 0
}
};

View File

@@ -0,0 +1,40 @@
/** @format */
import React from "react";
import { message, Upload } from "antd";
import { InboxOutlined } from "@ant-design/icons";
const { Dragger } = Upload;
const props: any = {
name: "file",
multiple: true,
action: "https://660d2bd96ddfa2943b33731c.mockapi.io/api/upload",
onChange(info) {
const { status } = info.file;
if (status !== "uploading") {
console.log(info.file, info.fileList);
}
if (status === "done") {
message.success(`${info.file.name} file uploaded successfully.`);
} else if (status === "error") {
message.error(`${info.file.name} file upload failed.`);
}
},
onDrop(e) {
console.log("Dropped files", e.dataTransfer.files);
},
};
const FileUpload: React.FC = () => {
return (
<>
<Dragger {...props}>
<p className="ant-upload-drag-icon">
<InboxOutlined />
</p>
<p className="ant-upload-text"></p>
<p className="ant-upload-hint"></p>
</Dragger>
</>
);
};
export default FileUpload;

View File

@@ -11,23 +11,20 @@ import {
Dropdown, Dropdown,
FloatButton, FloatButton,
message, message,
Modal,
Select, Select,
Tooltip, Tooltip,
} from "antd"; } from "antd";
import ali from "@/assets/icons/aliyun.svg"; import ali from "@/assets/icons/aliyun.svg";
import bucket from "@/assets/icons/bucket.svg"; import bucket from "@/assets/icons/bucket.svg";
import tencent from "@/assets/icons/tencent.svg"; import tencent from "@/assets/icons/tencent.svg";
import { import { CloudUploadOutlined, EllipsisOutlined, LeftOutlined } from "@ant-design/icons";
CommentOutlined,
CustomerServiceOutlined,
EllipsisOutlined,
LeftOutlined,
} from "@ant-design/icons";
import standard_dir from "@/assets/icons/standard_directory.svg"; import standard_dir from "@/assets/icons/standard_directory.svg";
import useStore from "@/utils/store/useStore.tsx"; import useStore from "@/utils/store/useStore.tsx";
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import FileIcon from "@/constant/file-icon.ts"; import FileIcon from "@/constant/file-icon.ts";
import file_icon from "@/assets/icons/files/file.svg"; import file_icon from "@/assets/icons/files/file.svg";
import FileUpload from "@/components/Main/File/components/FileUpload.tsx";
const dataList: any = [ const dataList: any = [
{ {
name: "demo01.java", name: "demo01.java",
@@ -86,6 +83,8 @@ const fileList: any = [
const File: FunctionComponent = () => { const File: FunctionComponent = () => {
const store = useStore("file"); const store = useStore("file");
const [files, setFiles] = useState<any>([]); const [files, setFiles] = useState<any>([]);
const [loading, setLoading] = useState<boolean>(true);
const [open, setOpen] = useState<boolean>(false);
async function getFile() { async function getFile() {
setFiles(dataList); setFiles(dataList);
} }
@@ -96,6 +95,9 @@ const File: FunctionComponent = () => {
useEffect(() => { useEffect(() => {
getFile().then(); getFile().then();
setTimeout(() => {
setLoading(false);
}, 2000);
}, []); }, []);
return ( return (
<> <>
@@ -120,7 +122,7 @@ const File: FunctionComponent = () => {
flexDirection: "row", flexDirection: "row",
}} }}
size={"small"}> size={"small"}>
<Avatar src={ali} size={"small"} /> <Avatar src={ali as any} size={"small"} />
<span style={{ marginLeft: "10px", fontWeight: "bolder" }}> <span style={{ marginLeft: "10px", fontWeight: "bolder" }}>
OSS OSS
</span> </span>
@@ -136,7 +138,7 @@ const File: FunctionComponent = () => {
}} }}
bordered={false} bordered={false}
size={"small"}> size={"small"}>
<Avatar src={tencent} size={"small"} />{" "} <Avatar src={tencent as any} size={"small"} />{" "}
<span style={{ marginLeft: "10px", fontWeight: "bolder" }}> <span style={{ marginLeft: "10px", fontWeight: "bolder" }}>
COS COS
</span> </span>
@@ -152,7 +154,7 @@ const File: FunctionComponent = () => {
<CheckCard <CheckCard
style={{ width: "100%" }} style={{ width: "100%" }}
title="schisandra" title="schisandra"
avatar={bucket} avatar={bucket as any}
description="100Mb" description="100Mb"
value="schisandra" value="schisandra"
extra={ extra={
@@ -184,7 +186,7 @@ const File: FunctionComponent = () => {
<CheckCard <CheckCard
style={{ width: "100%" }} style={{ width: "100%" }}
title="schisandra2" title="schisandra2"
avatar={bucket} avatar={bucket as any}
description="100Mb" description="100Mb"
value="schisandra2" value="schisandra2"
extra={ extra={
@@ -274,7 +276,7 @@ const File: FunctionComponent = () => {
alignItems: "center", alignItems: "center",
}}> }}>
<Avatar <Avatar
src={standard_dir} src={standard_dir as any}
shape={"square"} shape={"square"}
size={"large"} size={"large"}
/> />
@@ -379,14 +381,22 @@ const File: FunctionComponent = () => {
</div> </div>
</div> </div>
<FloatButton.Group <FloatButton
trigger="click" trigger="click"
type="primary" type="primary"
style={{ right: "5%" }} style={{ right: "5%" }}
icon={<CustomerServiceOutlined />}> icon={<CloudUploadOutlined />}
<FloatButton /> onClick={() => setOpen(true)}
<FloatButton icon={<CommentOutlined />} /> />
</FloatButton.Group> <Modal
title={<p></p>}
loading={loading}
footer={false}
open={open}
width={"50%"}
onCancel={() => setOpen(false)}>
<FileUpload></FileUpload>
</Modal>
</> </>
); );
}; };

View File

@@ -213,7 +213,7 @@ const MainHome: React.FC = () => {
], ],
}; };
const data = [ const data = [
264, 417, 438, 887, 309, 397, 550, 575, 563, 430, 525, 592, 492, 467, 513, 546 264, 417, 438, 887, 309, 397, 550, 575, 563, 430, 525, 592, 492, 467, 513, 546,
].map((value, index) => ({ value, index })); ].map((value, index) => ({ value, index }));
const config = { const config = {
data, data,
@@ -266,11 +266,24 @@ const MainHome: React.FC = () => {
</Flex> </Flex>
<Flex vertical={false} align={"center"}> <Flex vertical={false} align={"center"}>
<span style={{ fontSize: 15 }}> <span style={{ fontSize: 15 }}>
{<span style={{fontSize: 30,color: "coral",fontWeight: "bolder"}}>{2}</span>}/ {
<span
style={{
fontSize: 30,
color: "coral",
fontWeight: "bolder",
}}>
{2}
</span>
}
/
</span> </span>
</Flex> </Flex>
</Flex> </Flex>
<Flex vertical={false} align={"center"} style={{width: "150px",height: "80px"}}> <Flex
vertical={false}
align={"center"}
style={{ width: "150px", height: "80px" }}>
<Tiny.Area {...config} /> <Tiny.Area {...config} />
</Flex> </Flex>
</Flex> </Flex>
@@ -303,12 +316,25 @@ const MainHome: React.FC = () => {
</span> </span>
</Flex> </Flex>
<Flex vertical={false} align={"center"}> <Flex vertical={false} align={"center"}>
<span style={{ fontSize: 15}}> <span style={{ fontSize: 15 }}>
{<span style={{fontSize: 30,color: "lightblue", fontWeight: "bolder" }}>{2}</span>}/ {
<span
style={{
fontSize: 30,
color: "lightblue",
fontWeight: "bolder",
}}>
{2}
</span>
}
/
</span> </span>
</Flex> </Flex>
</Flex> </Flex>
<Flex vertical={false} align={"center"} style={{width: "10vw",height: "11vh"}}> <Flex
vertical={false}
align={"center"}
style={{ width: "10vw", height: "11vh" }}>
<Tiny.Area {...config} /> <Tiny.Area {...config} />
</Flex> </Flex>
</Flex> </Flex>
@@ -342,11 +368,24 @@ const MainHome: React.FC = () => {
</Flex> </Flex>
<Flex vertical={false} align={"center"}> <Flex vertical={false} align={"center"}>
<span style={{ fontSize: 15 }}> <span style={{ fontSize: 15 }}>
{<span style={{fontSize: 30,color: "orange", fontWeight: "bolder"}}>{2}</span>}/ {
<span
style={{
fontSize: 30,
color: "orange",
fontWeight: "bolder",
}}>
{2}
</span>
}
/
</span> </span>
</Flex> </Flex>
</Flex> </Flex>
<Flex vertical={false} align={"center"} style={{width: "10vw",height: "11vh"}}> <Flex
vertical={false}
align={"center"}
style={{ width: "10vw", height: "11vh" }}>
<Tiny.Area {...config} /> <Tiny.Area {...config} />
</Flex> </Flex>
</Flex> </Flex>
@@ -380,11 +419,24 @@ const MainHome: React.FC = () => {
</Flex> </Flex>
<Flex vertical={false} align={"center"}> <Flex vertical={false} align={"center"}>
<span style={{ fontSize: 15 }}> <span style={{ fontSize: 15 }}>
{<span style={{fontSize: 30,color: "lightgreen", fontWeight: "bolder"}}>{2}</span>}/M {
<span
style={{
fontSize: 30,
color: "lightgreen",
fontWeight: "bolder",
}}>
{2}
</span>
}
/M
</span> </span>
</Flex> </Flex>
</Flex> </Flex>
<Flex vertical={false} align={"center"} style={{width: "10vw",height: "11vh"}}> <Flex
vertical={false}
align={"center"}
style={{ width: "10vw", height: "11vh" }}>
<Tiny.Area {...config} /> <Tiny.Area {...config} />
</Flex> </Flex>
</Flex> </Flex>
@@ -393,7 +445,12 @@ const MainHome: React.FC = () => {
</div> </div>
<div style={{ width: "55%" }}> <div style={{ width: "55%" }}>
<ProCard bordered boxShadow> <ProCard bordered boxShadow>
<Skeleton loading={loading} active> <Skeleton
loading={loading}
active
paragraph={{
rows: 7,
}}>
<ReactECharts option={option} /> <ReactECharts option={option} />
</Skeleton> </Skeleton>
</ProCard> </ProCard>
@@ -407,111 +464,140 @@ const MainHome: React.FC = () => {
marginTop: "30px", marginTop: "30px",
}} }}
title={"文件上传热力图"}> title={"文件上传热力图"}>
<CalendarHeatmap <Skeleton
startDate={new Date("2024-01-01")} loading={loading}
endDate={new Date("2024-12-31")} active
showMonthLabels={true} paragraph={{
horizontal={true} rows: 3,
showWeekdayLabels={false} }}>
monthLabels={[ <CalendarHeatmap
"一月", startDate={new Date("2024-01-01")}
"二月", endDate={new Date("2024-12-31")}
"三月", showMonthLabels={true}
"四月", horizontal={true}
"五月", showWeekdayLabels={false}
"六月", monthLabels={[
"月", "月",
"月", "月",
"月", "月",
"月", "月",
"十一月", "月",
"十二月", "月",
]} "七月",
weekdayLabels={["周日", "周一", "周二", "周三", "周四", "周五", "周六"]} "八月",
gutterSize={3} "九月",
values={ "十月",
[ "十一月",
{ date: "2024-01-02", count: 12 }, "十二月",
{ date: "2024-05-3", count: 122 }, ]}
{ date: "2024-06-30", count: 38 }, weekdayLabels={[
] as any "周日",
}></CalendarHeatmap> "周一",
"周二",
"周三",
"周四",
"周五",
"周六",
]}
gutterSize={3}
values={
[
{ date: "2024-01-02", count: 12 },
{ date: "2024-05-3", count: 122 },
{ date: "2024-06-30", count: 38 },
] as any
}></CalendarHeatmap>
</Skeleton>
</ProCard> </ProCard>
</div> </div>
<div className={styles.home_content_list}> <div className={styles.home_content_list}>
<ProCard bordered boxShadow style={{ width: "49%" }}> <ProCard bordered boxShadow style={{ width: "49%" }}>
<ProList<DataItem> <Skeleton
rowKey="id" loading={loading}
headerTitle="最近上传文件" active
dataSource={dataSource} paragraph={{
showActions="hover" rows: 8,
editable={{ }}>
onSave: async (key, record, originRow) => { <ProList<DataItem>
console.log(key, record, originRow); rowKey="id"
return true; headerTitle="最近上传文件"
}, dataSource={dataSource}
}} showActions="hover"
onDataSourceChange={setDataSource} editable={{
metas={{ onSave: async (key, record, originRow) => {
title: { console.log(key, record, originRow);
dataIndex: "name", return true;
},
avatar: {
dataIndex: "image",
editable: false,
},
description: {
dataIndex: "desc",
},
subTitle: {
render: () => {
return (
<Space size={0}>
<Tag color="blue">Ant Design</Tag>
<Tag color="#5BD8A6">TechUI</Tag>
</Space>
);
}, },
}, }}
}} onDataSourceChange={setDataSource}
/> metas={{
title: {
dataIndex: "name",
},
avatar: {
dataIndex: "image",
editable: false,
},
description: {
dataIndex: "desc",
},
subTitle: {
render: () => {
return (
<Space size={0}>
<Tag color="blue">Ant Design</Tag>
<Tag color="#5BD8A6">TechUI</Tag>
</Space>
);
},
},
}}
/>
</Skeleton>
</ProCard> </ProCard>
<ProCard bordered boxShadow style={{ width: "49%" }}> <ProCard bordered boxShadow style={{ width: "49%" }}>
<ProList<DataItem> <Skeleton
rowKey="id" loading={loading}
headerTitle="最近浏览文件" active
dataSource={dataSource} paragraph={{
showActions="hover" rows: 8,
editable={{ }}>
onSave: async (key, record, originRow) => { <ProList<DataItem>
console.log(key, record, originRow); rowKey="id"
return true; headerTitle="最近浏览文件"
}, dataSource={dataSource}
}} showActions="hover"
onDataSourceChange={setDataSource} editable={{
metas={{ onSave: async (key, record, originRow) => {
title: { console.log(key, record, originRow);
dataIndex: "name", return true;
},
avatar: {
dataIndex: "image",
editable: false,
},
description: {
dataIndex: "desc",
},
subTitle: {
render: () => {
return (
<Space size={0}>
<Tag color="blue">Ant Design</Tag>
<Tag color="#5BD8A6">TechUI</Tag>
</Space>
);
}, },
}, }}
}} onDataSourceChange={setDataSource}
/> metas={{
title: {
dataIndex: "name",
},
avatar: {
dataIndex: "image",
editable: false,
},
description: {
dataIndex: "desc",
},
subTitle: {
render: () => {
return (
<Space size={0}>
<Tag color="blue">Ant Design</Tag>
<Tag color="#5BD8A6">TechUI</Tag>
</Space>
);
},
},
}}
/>
</Skeleton>
</ProCard> </ProCard>
</div> </div>
</div> </div>