From 2b221e04240aa467bc2cd832097c691fad11c2b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=9C=B1?= <10714957+xiao-zhu245@user.noreply.gitee.com> Date: Sat, 19 Jul 2025 00:20:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=99=BB=E5=BD=95=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .trae/rules/project_rules.md | 3 +- client/src/index.css | 31 ++++++++++ client/src/pages/LoginPage.tsx | 104 ++++++++++++++++++++++++++++++++- 3 files changed, 136 insertions(+), 2 deletions(-) diff --git a/.trae/rules/project_rules.md b/.trae/rules/project_rules.md index 760361d..5ac0d4b 100644 --- a/.trae/rules/project_rules.md +++ b/.trae/rules/project_rules.md @@ -5,4 +5,5 @@ 切记所有涉及/api接口必须要加认证中间件import { authenticateToken } from '../middleware/auth.js'前端的实例管理 API 调用都通过 `api.ts` 中的 ApiClient 类进行 涉及实时通信相关需要使用websocket 操作config.json可以使用ConfigManager -改动目前已有的代码时要遵循当前设计逻辑,比如注释掉的代码非必要不要取消,部分功能没限制非必要不要限制 \ No newline at end of file +改动目前已有的代码时要遵循当前设计逻辑,比如注释掉的代码非必要不要取消,部分功能没限制非必要不要限制 +所有涉及弹窗的需要加淡入淡出动画 \ No newline at end of file diff --git a/client/src/index.css b/client/src/index.css index e13ec6a..9bbd791 100644 --- a/client/src/index.css +++ b/client/src/index.css @@ -592,6 +592,29 @@ } } +@keyframes modalSlideIn { + from { + transform: scale(0.95) translateY(-10px); + opacity: 0; + } + to { + transform: scale(1) translateY(0); + opacity: 1; + } +} + +@keyframes bounceGentle { + 0%, 20%, 50%, 80%, 100% { + transform: translateY(0); + } + 40% { + transform: translateY(-8px); + } + 60% { + transform: translateY(-4px); + } +} + .animate-fade-in { animation: fadeIn 0.2s ease-out forwards; } @@ -608,6 +631,14 @@ animation: scaleOut 0.3s ease-in forwards; } +.animate-modal-slide-in { + animation: modalSlideIn 0.3s ease-out forwards; +} + +.animate-bounce-gentle { + animation: bounceGentle 2s ease-in-out infinite; +} + /* 游戏字体 - 使用系统字体 */ .font-game { font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; diff --git a/client/src/pages/LoginPage.tsx b/client/src/pages/LoginPage.tsx index 29a314d..1d345d3 100644 --- a/client/src/pages/LoginPage.tsx +++ b/client/src/pages/LoginPage.tsx @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react' import { useAuthStore } from '@/stores/authStore' import { useNotificationStore } from '@/stores/notificationStore' import { useThemeStore } from '@/stores/themeStore' -import { Eye, EyeOff, Gamepad2, Sun, Moon, Loader2, RefreshCw, UserPlus } from 'lucide-react' +import { Eye, EyeOff, Gamepad2, Sun, Moon, Loader2, RefreshCw, UserPlus, HelpCircle } from 'lucide-react' import apiClient from '@/utils/api' import { CaptchaData } from '@/types' import LoginTransition from '@/components/LoginTransition' @@ -24,6 +24,8 @@ const LoginPage: React.FC = () => { const [isRegisterMode, setIsRegisterMode] = useState(false) const [hasUsers, setHasUsers] = useState(true) const [checkingUsers, setCheckingUsers] = useState(true) + const [showForgotPasswordModal, setShowForgotPasswordModal] = useState(false) + const [isClosingModal, setIsClosingModal] = useState(false) const { login, loading, error } = useAuthStore() const { addNotification } = useNotificationStore() const { theme, toggleTheme } = useThemeStore() @@ -75,6 +77,22 @@ const LoginPage: React.FC = () => { } } + // 处理忘记密码点击 + const handleForgotPassword = () => { + setShowForgotPasswordModal(true) + setIsClosingModal(false) + } + + // 关闭忘记密码模态框 + const closeForgotPasswordModal = () => { + setIsClosingModal(true) + // 等待动画完成后关闭模态框 + setTimeout(() => { + setShowForgotPasswordModal(false) + setIsClosingModal(false) + }, 200) // 与 animate-fade-out 动画时长一致 + } + // 加载验证码 const loadCaptcha = async () => { setCaptchaLoading(true) @@ -539,6 +557,28 @@ const LoginPage: React.FC = () => { + {/* 忘记密码链接(仅登录模式) */} + {!isRegisterMode && ( +
@@ -548,6 +588,68 @@ const LoginPage: React.FC = () => {
+ 如果您忘记了管理员密码,请按照以下步骤重置: +
+ +server/data/users.json 文件+ ⚠️ 注意:删除用户文件将清除所有用户账户数据,请谨慎操作! +
+