From 52bec7ce8a53e4245af5ed872c31dbddf32a086a Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Thu, 16 Oct 2025 16:08:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Auth/AuthFormContent.js | 5 ---- src/components/Auth/VerificationCodeInput.js | 14 +++++++++- src/components/Auth/WechatRegister.js | 28 ++++++++++++++------ 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/components/Auth/AuthFormContent.js b/src/components/Auth/AuthFormContent.js index 8343bd05..38feb673 100644 --- a/src/components/Auth/AuthFormContent.js +++ b/src/components/Auth/AuthFormContent.js @@ -35,11 +35,6 @@ import AuthHeader from './AuthHeader'; import VerificationCodeInput from './VerificationCodeInput'; import WechatRegister from './WechatRegister'; -// API配置 -const isProduction = process.env.NODE_ENV === 'production'; -// 使用空字符串让请求通过 webpack proxy,避免跨域 cookie 问题 -const API_BASE_URL = ""; - // 统一配置对象 const AUTH_CONFIG = { // UI文本 diff --git a/src/components/Auth/VerificationCodeInput.js b/src/components/Auth/VerificationCodeInput.js index 61b40c75..bc251055 100644 --- a/src/components/Auth/VerificationCodeInput.js +++ b/src/components/Auth/VerificationCodeInput.js @@ -18,6 +18,18 @@ export default function VerificationCodeInput({ colorScheme = "green", isRequired = true }) { + // 包装 onSendCode,确保所有错误都被捕获,防止被 ErrorBoundary 捕获 + const handleSendCode = async () => { + try { + if (onSendCode) { + await onSendCode(); + } + } catch (error) { + // 错误已经在父组件处理,这里只需要防止未捕获的 Promise rejection + console.error('Send code error (caught in VerificationCodeInput):', error); + } + }; + return ( @@ -30,7 +42,7 @@ export default function VerificationCodeInput({ />