From 8fd3bcc89dc183c72437bc04ffc753b488e39aef Mon Sep 17 00:00:00 2001 From: Pine Date: Thu, 10 Sep 2026 12:19:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(login):=20=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=A4=B1=E8=B4=A5=E6=97=B6=E5=90=8C=E6=A0=B7?= =?UTF-8?q?=E8=BF=9B=E5=85=A560s=E5=80=92=E8=AE=A1=E6=97=B6=E5=B9=B6?= =?UTF-8?q?=E7=A6=81=E7=94=A8=E6=8C=89=E9=92=AE=EF=BC=8C=E9=85=8D=E5=90=88?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=AB=AF=E5=86=B7=E5=8D=B4=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E9=98=BF=E9=87=8C=E4=BA=91=E6=B5=81=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- console/src/pages/Login/index.tsx | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/console/src/pages/Login/index.tsx b/console/src/pages/Login/index.tsx index 86dbd9d..0dc6cdf 100644 --- a/console/src/pages/Login/index.tsx +++ b/console/src/pages/Login/index.tsx @@ -267,21 +267,27 @@ export default function LoginPage() { const res = await authApi.sendCode(phone); message.success("验证码已发送"); setSmsStub(res.stub_code || ""); - setSmsCountdown(60); - const timer = window.setInterval(() => { - setSmsCountdown((c) => { - if (c <= 1) { - window.clearInterval(timer); - return 0; - } - return c - 1; - }); - }, 1000); + startSmsCountdown(); } catch (err) { message.error(err instanceof Error ? err.message : "发送失败"); + // 服务端存在 60s 发送冷却(阿里云分钟级流控),失败也进入倒计时,避免继续触发 + startSmsCountdown(); } }; + const startSmsCountdown = () => { + setSmsCountdown(60); + const timer = window.setInterval(() => { + setSmsCountdown((c) => { + if (c <= 1) { + window.clearInterval(timer); + return 0; + } + return c - 1; + }); + }, 1000); + }; + const onSmsLogin = async () => { setLoading(true); try {