From 6ea019a98f016f3475ef8fae5894f7d1bd423bbf Mon Sep 17 00:00:00 2001
From: Dawn1Ocean <1785590531@qq.com>
Date: Sun, 31 Mar 2024 21:21:22 +0800
Subject: [PATCH] fix: change router
---
config/routes.ts | 2 ++
package.json | 2 +-
src/app.tsx | 3 +--
src/components/RightContent/index.tsx | 16 ----------------
src/components/Todo/index.tsx | 15 +++++++++++++++
src/components/index.ts | 4 ++--
src/pages/About.tsx | 0
src/pages/Logs/index.tsx | 14 ++++++++++++++
src/pages/User/Login/index.tsx | 18 ++++++++++--------
9 files changed, 45 insertions(+), 29 deletions(-)
create mode 100644 src/components/Todo/index.tsx
create mode 100644 src/pages/About.tsx
create mode 100644 src/pages/Logs/index.tsx
diff --git a/config/routes.ts b/config/routes.ts
index 61c19a6..65cb340 100644
--- a/config/routes.ts
+++ b/config/routes.ts
@@ -16,6 +16,8 @@ export default [
],
},
{ name: '查询表格', icon: 'table', path: '/list', component: './TableList' },
+ { name: '日志', icon: 'clockCircle', path: '/logs', component: './Logs' },
+ { name: '关于我们', icon: 'thunderbolt', path: '/about', component: './About' },
{ path: '/', redirect: '/welcome' },
{ path: '*', layout: false, component: './404' },
];
diff --git a/package.json b/package.json
index 5f227e8..6a0d84d 100644
--- a/package.json
+++ b/package.json
@@ -47,7 +47,7 @@
],
"dependencies": {
"@ant-design/icons": "^4.8.1",
- "@ant-design/pro-components": "^2.6.48",
+ "@ant-design/pro-components": "^2.7.0",
"@umijs/route-utils": "^2.2.2",
"antd": "^5.13.2",
"antd-style": "^3.6.1",
diff --git a/src/app.tsx b/src/app.tsx
index 472c32e..abaacec 100644
--- a/src/app.tsx
+++ b/src/app.tsx
@@ -1,4 +1,4 @@
-import { AvatarDropdown, AvatarName, PageFooter, Question } from '@/components';
+import { AvatarDropdown, AvatarName, PageFooter } from '@/components';
import { currentUser as queryCurrentUser } from '@/services/ant-design-pro/api';
import { LinkOutlined } from '@ant-design/icons';
import type { Settings as LayoutSettings } from '@ant-design/pro-components';
@@ -49,7 +49,6 @@ export async function getInitialState(): Promise<{
// ProLayout 支持的api https://procomponents.ant.design/components/layout
export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) => {
return {
- actionsRender: () => [],
avatarProps: {
src: initialState?.currentUser?.avatar,
title: ,
diff --git a/src/components/RightContent/index.tsx b/src/components/RightContent/index.tsx
index 0c95d55..a87df5e 100644
--- a/src/components/RightContent/index.tsx
+++ b/src/components/RightContent/index.tsx
@@ -1,18 +1,2 @@
-import { QuestionCircleOutlined } from '@ant-design/icons';
import '@umijs/max';
export type SiderTheme = 'light' | 'dark';
-export const Question = () => {
- return (
-
{
- window.open('https://pro.ant.design/docs/getting-started');
- }}
- >
-
-
- );
-};
diff --git a/src/components/Todo/index.tsx b/src/components/Todo/index.tsx
new file mode 100644
index 0000000..00f0a57
--- /dev/null
+++ b/src/components/Todo/index.tsx
@@ -0,0 +1,15 @@
+import { Typography } from 'antd';
+import React from 'react';
+
+const { Title, Text } = Typography;
+
+const Todo: React.FC = () => {
+ return (
+
+
施工中...
+ {'// TODO'}
+
+ );
+};
+
+export default Todo;
diff --git a/src/components/index.ts b/src/components/index.ts
index 84ec583..cb07bf6 100644
--- a/src/components/index.ts
+++ b/src/components/index.ts
@@ -6,6 +6,6 @@
* 布局组件
*/
import PageFooter from './Footer';
-import { Question } from './RightContent';
import { AvatarDropdown, AvatarName } from './RightContent/AvatarDropdown';
-export { AvatarDropdown, AvatarName, PageFooter, Question };
\ No newline at end of file
+import Todo from './Todo';
+export { AvatarDropdown, AvatarName, PageFooter, Todo };
diff --git a/src/pages/About.tsx b/src/pages/About.tsx
new file mode 100644
index 0000000..e69de29
diff --git a/src/pages/Logs/index.tsx b/src/pages/Logs/index.tsx
new file mode 100644
index 0000000..38f3d92
--- /dev/null
+++ b/src/pages/Logs/index.tsx
@@ -0,0 +1,14 @@
+import { Todo } from '@/components';
+import { PageContainer } from '@ant-design/pro-components';
+import { Card } from 'antd';
+
+const Logs: React.FC = () => {
+ return (
+
+
+
+
+
+ );
+};
+export default Logs;
diff --git a/src/pages/User/Login/index.tsx b/src/pages/User/Login/index.tsx
index 424147d..51178aa 100644
--- a/src/pages/User/Login/index.tsx
+++ b/src/pages/User/Login/index.tsx
@@ -1,3 +1,4 @@
+import Settings from '@/../config/defaultSettings';
import oidcLogo from '@/assets/oidc-logo.svg';
import { PageFooter } from '@/components';
import { login } from '@/services/ant-design-pro/api';
@@ -8,7 +9,6 @@ import { Alert, Button, Tabs, message } from 'antd';
import { createStyles } from 'antd-style';
import React, { CSSProperties, useState } from 'react';
import { flushSync } from 'react-dom';
-import Settings from '../../../../config/defaultSettings';
const iconStyles: CSSProperties = {
transform: 'translateY(-12%)',
@@ -63,11 +63,6 @@ const LoginMessage: React.FC<{
/>
);
};
-const generateLink = () => {
- const preLink =
- 'https://auth.zjueva.net/connect/authorize?response_type=code&client_id=tea&redirect_uri=https://xms.zjueva.net/api/external_sign&scope=openid&state=';
- return preLink + randomString(30);
-};
const randomString = (length: number) => {
const chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
@@ -78,6 +73,13 @@ const randomString = (length: number) => {
}
return randomStr;
};
+
+const generateLink = () => {
+ const preLink =
+ 'https://auth.zjueva.net/connect/authorize?response_type=code&client_id=ETA&redirect_uri=https://xms.zjueva.net/api/external_sign&scope=openid&state=';
+ return preLink + randomString(30);
+};
+
const Login: React.FC = () => {
const [userLoginState, setUserLoginState] = useState({});
const [type, setType] = useState('account');
@@ -87,7 +89,7 @@ const Login: React.FC = () => {
const userInfo = await initialState?.fetchUserInfo?.();
if (userInfo) {
flushSync(() => {
- setInitialState((s) => ({
+ setInitialState((s: any) => ({
...s,
currentUser: userInfo,
}));
@@ -143,7 +145,7 @@ const Login: React.FC = () => {
initialValues={{
autoLogin: true,
}}
- onFinish={async (values) => {
+ onFinish={async (values: API.LoginParams) => {
await handleSubmit(values as API.LoginParams);
}}
>