fix: #2136 移除废弃接口

This commit removes deprecated QQ quick-login and user-list API calls from the frontend and updates the login page to use the newer quick-login response format. It also fixes the initial loading state by ensuring the spinner is cleared in a finally block and moves QQ list refresh to its own effect so the list loads reliably on first render.
This commit is contained in:
手瓜一十雪 committed 2026-10-30 13:42:00 +08:00
1 parent 49ecfe0f56
commit c15f149881
3 files changed
+13 -34

No files matched your search

@@ -61,14 +61,6 @@ export default class QQManager {
return data.data.data.qrcode;
}
public static async getQQQuickLoginList () {
const data = await serverRequest.post<ServerResponse<string[]>>(
'/QQLogin/GetQuickLoginList'
);
return data.data.data;
}
public static async getQQQuickLoginListNew () {
const data = await serverRequest.post<ServerResponse<LoginListItem[]>>(
'/QQLogin/GetQuickLoginListNew'
@@ -185,11 +185,6 @@ export default class WebUIManager {
return data.data;
}
public static async getAllUsers (): Promise<any> {
const { data } = await serverRequest.get<ServerResponse<any>>('/QQLogin/GetAllUsers');
return data.data;
}
public static async getLogList () {
const { data } =
await serverRequest.get<ServerResponse<string[]>>('/Log/GetLogList');
@@ -17,7 +17,6 @@ import { title } from '@/components/primitives';
import PasswordLogin from '@/components/password_login';
import QrCodeLogin from '@/components/qr_code_login';
import QuickLogin from '@/components/quick_login';
import type { QQItem } from '@/components/quick_login';
import { ThemeSwitch } from '@/components/theme-switch';
import type { CaptchaCallbackData } from '@/components/tencent_captcha';
@@ -60,7 +59,7 @@ export default function QQLoginPage () {
const isRefreshingQRCodeRef = useRef(false);
const [loginError, setLoginError] = useState<string>('');
const lastErrorRef = useRef<string>('');
const [qqList, setQQList] = useState<(QQItem | LoginListItem)[]>([]);
const [qqList, setQQList] = useState<LoginListItem[]>([]);
const [refresh, setRefresh] = useState<boolean>(false);
const [activeTab, setActiveTab] = useState<string>('shortcut');
const firstLoad = useRef<boolean>(true);
@@ -213,10 +212,6 @@ export default function QQLoginPage () {
setIsRecoveringLoginService(true);
}
if (firstLoad.current) {
setIsLoading(false);
firstLoad.current = false;
}
if (data.isLogin) {
toast.success('QQ登录成功');
navigate('/', { replace: true });
@@ -259,6 +254,11 @@ export default function QQLoginPage () {
if (!isRecoveringLoginService) {
toast.error(`获取二维码失败: ${msg}`);
}
} finally {
if (firstLoad.current) {
setIsLoading(false);
firstLoad.current = false;
}
}
};
@@ -267,20 +267,9 @@ export default function QQLoginPage () {
try {
const data = await QQManager.getQQQuickLoginListNew();
setQQList(data);
} catch (_error) {
try {
const data = await QQManager.getQQQuickLoginList();
const qqList = data.map((item) => ({
uin: item,
}));
setQQList(qqList);
} catch (_error) {
const msg = (_error as Error).message;
toast.error(`获取QQ列表失败: ${msg}`);
}
} catch (error) {
const msg = (error as Error).message;
toast.error(`获取QQ列表失败: ${msg}`);
} finally {
setRefresh(false);
}
@@ -347,11 +336,14 @@ export default function QQLoginPage () {
}, pollInterval);
onUpdateQrCode();
onUpdateQQList();
return () => clearInterval(timer);
}, [isRefreshingQRCode, loginPhase, isRecoveringLoginService]);
useEffect(() => {
onUpdateQQList();
}, []);
useEffect(() => {
if (!isRecoveringLoginService) return;
const timer = setTimeout(() => {