feat: 优化
This commit is contained in:
parent
935753f6b3
commit
d728ea05c0
2
.env
2
.env
@ -1 +1 @@
|
|||||||
API_ENDPOINT=http://192.168.31.16:31646/api
|
API_ENDPOINT=https://api.memorywake.com/api
|
||||||
@ -136,6 +136,7 @@ const LoginScreen = () => {
|
|||||||
setShowPassword={setShowPassword}
|
setShowPassword={setShowPassword}
|
||||||
showPassword={showPassword}
|
showPassword={showPassword}
|
||||||
/>
|
/>
|
||||||
|
// <PhoneLogin />
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,10 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|||||||
|
|
||||||
// 懒加载组件
|
// 懒加载组件
|
||||||
import ChatSvg from '@/assets/icons/svg/chat.svg';
|
import ChatSvg from '@/assets/icons/svg/chat.svg';
|
||||||
import AskNavbar from '@/components/layout/ask';
|
|
||||||
import UploaderProgress from '@/components/file-upload/upload-progress/uploader-progress';
|
|
||||||
import SkeletonItem from '@/components/memo/SkeletonItem';
|
|
||||||
import ErrorBoundary from '@/components/common/ErrorBoundary';
|
import ErrorBoundary from '@/components/common/ErrorBoundary';
|
||||||
|
import UploaderProgress from '@/components/file-upload/upload-progress/uploader-progress';
|
||||||
|
import AskNavbar from '@/components/layout/ask';
|
||||||
|
import SkeletonItem from '@/components/memo/SkeletonItem';
|
||||||
|
|
||||||
// 类型定义
|
// 类型定义
|
||||||
import { useUploadManager } from '@/hooks/useUploadManager';
|
import { useUploadManager } from '@/hooks/useUploadManager';
|
||||||
@ -259,6 +259,7 @@ const MemoList = () => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{/* 底部导航栏 */}
|
{/* 底部导航栏 */}
|
||||||
|
<AskNavbar />
|
||||||
</View>
|
</View>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -37,20 +37,27 @@ const Code = ({ setSteps, phone }: LoginProps) => {
|
|||||||
setError('');
|
setError('');
|
||||||
const newCode = [...code];
|
const newCode = [...code];
|
||||||
|
|
||||||
// Handle pasted code from SMS
|
// Handle pasted code from SMS or autofill
|
||||||
if (text.length === 6 && /^\d{6}$/.test(text)) {
|
if ((text.length === 6 || text.length > 1) && /^\d+$/.test(text)) {
|
||||||
const digits = text.split('');
|
const digits = text.split('').slice(0, 6); // Ensure we only take first 6 digits
|
||||||
setCode(digits);
|
setCode(digits);
|
||||||
refs.current[5]?.focus(); // Focus on the last input after autofill
|
refs.current[5]?.focus(); // Focus on the last input
|
||||||
|
// Auto-submit if we have exactly 6 digits
|
||||||
|
if (digits.length === 6) {
|
||||||
|
handleTelLogin();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle manual input
|
// Handle single digit input
|
||||||
if (text.length <= 1) {
|
if (text.length <= 1 && /^\d?$/.test(text)) {
|
||||||
newCode[index] = text;
|
newCode[index] = text;
|
||||||
setCode(newCode);
|
setCode(newCode);
|
||||||
|
|
||||||
if (text) {
|
// Auto-submit if this is the last digit
|
||||||
|
if (text && index === 5) {
|
||||||
|
handleTelLogin();
|
||||||
|
} else if (text) {
|
||||||
focusNext(index, text);
|
focusNext(index, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,14 +152,16 @@ const Code = ({ setSteps, phone }: LoginProps) => {
|
|||||||
style={{ width: 40, height: 40 }}
|
style={{ width: 40, height: 40 }}
|
||||||
className="bg-[#FFF8DE] rounded-xl text-textTertiary text-3xl text-center"
|
className="bg-[#FFF8DE] rounded-xl text-textTertiary text-3xl text-center"
|
||||||
keyboardType="number-pad"
|
keyboardType="number-pad"
|
||||||
maxLength={1}
|
maxLength={6} // Allow pasting longer codes
|
||||||
textContentType="oneTimeCode" // For iOS autofill
|
|
||||||
autoComplete='sms-otp' // For Android autofill
|
|
||||||
value={digit}
|
value={digit}
|
||||||
onChangeText={text => handleCodeChange(text, index)}
|
onChangeText={text => handleCodeChange(text, index)}
|
||||||
onKeyPress={({ nativeEvent }) => focusPrevious(index, nativeEvent.key)}
|
onKeyPress={({ nativeEvent }) => focusPrevious(index, nativeEvent.key)}
|
||||||
selectTextOnFocus
|
selectTextOnFocus
|
||||||
caretHidden={true}
|
caretHidden={true}
|
||||||
|
autoFocus={index === 0}
|
||||||
|
textContentType="oneTimeCode"
|
||||||
|
autoComplete="one-time-code"
|
||||||
|
importantForAutofill="yes"
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
|
|||||||
@ -84,9 +84,13 @@ const SignUp = ({ updateUrlParam, setError, setShowPassword, showPassword }: Log
|
|||||||
}
|
}
|
||||||
if (password) {
|
if (password) {
|
||||||
// 校验密码是否符合规范
|
// 校验密码是否符合规范
|
||||||
const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;
|
// const passwordRegex = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/;
|
||||||
if (!passwordRegex.test(password)) {
|
// if (!passwordRegex.test(password)) {
|
||||||
setError(t('auth.signup.passwordAuth', { ns: 'login' }));
|
// setError(t('auth.signup.passwordAuth', { ns: 'login' }));
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
if (password.length < 6) {
|
||||||
|
setError(t('auth.signup.pwdLengthError', { ns: 'login' }));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,14 @@ function CarouselComponent(props: Props) {
|
|||||||
height={width * 0.75}
|
height={width * 0.75}
|
||||||
data={carouselDataValue || []}
|
data={carouselDataValue || []}
|
||||||
mode="parallax"
|
mode="parallax"
|
||||||
defaultIndex={carouselDataValue?.findIndex((item) => item?.key === 'total_count') - 1 || 0}
|
defaultIndex={
|
||||||
|
carouselDataValue?.length
|
||||||
|
? Math.max(0, Math.min(
|
||||||
|
carouselDataValue.length - 1,
|
||||||
|
carouselDataValue.findIndex((item) => item?.key === 'total_count') - 1
|
||||||
|
))
|
||||||
|
: 0
|
||||||
|
}
|
||||||
modeConfig={{
|
modeConfig={{
|
||||||
parallaxScrollingScale: 1,
|
parallaxScrollingScale: 1,
|
||||||
parallaxScrollingOffset: 150,
|
parallaxScrollingOffset: 150,
|
||||||
|
|||||||
@ -119,7 +119,8 @@
|
|||||||
"codeExpireTime": "Code will expire in",
|
"codeExpireTime": "Code will expire in",
|
||||||
"checkedRequired": "Please agree to the terms",
|
"checkedRequired": "Please agree to the terms",
|
||||||
"emailAuth": "Please enter a valid email address",
|
"emailAuth": "Please enter a valid email address",
|
||||||
"passwordAuth": "Please enter a valid password"
|
"passwordAuth": "Please enter a valid password",
|
||||||
|
"pwdLengthError": "Password length must be at least 6 characters"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +120,8 @@
|
|||||||
"codeExpireTime": "验证码将在以下时间后过期",
|
"codeExpireTime": "验证码将在以下时间后过期",
|
||||||
"checkedRequired": "请勾选协议",
|
"checkedRequired": "请勾选协议",
|
||||||
"emailAuth": "请输入一个有效的邮箱地址",
|
"emailAuth": "请输入一个有效的邮箱地址",
|
||||||
"passwordAuth": "请输入一个有效的密码"
|
"passwordAuth": "请输入一个有效的密码",
|
||||||
|
"pwdLengthError": "密码长度至少为6位"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user