|
|
@@ -16,7 +16,6 @@ import NormalButton from '../../../global/normal_button';
|
|
|
import NormalInput from '../../../global/normal_input';
|
|
|
import { useEffect, useState } from 'react';
|
|
|
import { useAuth } from '../../../../context/AuthProvider';
|
|
|
-import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
|
import Checkbox from 'expo-checkbox';
|
|
|
import { router } from 'expo-router';
|
|
|
@@ -67,11 +66,11 @@ const LoginPage: React.FC<LoginPageProps> = ({ goToNextPage, goToForgetPassWordP
|
|
|
const _login = async (username: string, password: string) => {
|
|
|
setIsLoading(true);
|
|
|
if (username === '' || password === '') {
|
|
|
- Alert.alert('請輸入資料', '請輸入電話號碼和密碼');
|
|
|
+ Alert.alert(t('login.alert.pleaseEnter'));
|
|
|
} else if (username.includes('@')) {
|
|
|
- Alert.alert('請綁定您的手機號碼', '客戶現在起只能使用已經綁定的手機號碼進行登入', [
|
|
|
- { text: '我要進行綁定', onPress: () => goToBindingPhoneNumberPage() },
|
|
|
- { text: '我已綁定,帶我回登入頁面', onPress: () => router.replace('/login') }
|
|
|
+ Alert.alert(t('login.alert.binding'), t('login.alert.binding1'), [
|
|
|
+ { text: t('login.alert.binding2'), onPress: () => goToBindingPhoneNumberPage() },
|
|
|
+ { text: t('login.alert.binding3'), onPress: () => router.replace('/login') }
|
|
|
]);
|
|
|
} else {
|
|
|
if (userTerms) {
|
|
|
@@ -87,10 +86,10 @@ const LoginPage: React.FC<LoginPageProps> = ({ goToNextPage, goToForgetPassWordP
|
|
|
await AsyncStorage.removeItem('savedPassword');
|
|
|
}
|
|
|
} else {
|
|
|
- Alert.alert('登入失敗', `原因: ${response}`);
|
|
|
+ Alert.alert(t('login.alert.error'), `${t('login.alert.reason')}: ${response}`);
|
|
|
}
|
|
|
} else {
|
|
|
- Alert.alert('請先同意用戶條款');
|
|
|
+ Alert.alert(t('login.alert.agree'));
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -129,18 +128,18 @@ const LoginPage: React.FC<LoginPageProps> = ({ goToNextPage, goToForgetPassWordP
|
|
|
className="mx-[5%] mt-4"
|
|
|
>
|
|
|
<Text className="text-lg text-center text-[#888888] font-[500]">
|
|
|
- {t('login.tip1')}<Text className="font-bold">必須</Text>綁定手機號碼才能登入
|
|
|
+ {t('login.tip1')}<Text className="font-bold"> {t('login.tip2')} </Text>{t('login.tip3')}
|
|
|
</Text>
|
|
|
<Pressable onPress={goToBindingPhoneNumberPage}>
|
|
|
<Text className="text-xl text-center text-[#02677D] font-[800] underline">
|
|
|
- 立即按我前往綁定頁面
|
|
|
+ {t('login.binding')}
|
|
|
</Text>
|
|
|
</Pressable>
|
|
|
|
|
|
<PhoneInput
|
|
|
value={loginPhone}
|
|
|
onChangeText={(phone) => setLoginPhone(phone)}
|
|
|
- placeholder="輸入電話號碼"
|
|
|
+ placeholder={t('login.phone')}
|
|
|
extendedStyle={{ borderRadius: 12, padding: 20 }}
|
|
|
textContentType="telephoneNumber"
|
|
|
autoComplete="tel"
|
|
|
@@ -150,7 +149,7 @@ const LoginPage: React.FC<LoginPageProps> = ({ goToNextPage, goToForgetPassWordP
|
|
|
<View className="relative">
|
|
|
<NormalInput
|
|
|
value={loginPassword}
|
|
|
- placeholder="密碼"
|
|
|
+ placeholder={t('login.password')}
|
|
|
onChangeText={(password) => setLoginPassword(password)}
|
|
|
secureTextEntry={!showPassword}
|
|
|
extendedStyle={{ borderRadius: 12, padding: 20, paddingRight: 50 }}
|
|
|
@@ -179,7 +178,7 @@ const LoginPage: React.FC<LoginPageProps> = ({ goToNextPage, goToForgetPassWordP
|
|
|
}}
|
|
|
/>
|
|
|
|
|
|
- <Text style={styles.text}>記住我的電話號碼</Text>
|
|
|
+ <Text style={styles.text}>{t('login.rememberPhone')}</Text>
|
|
|
|
|
|
</View>
|
|
|
<View className="flex flex-row items-center">
|
|
|
@@ -192,8 +191,8 @@ const LoginPage: React.FC<LoginPageProps> = ({ goToNextPage, goToForgetPassWordP
|
|
|
}}
|
|
|
/>
|
|
|
|
|
|
- <Text style={styles.text}>登入即同意
|
|
|
- <Text style={styles.userTerms} onPress={goToUserTermsPage}>用戶條款</Text>
|
|
|
+ <Text style={styles.text}>{t('login.termsofService')}
|
|
|
+ <Text style={styles.userTerms} onPress={goToUserTermsPage}>{t('login.termsofService1')}</Text>
|
|
|
</Text>
|
|
|
</View>
|
|
|
|
|
|
@@ -219,17 +218,17 @@ const LoginPage: React.FC<LoginPageProps> = ({ goToNextPage, goToForgetPassWordP
|
|
|
color: '#fff'
|
|
|
}}
|
|
|
>
|
|
|
- 登入
|
|
|
+ {t('login.signIn')}
|
|
|
</Text>
|
|
|
)
|
|
|
}
|
|
|
/>
|
|
|
<View className="flex flex-row justify-between relative">
|
|
|
<Pressable className="self-start" onPress={goToNextPage}>
|
|
|
- <Text style={styles.text}>註冊會員</Text>
|
|
|
+ <Text style={styles.text}>{t('login.register')}</Text>
|
|
|
</Pressable>
|
|
|
<Pressable className="self-start" onPress={() => goToForgetPassWordPage()}>
|
|
|
- <Text style={styles.text}>忘記密碼</Text>
|
|
|
+ <Text style={styles.text}>{t('login.forgotPassword')}</Text>
|
|
|
</Pressable>
|
|
|
</View>
|
|
|
</View>
|