增加登录验证

This commit is contained in:
linxd
2025-07-14 12:04:42 +08:00
parent 56c2af09c2
commit abdafba5d9
2 changed files with 15 additions and 2 deletions

View File

@ -333,7 +333,7 @@ const IndexPage: React.FC = () => {
<div className="blockTitle"></div>
<div className="borderBox">
{/* addressImg */}
<img src={require('@/assets/img/location.png')} alt="" />
<img src={aboutUs.addressImg} alt="" />
<div className="questionItem">
<IconFont type="icon-dizhi" className="icon" />
{aboutUs[intl.formatMessage({ id: 'home.data.address' })]}
@ -383,7 +383,7 @@ const IndexPage: React.FC = () => {
<Card>
{friendshipConnections.map((item, index) => (
<Card.Grid key={item.id} style={{ width: '16.6667%', height: '130px' }}>
<img src={item.url} alt="" />
<img src={item.thumbnail} alt="" />
</Card.Grid>
))}
</Card>

13
src/wrappers/auth.tsx Normal file
View File

@ -0,0 +1,13 @@
import React from 'react';
import { Redirect } from 'umi';
import { message } from 'antd';
// 权限校验
export default (props: any) => {
if (localStorage.getItem('token')) {
return <div>{props.children}</div>;
} else {
// 提示后跳转
message.error('请先登录');
return <Redirect to="/login" />;
}
};