diff --git a/src/components/Main/Share/index.tsx b/src/components/Main/Share/index.tsx new file mode 100644 index 0000000..4c4b863 --- /dev/null +++ b/src/components/Main/Share/index.tsx @@ -0,0 +1,7 @@ +/** @format */ +import { FunctionComponent } from "react"; + +const MainShare: FunctionComponent = () => { + return
分享
; +}; +export default MainShare; diff --git a/src/components/Main/User/UserInfo/index.module.less b/src/components/Main/User/UserInfo/index.module.less new file mode 100644 index 0000000..ca9ed85 --- /dev/null +++ b/src/components/Main/User/UserInfo/index.module.less @@ -0,0 +1,38 @@ +.user_info_header { + display: flex; + justify-content: center; + align-items: center; + background-image: url("@/assets/images/background.png") ; + background-size: cover; + border-radius: 10px; + height: 150px; + box-shadow: rgba(15, 15, 16, 0.18) 0px 10px 10px;; +} +.user_info_header_avatar { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; +} +.user_info_header_name { + font-weight: bold; + color: #000000; +} +.user_info_header_desc { + width: 300px; + display: flex; + flex-direction: row; + justify-content: space-between; +} +.user_info_center_content{ + margin-top: 20px; + display: flex; + flex-direction: row; + justify-content: space-between; +} +.user_info_bottom_content { + margin-top: 20px; + display: flex; + flex-direction: row; + justify-content: space-between; +} diff --git a/src/components/Main/User/UserInfo/index.tsx b/src/components/Main/User/UserInfo/index.tsx new file mode 100644 index 0000000..245a30b --- /dev/null +++ b/src/components/Main/User/UserInfo/index.tsx @@ -0,0 +1,112 @@ +/** @format */ +import { FunctionComponent } from "react"; +import { Avatar, Card, Empty, List } 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 data = [ + { + title: "Ant Design Title 1", + }, + { + title: "Ant Design Title 2", + }, + { + title: "Ant Design Title 3", + }, + { + title: "Ant Design Title 4", + }, + ]; + 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; diff --git a/src/components/Main/User/UserSetting/index.module.less b/src/components/Main/User/UserSetting/index.module.less new file mode 100644 index 0000000..125447d --- /dev/null +++ b/src/components/Main/User/UserSetting/index.module.less @@ -0,0 +1,13 @@ +.user_setting_main{ + display: flex; + flex-direction: column; + .user_setting_content{ + margin-top: 20px; + } +} +.user_setting_header{ + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; +} diff --git a/src/components/Main/User/UserSetting/index.tsx b/src/components/Main/User/UserSetting/index.tsx new file mode 100644 index 0000000..d22462b --- /dev/null +++ b/src/components/Main/User/UserSetting/index.tsx @@ -0,0 +1,81 @@ +/** @format */ +import { FunctionComponent } from "react"; +import { ProCard } from "@ant-design/pro-components"; +import { AntDesignOutlined } from "@ant-design/icons"; +import { Avatar, Descriptions, DescriptionsProps, Tabs } from "antd"; +import styles from "./index.module.less"; + +const UserSetting: FunctionComponent = () => { + const items: DescriptionsProps["items"] = [ + { + key: "1", + label: "用户名", + children: "Zhou Maomao", + }, + { + key: "2", + label: "账号ID", + children: "1810000000", + }, + { + key: "3", + label: "注册时间", + children: "Hangzhou, Zhejiang", + }, + { + key: "4", + label: "邮箱", + children: "landaiqing@126.com", + }, + { + key: "5", + label: "手机号", + children: "13333333333333", + }, + ]; + + const TabItems = [ + { + label: 基础信息, + key: "baseInfo", + children: ( +
+ 11111111111111111111111111111111111111111111111111111111111111111111111111111111 +
+ ), + }, + { + label: 安全设置, + key: "security", + }, + ]; + const onChange = (key: string) => { + console.log(key); + }; + return ( + <> +
+ +
+ } + /> + + +
+
+
+ + + +
+
+ + ); +}; +export default UserSetting; diff --git a/src/components/Main/User/index.tsx b/src/components/Main/User/index.tsx deleted file mode 100644 index 8d5e613..0000000 --- a/src/components/Main/User/index.tsx +++ /dev/null @@ -1,7 +0,0 @@ -/** @format */ -import { FunctionComponent } from "react"; - -const User: FunctionComponent = () => { - return
用户中心
; -}; -export default User; diff --git a/src/router/modules/main/bucket/index.ts b/src/router/modules/main/bucket/index.ts index 0f8efb8..ca29c3f 100644 --- a/src/router/modules/main/bucket/index.ts +++ b/src/router/modules/main/bucket/index.ts @@ -5,7 +5,7 @@ import { lazy } from "react"; const MainBucket = lazy( () => new Promise((resolve: any) => { - setTimeout(() => resolve(import("@/components/Main/Bucket")), 500); + resolve(import("@/components/Main/Bucket")); }), ); export default MainBucket; diff --git a/src/router/modules/main/file/index.ts b/src/router/modules/main/file/index.ts index 669e0b4..fbf960d 100644 --- a/src/router/modules/main/file/index.ts +++ b/src/router/modules/main/file/index.ts @@ -5,7 +5,7 @@ import { lazy } from "react"; const MainFile = lazy( () => new Promise((resolve: any) => { - setTimeout(() => resolve(import("@/components/Main/File")), 500); + resolve(import("@/components/Main/File")); }), ); export default MainFile; diff --git a/src/router/modules/main/home/index.ts b/src/router/modules/main/home/index.ts index 29eed58..645e1b0 100644 --- a/src/router/modules/main/home/index.ts +++ b/src/router/modules/main/home/index.ts @@ -5,7 +5,7 @@ import { lazy } from "react"; const MainHome = lazy( () => new Promise((resolve: any) => { - setTimeout(() => resolve(import("@/components/Main/Home")), 500); + resolve(import("@/components/Main/Home")); }), ); export default MainHome; diff --git a/src/router/modules/main/share/index.ts b/src/router/modules/main/share/index.ts new file mode 100644 index 0000000..87543b3 --- /dev/null +++ b/src/router/modules/main/share/index.ts @@ -0,0 +1,11 @@ +/** @format */ + +import { lazy } from "react"; + +const MainShare = lazy( + () => + new Promise((resolve: any) => { + resolve(import("@/components/Main/Share")); + }), +); +export default MainShare; diff --git a/src/router/modules/main/user/index.ts b/src/router/modules/main/user/index.ts deleted file mode 100644 index 1ada381..0000000 --- a/src/router/modules/main/user/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** @format */ - -import { lazy } from "react"; - -const MainUser = lazy( - () => - new Promise((resolve: any) => { - setTimeout(() => resolve(import("@/components/Main/User")), 500); - }), -); -export default MainUser; diff --git a/src/router/modules/main/userInfo/index.ts b/src/router/modules/main/userInfo/index.ts new file mode 100644 index 0000000..9b2efdf --- /dev/null +++ b/src/router/modules/main/userInfo/index.ts @@ -0,0 +1,11 @@ +/** @format */ + +import { lazy } from "react"; + +const MainUserInfo = lazy( + () => + new Promise((resolve: any) => { + resolve(import("@/components/Main/User/UserInfo")); + }), +); +export default MainUserInfo; diff --git a/src/router/modules/main/userSetting/index.ts b/src/router/modules/main/userSetting/index.ts new file mode 100644 index 0000000..cf376d3 --- /dev/null +++ b/src/router/modules/main/userSetting/index.ts @@ -0,0 +1,11 @@ +/** @format */ + +import { lazy } from "react"; + +const MainUserSetting = lazy( + () => + new Promise((resolve: any) => { + resolve(import("@/components/Main/User/UserSetting")); + }), +); +export default MainUserSetting; diff --git a/src/router/routes.ts b/src/router/routes.ts index e438364..f44b5f4 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -13,7 +13,9 @@ import Home from "@/router/modules/home"; import MainHome from "@/router/modules/main/home"; import MainBucket from "@/router/modules/main/bucket"; import MainFile from "@/router/modules/main/file"; -import MainUser from "@/router/modules/main/user"; +import MainUserInfo from "@/router/modules/main/userInfo"; +import MainUserSetting from "@/router/modules/main/userSetting"; +import MainShare from "@/router/modules/main/share"; const routes: RouteObject[] = [ { @@ -25,7 +27,7 @@ const routes: RouteObject[] = [ Component: (props) => ComponentLoading(Register, props), }, { - path: "/404", + path: "*", Component: (props) => ComponentLoading(NoFound, props), }, { @@ -54,8 +56,16 @@ const routes: RouteObject[] = [ Component: MainFile, }, { - path: "/main/user", - Component: MainUser, + path: "/main/user/info", + Component: MainUserInfo, + }, + { + path: "/main/user/setting", + Component: MainUserSetting, + }, + { + path: "/main/share", + Component: MainShare, }, ], }, diff --git a/src/views/404/404.tsx b/src/views/404/404.tsx index 16b3c29..8d9882b 100644 --- a/src/views/404/404.tsx +++ b/src/views/404/404.tsx @@ -6,7 +6,7 @@ import { Button, Result } from "antd"; export default () => { const navigate = useNavigate(); const goBack = () => { - navigate(-2); + navigate(-1); }; return ( diff --git a/src/views/Main/_defaultProps.tsx b/src/views/Main/defaultSettings.tsx similarity index 85% rename from src/views/Main/_defaultProps.tsx rename to src/views/Main/defaultSettings.tsx index 88d81e0..1b60204 100644 --- a/src/views/Main/_defaultProps.tsx +++ b/src/views/Main/defaultSettings.tsx @@ -8,7 +8,7 @@ export default { routes: [ { path: "main/home", - name: "首 页", + name: "仪表盘", icon: , }, { @@ -22,9 +22,27 @@ export default { icon: , }, { - path: "main/user", + path: "main/share", + name: "分享圈", + icon: , + }, + { + path: "/", name: "个人中心", icon: , + routes: [ + { + index: true, + path: "main/user/info", + name: "用户信息", + icon: , + }, + { + path: "main/user/setting", + name: "用户设置", + icon: , + }, + ], }, ], }, diff --git a/src/views/Main/index.tsx b/src/views/Main/index.tsx index 790fd17..fec2a35 100644 --- a/src/views/Main/index.tsx +++ b/src/views/Main/index.tsx @@ -2,13 +2,13 @@ import { GithubFilled, InfoCircleFilled, QuestionCircleFilled } from "@ant-design/icons"; import { PageContainer, ProCard, ProLayout } from "@ant-design/pro-components"; -import { useState } from "react"; -import defaultProps from "./_defaultProps"; -import { Link, Outlet } from "react-router-dom"; - -export default () => { - const [pathname, setPathname] = useState("/mainRouter/homeRouter"); +import defaultProps from "./defaultSettings.tsx"; +import { Link, Outlet, useLocation } from "react-router-dom"; +import logo from "@/assets/images/logo.png"; +import { Suspense } from "react"; +export default function Layout() { + const location: any = useLocation(); return (
{ height: "100vh", }}> { if (menuItemProps.isUrl || !menuItemProps.path) { @@ -24,15 +29,14 @@ export default () => { return {defaultDom}; }} {...defaultProps} - location={{ - pathname, - }} + location={location} avatarProps={{ src: "https://gw.alipayobjects.com/zos/antfincdn/efFD%24IOql2/weixintupian_20170331104822.jpg", title: "七妮妮", size: "small", }} - actionsRender={(props) => { + actionsRender={(props: any) => { + // eslint-disable-next-line react/prop-types if (props.isMobile) return []; return [ , @@ -41,17 +45,15 @@ export default () => { ]; }}> - +
- + + +
); -}; +}