From 4223f5a19adc2a5d99b31ca1244df58ccc5867da Mon Sep 17 00:00:00 2001 From: Aska Date: Tue, 8 Sep 2026 01:08:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(admin):=20=E5=BE=AE=E4=BF=A1=E6=89=AB?= =?UTF-8?q?=E7=A0=81=E6=81=A2=E5=A4=8D=E5=89=8D=E5=8F=B0=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E6=8D=A2=E7=A0=81=E2=80=94=E2=80=94=E4=BF=AE=E5=A4=8D'?= =?UTF-8?q?=E5=B7=B2=E6=89=AB=E6=9C=AA=E7=A1=AE=E8=AE=A4=E8=A2=AB=E6=8D=A2?= =?UTF-8?q?=E7=A0=81=E4=B8=A2=E7=A1=AE=E8=AE=A4'=E7=AB=9E=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/web/src/admin/modules/channels/WeixinLogin.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/web/src/admin/modules/channels/WeixinLogin.tsx b/frontend/web/src/admin/modules/channels/WeixinLogin.tsx index 8e2a1f0..e99fa4b 100644 --- a/frontend/web/src/admin/modules/channels/WeixinLogin.tsx +++ b/frontend/web/src/admin/modules/channels/WeixinLogin.tsx @@ -118,14 +118,15 @@ export function WeixinLogin({ // Track tab visibility: while hidden, do NOT swap the QR (show "过期" overlay instead); // on returning, re-mint a fresh code if we were still waiting. useEffect(() => { + // Restoring the tab must NOT re-mint a QR: if the user has already scanned + // (but not confirmed) the on-screen code, swapping it mid-flow cancels the + // in-progress bind and WeChat's confirm never lands. Re-minting is only done + // by the periodic timer or the explicit 刷新二维码 button. const onVis = () => { - const h = document.hidden; - setHidden(h); - if (!h && statusRef.current === "waiting") refreshQR(); + setHidden(document.hidden); }; const onFocus = () => { setHidden(false); - if (statusRef.current === "waiting") refreshQR(); }; document.addEventListener("visibilitychange", onVis); window.addEventListener("focus", onFocus);