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