From b8f63a3a264cb3d3283b66473ca95d437e6936d0 Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Mon, 6 May 2024 17:00:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E4=B8=8D=E6=B8=B2=E6=9F=93Outlet=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E6=9C=89=E6=97=A0=E6=95=88=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/AuthApp.jsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/views/AuthApp.jsx b/src/views/AuthApp.jsx index a14ecc2..5dc44b8 100644 --- a/src/views/AuthApp.jsx +++ b/src/views/AuthApp.jsx @@ -2,10 +2,10 @@ import ErrorBoundary from '@/components/ErrorBoundary' import useAuthStore from '@/stores/AuthStore' import useConversationStore from '@/stores/ConversationStore' import { useThemeContext } from '@/stores/ThemeContext' -import { App as AntApp, ConfigProvider, Empty, Layout, Typography, theme } from 'antd' +import { App as AntApp, ConfigProvider, Empty, theme } from 'antd' import zhLocale from 'antd/locale/zh_CN' import 'dayjs/locale/zh-cn' -import { useEffect, useState } from 'react' +import { useEffect } from 'react' import { Outlet, useHref, useNavigate } from 'react-router-dom' import AppLogo from '@/assets/highlights_travel_300_300.png' @@ -41,17 +41,15 @@ function AuthApp() { }; }, []) + // 除了路由 /p...以外都需要登陆系统 + const needToLogin = (loginUser.userId === -1) && (href.indexOf('/p/') === -1) + useEffect(() => { - // 除了路由 /p...以外都需要登陆系统 - if ((loginUser.userId === -1) && (href.indexOf('/p/') === -1)) { + if (needToLogin) { navigate('/p/dingding/login?origin_url=' + href) } }, [href]) - const { - token: { colorBgContainer }, - } = theme.useToken() - return ( }> - + {needToLogin ? <>login... : } logo