From abdafba5d9f49c580a7a08d8b29b1fa16d7b0aaa Mon Sep 17 00:00:00 2001 From: linxd <544554903@qq.com> Date: Mon, 14 Jul 2025 12:04:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=99=BB=E5=BD=95=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.tsx | 4 ++-- src/wrappers/auth.tsx | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 src/wrappers/auth.tsx diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 72b87d0..c62d360 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -333,7 +333,7 @@ const IndexPage: React.FC = () => {
问题咨询方式
{/* addressImg */} - +
{aboutUs[intl.formatMessage({ id: 'home.data.address' })]} @@ -383,7 +383,7 @@ const IndexPage: React.FC = () => { {friendshipConnections.map((item, index) => ( - + ))} diff --git a/src/wrappers/auth.tsx b/src/wrappers/auth.tsx new file mode 100644 index 0000000..cd46ca5 --- /dev/null +++ b/src/wrappers/auth.tsx @@ -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
{props.children}
; + } else { + // 提示后跳转 + message.error('请先登录'); + return ; + } +};