From d2212fe949d37b88f8e12bd6bdcae9d8759c5298 Mon Sep 17 00:00:00 2001 From: jialin Date: Mon, 3 Jun 2024 09:06:41 +0800 Subject: [PATCH] feat: login page --- config/config.ts | 2 +- config/routes.ts | 8 +++ package.json | 1 + pnpm-lock.yaml | 7 +++ src/access.ts | 3 +- src/components/form-buttons/index.tsx | 15 +++-- .../seal-form/components/wrapper.less | 19 +++++- src/components/seal-form/input-number.tsx | 4 +- src/components/seal-form/password.tsx | 4 +- src/components/seal-form/seal-input.tsx | 8 ++- src/layouts/index.tsx | 8 +++ src/pages/llmodels/index.tsx | 21 ++++--- src/pages/login/index.tsx | 61 +++++++++++++++++++ .../playground/components/ground-left.tsx | 4 ++ src/pages/profile/index.tsx | 5 +- 15 files changed, 147 insertions(+), 23 deletions(-) create mode 100644 src/pages/login/index.tsx diff --git a/config/config.ts b/config/config.ts index 43926d94..874b5583 100644 --- a/config/config.ts +++ b/config/config.ts @@ -21,7 +21,7 @@ export default defineConfig({ }, token: { colorPrimary: '#2fbf85', - borderRadius: 20, + borderRadius: 16, fontSize: 12, motion: true } diff --git a/config/routes.ts b/config/routes.ts index 05c158fe..85d62722 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -57,6 +57,14 @@ export default [ component: './profile', icon: 'User' }, + { + name: 'Login', + path: '/login', + key: 'login', + layout: false, + hideInMenu: true, + component: './login' + }, { name: '404', path: '*', diff --git a/package.json b/package.json index 98ebe090..a8cfb49e 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "antd": "^5.17.0", "antd-style": "^3.6.2", "classnames": "^2.5.1", + "crypto-js": "^4.2.0", "lodash": "^4.17.21", "numeral": "^2.0.6" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fb86cb72..7955021f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,6 +32,9 @@ dependencies: classnames: specifier: ^2.5.1 version: 2.5.1 + crypto-js: + specifier: ^4.2.0 + version: 4.2.0 lodash: specifier: ^4.17.21 version: 4.17.21 @@ -5105,6 +5108,10 @@ packages: randomfill: 1.0.4 dev: false + /crypto-js@4.2.0: + resolution: {integrity: sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==} + dev: false + /css-blank-pseudo@3.0.3(postcss@8.4.38): resolution: {integrity: sha512-VS90XWtsHGqoM0t4KpH053c4ehxZ2E6HtGI7x68YFV0pTo/QmkV/YFA+NnlvK8guxZVNWGQhVNJGC39Q8XF4OQ==} engines: {node: ^12 || ^14 || >=16} diff --git a/src/access.ts b/src/access.ts index 52a92651..f81d09e1 100644 --- a/src/access.ts +++ b/src/access.ts @@ -5,6 +5,7 @@ export default (initialState: API.UserInfo) => { initialState && initialState.name !== 'dontHaveAccess' ); return { - canSeeAdmin + canSeeAdmin, + canDelete: true }; }; diff --git a/src/components/form-buttons/index.tsx b/src/components/form-buttons/index.tsx index dc5a2548..fde34097 100644 --- a/src/components/form-buttons/index.tsx +++ b/src/components/form-buttons/index.tsx @@ -1,20 +1,27 @@ import { Button, Space } from 'antd'; type FormButtonsProps = { - onOk: () => void; - onCancel: () => void; + onOk?: () => void; + onCancel?: () => void; cancelText?: string; okText?: string; + htmlType?: 'submit' | 'button'; }; const FormButtons: React.FC = ({ onOk, onCancel, cancelText, - okText + okText, + htmlType = 'button' }) => { return ( - - + + + } > diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx new file mode 100644 index 00000000..473dd794 --- /dev/null +++ b/src/pages/login/index.tsx @@ -0,0 +1,61 @@ +import LogoIcon from '@/assets/images/logo.png'; +import SealInput from '@/components/seal-form/seal-input'; +import { LockOutlined, UserOutlined } from '@ant-design/icons'; +import { Button, Checkbox, Form } from 'antd'; + +const renderLogo = () => { + return ( +
+ logo + SEAL +
+ ); +}; +const Login = () => { + return ( +
+
{renderLogo()}
+ + } /> + + + + } label="Password" /> + + +
+ Auto login +
+
+ +
+ ); +}; + +export default Login; diff --git a/src/pages/playground/components/ground-left.tsx b/src/pages/playground/components/ground-left.tsx index be5596c4..d75ef4e0 100644 --- a/src/pages/playground/components/ground-left.tsx +++ b/src/pages/playground/components/ground-left.tsx @@ -1,3 +1,4 @@ +import SealInput from '@/components/seal-form/seal-input'; import { PageContainer } from '@ant-design/pro-components'; import { useState } from 'react'; import '../style/ground-left.less'; @@ -54,6 +55,9 @@ const MessageList: React.FC = () => { return (
+
+ +
{messageList.map((item, index) => { return ( diff --git a/src/pages/profile/index.tsx b/src/pages/profile/index.tsx index 46239a30..f558e03a 100644 --- a/src/pages/profile/index.tsx +++ b/src/pages/profile/index.tsx @@ -21,6 +21,9 @@ const Profile: React.FC = () => { const handleOnFinishFailed = (errorInfo: any) => { console.log('handleOnFinishFailed', errorInfo); }; + const handleCancel = () => { + form.resetFields(); + }; return ( @@ -69,8 +72,8 @@ const Profile: React.FC = () => { style={{ width: INPUT_WIDTH.default }} > + - );