From e2cd78f6a07577319bd30f2d20144922631615e9 Mon Sep 17 00:00:00 2001 From: jinyaqiu Date: Fri, 8 Aug 2025 16:07:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=89=8B=E6=9C=BA=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/login/code.tsx | 42 +++---- components/login/phone.tsx | 57 ++------- components/login/phoneLogin.tsx | 4 +- components/login/signUp.tsx | 193 +++++++++++------------------- components/login/ui/TextInput.tsx | 17 ++- constants/Fonts.ts | 1 + 6 files changed, 113 insertions(+), 201 deletions(-) diff --git a/components/login/code.tsx b/components/login/code.tsx index 8d62af9..34e9206 100644 --- a/components/login/code.tsx +++ b/components/login/code.tsx @@ -115,13 +115,13 @@ const Code = ({ phone }: CodeProps) => { - + {t("auth.telLogin.codeTitle", { ns: 'login' })} - + {t("auth.telLogin.secondTitle", { ns: 'login' })} - + {phone} @@ -144,13 +144,13 @@ const Code = ({ phone }: CodeProps) => { /> - + {error} - + {t("auth.telLogin.sendAgain", { ns: 'login' })} { @@ -158,10 +158,16 @@ const Code = ({ phone }: CodeProps) => { sendVerificationCode() } }}> - 0 && styles.disabledResendText - ]}> + 0 && styles.disabledResendText + ]} + size="sm" + color="bgSecondary" + type="inter" + weight="bold" + > {countdown > 0 ? `${countdown}s${t("auth.telLogin.resend", { ns: 'login' })}` : t("auth.telLogin.resend", { ns: 'login' })} @@ -185,23 +191,13 @@ const styles = StyleSheet.create({ 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: 80, @@ -228,9 +224,6 @@ const styles = StyleSheet.create({ alignItems: 'center', }, errorText: { - fontSize: 16, - fontWeight: '500', - color: '#E2793F', marginLeft: 8, }, footerContainer: { @@ -238,12 +231,7 @@ const styles = StyleSheet.create({ justifyContent: 'center', marginTop: 8, }, - footerText: { - color: '#6B7280', - }, resendText: { - color: '#E2793F', - fontWeight: '500', marginLeft: 4, }, disabledResendText: { diff --git a/components/login/phone.tsx b/components/login/phone.tsx index 92d7409..fe5de0b 100644 --- a/components/login/phone.tsx +++ b/components/login/phone.tsx @@ -1,9 +1,9 @@ -import { fetchApi } from "@/lib/server-api-util"; import { useState } from "react"; import { useTranslation } from "react-i18next"; -import { ActivityIndicator, TextInput, TouchableOpacity, View } from "react-native"; -import { ThemedText } from "../ThemedText"; +import { View } from "react-native"; import { Steps } from "./phoneLogin"; +import Button from "./ui/Button"; +import TextInput from "./ui/TextInput"; interface LoginProps { setSteps: (steps: Steps) => void; @@ -18,67 +18,30 @@ const Phone = ({ setSteps, setPhone, phone, updateUrlParam }: LoginProps) => { const [error, setError] = useState(''); const sendVerificationCode = async () => { - if (!/^1[3-9]\d{9}$/.test(phone)) { - setError(t("auth.telLogin.phoneInvalid", { ns: 'login' })); - return; - } - - try { - setIsLoading(true); - - await fetchApi(`/iam/veritification-code`, { - method: 'POST', - body: JSON.stringify({ phone: phone }), - }) - setSteps('code') - updateUrlParam("status", "code"); - setIsLoading(false); - } catch (error) { - setPhone("") - setIsLoading(false); - // console.error(t("auth.telLogin.sendCodeError", { ns: 'login' }), error); - } + setSteps('code') + updateUrlParam("status", "code"); + return }; return {/* 手机号输入框 */} - - - {t('auth.telLogin.title', { ns: 'login' })} - - - {error} - - { setPhone(text); setError(''); }} keyboardType="email-address" autoCapitalize="none" + value={phone} + error={error} /> {/* 发送验证码 */} - - {isLoading ? ( - - ) : ( - - {t('auth.telLogin.sendCode', { ns: 'login' })} - - )} - +