From 7b938e37a2dc01aa3bdce32ddf80339b289bc29b Mon Sep 17 00:00:00 2001 From: jinyaqiu Date: Fri, 1 Aug 2025 15:26:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=AA=8C=E8=AF=81=E7=A0=81=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/login/code.tsx | 97 +++++++++++++++++++++++++++++--------- i18n/locales/en/login.json | 1 + i18n/locales/zh/login.json | 1 + 3 files changed, 77 insertions(+), 22 deletions(-) diff --git a/components/login/code.tsx b/components/login/code.tsx index 146ae80..8d62af9 100644 --- a/components/login/code.tsx +++ b/components/login/code.tsx @@ -112,26 +112,26 @@ const Code = ({ phone }: CodeProps) => { }, [countdown]); return ( - - - - - {t("auth.telLogin.title", { ns: 'login' })} + + + + + {t("auth.telLogin.codeTitle", { ns: 'login' })} - + {t("auth.telLogin.secondTitle", { ns: 'login' })} - + {phone} { setCode([code]); }} - onCodeFilled={(code) => { + onCodeFilled={() => { handleTelLogin() }} code={code.join('')} @@ -142,25 +142,26 @@ const Code = ({ phone }: CodeProps) => { placeholderCharacter="-" placeholderTextColor="#AC7E35" /> - + - + {error} - - + + {t("auth.telLogin.sendAgain", { ns: 'login' })} { - if (countdown > 0) { - return - } else { + if (countdown <= 0) { sendVerificationCode() } }}> - 0 ? '!text-gray-400' : ''}`}> + 0 && styles.disabledResendText + ]}> {countdown > 0 ? `${countdown}s${t("auth.telLogin.resend", { ns: 'login' })}` : t("auth.telLogin.resend", { ns: 'login' })} @@ -172,14 +173,38 @@ const Code = ({ phone }: CodeProps) => { const styles = StyleSheet.create({ container: { + flex: 1, + backgroundColor: '#FFFFFF', + }, + contentContainer: { flex: 1, justifyContent: 'center', + }, + headerContainer: { alignItems: 'center', - padding: 20, + marginBottom: 16, + }, + title: { + fontSize: 24, + fontWeight: '600', + marginBottom: 8, + paddingTop: 4, + color: '#111827', + }, + subtitle: { + fontSize: 16, + color: '#4B5563', + textAlign: 'center', + marginBottom: 4, + }, + phoneNumber: { + fontSize: 16, + fontWeight: '500', + color: '#E2793F', }, otpContainer: { width: '100%', - height: 100 + height: 80, }, underlineStyleBase: { width: 50, @@ -187,15 +212,43 @@ const styles = StyleSheet.create({ borderWidth: 0, borderRadius: 16, fontSize: 18, - color: '#000', + color: '#000000', textAlign: 'center', - backgroundColor: '#FFF8DE' + backgroundColor: '#FFF8DE', }, underlineStyleHighLighted: { borderColor: '#E2793F', backgroundColor: '#FFF8DE', borderWidth: 2, }, + errorContainer: { + width: '100%', + flexDirection: 'row', + justifyContent: 'flex-end', + alignItems: 'center', + }, + errorText: { + fontSize: 16, + fontWeight: '500', + color: '#E2793F', + marginLeft: 8, + }, + footerContainer: { + flexDirection: 'row', + justifyContent: 'center', + marginTop: 8, + }, + footerText: { + color: '#6B7280', + }, + resendText: { + color: '#E2793F', + fontWeight: '500', + marginLeft: 4, + }, + disabledResendText: { + color: '#9CA3AF', + }, }); -export default Code \ No newline at end of file +export default Code; \ No newline at end of file diff --git a/i18n/locales/en/login.json b/i18n/locales/en/login.json index 779e558..157d090 100644 --- a/i18n/locales/en/login.json +++ b/i18n/locales/en/login.json @@ -24,6 +24,7 @@ }, "telLogin": { "title": "Verify Your Identity", + "codeTitle": "Verify Your Identity", "secondTitle": "We’ve sent an email with your code to:", "sendCode": "send code", "continue": " Continue", diff --git a/i18n/locales/zh/login.json b/i18n/locales/zh/login.json index 96e1b5b..3ebd163 100644 --- a/i18n/locales/zh/login.json +++ b/i18n/locales/zh/login.json @@ -24,6 +24,7 @@ }, "telLogin": { "title": "请输入手机号", + "codeTitle": "请输入验证码", "secondTitle": "我们已发送验证码至:", "sendCode": "发送验证码", "continue": "继续",