From 964fd989140b47f73973ecc4e5006d8d1e710658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sat, 21 Feb 2026 13:39:35 +0800 Subject: [PATCH] Add spinner during captcha verification Show a loading spinner and message while captcha is being verified. Imported Spinner and added an optional captchaVerifying prop to PasswordLogin to toggle between the TencentCaptchaModal and a waiting state. In qq_login.tsx introduced captchaVerifying state, set it true before the captcha login request and reset it in finally, and passed the prop down to the PasswordLogin component. --- .../src/components/password_login.tsx | 31 +++++++++++++------ .../src/pages/qq_login.tsx | 4 +++ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/packages/napcat-webui-frontend/src/components/password_login.tsx b/packages/napcat-webui-frontend/src/components/password_login.tsx index 1f7d8223..e2a98932 100644 --- a/packages/napcat-webui-frontend/src/components/password_login.tsx +++ b/packages/napcat-webui-frontend/src/components/password_login.tsx @@ -6,6 +6,7 @@ import { Input } from '@heroui/input'; import { useState } from 'react'; import { toast } from 'react-hot-toast'; import { IoChevronDown } from 'react-icons/io5'; +import { Spinner } from '@heroui/spinner'; import type { QQItem } from '@/components/quick_login'; import { isQQQuickNewItem } from '@/utils/qq'; @@ -25,6 +26,7 @@ interface PasswordLoginProps { uin: string; password: string; } | null; + captchaVerifying?: boolean; newDeviceState?: { needNewDevice: boolean; jumpUrl: string; @@ -34,7 +36,7 @@ interface PasswordLoginProps { onNewDeviceCancel?: () => void; } -const PasswordLogin: React.FC = ({ onSubmit, onCaptchaSubmit, onNewDeviceVerified, isLoading, qqList, captchaState, newDeviceState, onCaptchaCancel, onNewDeviceCancel }) => { +const PasswordLogin: React.FC = ({ onSubmit, onCaptchaSubmit, onNewDeviceVerified, isLoading, qqList, captchaState, captchaVerifying, newDeviceState, onCaptchaCancel, onNewDeviceCancel }) => { const [uin, setUin] = useState(''); const [password, setPassword] = useState(''); @@ -54,14 +56,25 @@ const PasswordLogin: React.FC = ({ onSubmit, onCaptchaSubmit
{captchaState?.needCaptcha && captchaState.proofWaterUrl ? (
-

登录需要安全验证,请完成验证码

- { - onCaptchaSubmit?.(captchaState.uin, captchaState.password, data); - }} - onCancel={onCaptchaCancel} - /> + {captchaVerifying ? ( + <> +

验证码已提交,正在等待服务器验证结果...

+
+ +
+ + ) : ( + <> +

登录需要安全验证,请完成验证码

+ { + onCaptchaSubmit?.(captchaState.uin, captchaState.password, data); + }} + onCancel={onCaptchaCancel} + /> + + )}