change footer

dev
Dawn1Ocean 2024-03-31 14:44:30 +08:00
parent 54290fa2fc
commit 2eb06bd720
4 changed files with 20 additions and 25 deletions

View File

@ -1,4 +1,4 @@
import { AvatarDropdown, AvatarName, Footer, Question } from '@/components'; import { AvatarDropdown, AvatarName, PageFooter, Question } from '@/components';
import { currentUser as queryCurrentUser } from '@/services/ant-design-pro/api'; import { currentUser as queryCurrentUser } from '@/services/ant-design-pro/api';
import { LinkOutlined } from '@ant-design/icons'; import { LinkOutlined } from '@ant-design/icons';
import type { Settings as LayoutSettings } from '@ant-design/pro-components'; import type { Settings as LayoutSettings } from '@ant-design/pro-components';
@ -57,10 +57,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
return <AvatarDropdown>{avatarChildren}</AvatarDropdown>; return <AvatarDropdown>{avatarChildren}</AvatarDropdown>;
}, },
}, },
waterMarkProps: { footerRender: () => <PageFooter />,
content: initialState?.currentUser?.name,
},
footerRender: () => <Footer />,
onPageChange: () => { onPageChange: () => {
const { location } = history; const { location } = history;
// 如果没有登录,重定向到 login // 如果没有登录,重定向到 login

View File

@ -2,34 +2,32 @@ import { GithubOutlined } from '@ant-design/icons';
import { DefaultFooter } from '@ant-design/pro-components'; import { DefaultFooter } from '@ant-design/pro-components';
import React from 'react'; import React from 'react';
const Footer: React.FC = () => { const PageFooter: React.FC = () => {
const startYear = 2024;
const curYear = new Date().getFullYear();
let yearStr = '';
if (startYear === curYear) {
yearStr = curYear.toString();
} else {
yearStr = startYear.toString() + ' - ' + curYear.toString();
}
return ( return (
<DefaultFooter <DefaultFooter
copyright={yearStr + " EVA Tech"}
style={{ style={{
background: 'none', background: 'none',
color: '#808080'
}} }}
links={[ links={[
{ {
key: 'Ant Design Pro', key: 'EVA Tea',
title: 'Ant Design Pro', title: 'EVA Tea',
href: 'https://pro.ant.design', href: 'https://pro.ant.design',
blankTarget: true, blankTarget: true,
}, },
{
key: 'github',
title: <GithubOutlined />,
href: 'https://github.com/ant-design/ant-design-pro',
blankTarget: true,
},
{
key: 'Ant Design',
title: 'Ant Design',
href: 'https://ant.design',
blankTarget: true,
},
]} ]}
/> />
); );
}; };
export default Footer; export default PageFooter;

View File

@ -5,7 +5,7 @@
/** /**
* *
*/ */
import Footer from './Footer'; import PageFooter from './Footer';
import { Question } from './RightContent'; import { Question } from './RightContent';
import { AvatarDropdown, AvatarName } from './RightContent/AvatarDropdown'; import { AvatarDropdown, AvatarName } from './RightContent/AvatarDropdown';
export { AvatarDropdown, AvatarName, Footer, Question }; export { AvatarDropdown, AvatarName, PageFooter, Question };

View File

@ -1,4 +1,4 @@
import { Footer } from '@/components'; import { PageFooter } from '@/components';
import { login } from '@/services/ant-design-pro/api'; import { login } from '@/services/ant-design-pro/api';
import { getFakeCaptcha } from '@/services/ant-design-pro/login'; import { getFakeCaptcha } from '@/services/ant-design-pro/login';
import { import {
@ -275,7 +275,7 @@ const Login: React.FC = () => {
</div> </div>
</LoginForm> </LoginForm>
</div> </div>
<Footer /> <PageFooter />
</div> </div>
); );
}; };