diff --git a/package.json b/package.json index 5c02f9d..5f227e8 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "@types/react-helmet": "^6.1.11", "@umijs/fabric": "^2.14.1", "@umijs/lint": "^4.1.1", - "@umijs/max": "^4.1.1", + "@umijs/max": "^4.1.6", "cross-env": "^7.0.3", "eslint": "^8.56.0", "express": "^4.18.2", diff --git a/src/assets/oidc-logo.svg b/src/assets/oidc-logo.svg new file mode 100644 index 0000000..f21404c --- /dev/null +++ b/src/assets/oidc-logo.svg @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/src/components/Footer/index.tsx b/src/components/Footer/index.tsx index f34e230..3bf8c5c 100644 --- a/src/components/Footer/index.tsx +++ b/src/components/Footer/index.tsx @@ -1,4 +1,3 @@ -import { GithubOutlined } from '@ant-design/icons'; import { DefaultFooter } from '@ant-design/pro-components'; import React from 'react'; diff --git a/src/pages/User/Login/index.tsx b/src/pages/User/Login/index.tsx index 7ad57bd..424147d 100644 --- a/src/pages/User/Login/index.tsx +++ b/src/pages/User/Login/index.tsx @@ -1,26 +1,19 @@ +import oidcLogo from '@/assets/oidc-logo.svg'; import { PageFooter } from '@/components'; import { login } from '@/services/ant-design-pro/api'; -import { getFakeCaptcha } from '@/services/ant-design-pro/login'; -import { - AlipayCircleOutlined, - LockOutlined, - MobileOutlined, - TaobaoCircleOutlined, - UserOutlined, - WeiboCircleOutlined, -} from '@ant-design/icons'; -import { - LoginForm, - ProFormCaptcha, - ProFormCheckbox, - ProFormText, -} from '@ant-design/pro-components'; +import { LockOutlined, UserOutlined } from '@ant-design/icons'; +import { LoginForm, ProFormCheckbox, ProFormText } from '@ant-design/pro-components'; import { Helmet, history, useModel } from '@umijs/max'; -import { Alert, Tabs, message } from 'antd'; +import { Alert, Button, Tabs, message } from 'antd'; import { createStyles } from 'antd-style'; -import React, { useState } from 'react'; +import React, { CSSProperties, useState } from 'react'; import { flushSync } from 'react-dom'; import Settings from '../../../../config/defaultSettings'; + +const iconStyles: CSSProperties = { + transform: 'translateY(-12%)', +}; + const useStyles = createStyles(({ token }) => { return { action: { @@ -56,16 +49,6 @@ const useStyles = createStyles(({ token }) => { }, }; }); -const ActionIcons = () => { - const { styles } = useStyles(); - return ( - <> - - - - - ); -}; const LoginMessage: React.FC<{ content: string; }> = ({ content }) => { @@ -80,6 +63,21 @@ 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'; + const maxPos = chars.length; + let randomStr = ''; + for (let i = 0; i < length; i++) { + randomStr += chars.charAt(Math.floor(Math.random() * maxPos)); + } + return randomStr; +}; const Login: React.FC = () => { const [userLoginState, setUserLoginState] = useState({}); const [type, setType] = useState('account'); @@ -140,12 +138,11 @@ const Login: React.FC = () => { maxWidth: '75vw', }} logo={logo} - title="Ant Design" - subTitle={'Ant Design 是西湖区最具影响力的 Web 设计规范'} + title="EVA Tea" + subTitle={'E志者协会是东区教学楼最专业的志愿维修组织'} initialValues={{ autoLogin: true, }} - actions={['其他登录方式 :', ]} onFinish={async (values) => { await handleSubmit(values as API.LoginParams); }} @@ -159,10 +156,6 @@ const Login: React.FC = () => { key: 'account', label: '账户密码登录', }, - { - key: 'mobile', - label: '手机号登录', - }, ]} /> @@ -202,61 +195,6 @@ const Login: React.FC = () => { )} - {status === 'error' && loginType === 'mobile' && } - {type === 'mobile' && ( - <> - , - }} - name="mobile" - placeholder={'请输入手机号!'} - rules={[ - { - required: true, - message: '手机号是必填项!', - }, - { - pattern: /^1\d{10}$/, - message: '不合法的手机号!', - }, - ]} - /> - , - }} - captchaProps={{ - size: 'large', - }} - placeholder={'请输入验证码!'} - captchaTextRender={(timing, count) => { - if (timing) { - return `${count} ${'秒后重新获取'}`; - } - return '获取验证码'; - }} - name="captcha" - rules={[ - { - required: true, - message: '验证码是必填项!', - }, - ]} - onGetCaptcha={async (phone) => { - const result = await getFakeCaptcha({ - phone, - }); - if (!result) { - return; - } - message.success('获取验证码成功!验证码为:1234'); - }} - /> - - )}
{ 自动登录 - +
+ {' '} +