fix(ui): 完善界面交互与开发配置

This commit is contained in:
zhanjunhao
2026-11-18 19:09:00 +08:00
parent f8c451b7b8
commit 074c4422f9
87 changed files with 2212 additions and 2823 deletions
+19
View File
@@ -71,6 +71,21 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
}
};
// 前端校验:与 handleSubmit 内原有判断一致,改为在输入框下方就地提示
const codeRules = [
{
required: true,
message: useBackupCode ? t('请输入备用码') : t('请输入验证码'),
},
{
validator: (_, value) => {
if (!value) return true;
if (useBackupCode) return value.length === 8 || t('备用码必须是8位');
return /^\d{6}$/.test(value) || t('验证码必须是6位数字');
},
},
];
if (isModal) {
return (
<div className='space-y-4'>
@@ -88,6 +103,8 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
value={verificationCode}
onChange={setVerificationCode}
onKeyPress={handleKeyPress}
rules={codeRules}
trigger='blur'
style={{ marginBottom: 16 }}
autoFocus
/>
@@ -177,6 +194,8 @@ const TwoFAVerification = ({ onSuccess, onBack, isModal = false }) => {
value={verificationCode}
onChange={setVerificationCode}
onKeyPress={handleKeyPress}
rules={codeRules}
trigger='blur'
style={{ marginBottom: 16 }}
autoFocus
/>