diff --git a/video-gen-admin/src/pages/AdminLoginPage.tsx b/video-gen-admin/src/pages/AdminLoginPage.tsx index 07309c55..226b88d3 100644 --- a/video-gen-admin/src/pages/AdminLoginPage.tsx +++ b/video-gen-admin/src/pages/AdminLoginPage.tsx @@ -1,13 +1,39 @@ -import { useState } from 'react'; +import { useState, useEffect } from 'react'; import { Button, Card, Form, Input, message, Typography, Checkbox } from 'antd'; import { UserOutlined, LockOutlined, ThunderboltOutlined } from '@ant-design/icons'; import { useNavigate } from 'react-router-dom'; import { useAdminStore } from '../store'; +import { getSiteInfo } from '../api'; const AdminLoginPage = () => { const navigate = useNavigate(); const { login } = useAdminStore(); const [loading, setLoading] = useState(false); + + const getInitialSiteInfo = () => { + try { + const cached = localStorage.getItem('siteInfo'); + if (cached) { + const info = JSON.parse(cached); + return { + siteName: info.siteName || 'VideoGen.AI', + siteLogo: info.siteLogo || '', + }; + } + } catch { } + return { siteName: 'VideoGen.AI', siteLogo: '' }; + }; + + const initialInfo = getInitialSiteInfo(); + const [siteName, setSiteName] = useState(initialInfo.siteName); + const [siteLogo, setSiteLogo] = useState(initialInfo.siteLogo); + + useEffect(() => { + getSiteInfo().then(info => { + setSiteName(info.siteName); + setSiteLogo(info.siteLogo); + }).catch(() => {}); + }, []); const handleLogin = async (values: { username: string; password: string; rememberMe?: boolean }) => { setLoading(true); @@ -24,45 +50,113 @@ const AdminLoginPage = () => { return (
+
+
+ - {/* Logo */} -
+ width: 440, + borderRadius: 20, + boxShadow: '0 20px 60px rgba(0,0,0,0.08)', + border: '1px solid #e2e8f0', + background: '#fff', + zIndex: 1, + }} styles={{ body: { padding: '36px 28px' } }}> +
- + {siteLogo ? ( + logo + ) : ( + + )}
- - VideoGen.AI + + {siteName} + .AI - 管理后台 + 管理后台
- } /> + } + style={{ + background: '#fff', + border: '1.5px solid #e2e8f0', + color: '#1e293b', + height: 48, + borderRadius: 10, + fontSize: 14, + }} + /> - } /> + } + style={{ + background: '#fff', + border: '1.5px solid #e2e8f0', + color: '#1e293b', + height: 48, + borderRadius: 10, + fontSize: 14, + }} + /> - + 记住我的登录状态 - diff --git a/video-gen-app/src/pages/LoginPage.tsx b/video-gen-app/src/pages/LoginPage.tsx index eeac6d83..a828b8cc 100644 --- a/video-gen-app/src/pages/LoginPage.tsx +++ b/video-gen-app/src/pages/LoginPage.tsx @@ -25,10 +25,27 @@ const LoginPage: React.FC = () => { const [sliderKey, setSliderKey] = useState(0); const [showResend, setShowResend] = useState(false); const [loginShowResend, setLoginShowResend] = useState(false); - const [siteName, setSiteName] = useState('VideoGen.AI'); - const [siteLogo, setSiteLogo] = useState(''); + + const getInitialSiteInfo = () => { + try { + const cached = localStorage.getItem('siteInfo'); + if (cached) { + const info = JSON.parse(cached); + return { + siteName: info.siteName || 'VideoGen.AI', + siteLogo: info.siteLogo || '', + }; + } + } catch { } + return { siteName: 'VideoGen.AI', siteLogo: '' }; + }; + + const initialInfo = getInitialSiteInfo(); + const [siteName, setSiteName] = useState(initialInfo.siteName); + const [siteLogo, setSiteLogo] = useState(initialInfo.siteLogo); const [agreementUrl, setAgreementUrl] = useState(''); const [policyUrl, setPolicyUrl] = useState(''); + const navigate = useNavigate(); const { login } = useAuthStore(); const [pwdForm] = Form.useForm();