|
|
@@ -5,6 +5,7 @@ import { setStorage, STORAGE_KEYS, getUserId, getVisitedRoutes, setUserName } fr
|
|
|
import { updateUserUIState, getQQAuthUrl, getUserInfo } from '@/utils/api';
|
|
|
import { px2vmin } from '@/utils/viewport';
|
|
|
import { getOssUrl } from '@/utils/oss';
|
|
|
+import { validatePhoneNumber, isValidEmail } from '@/utils/validation';
|
|
|
|
|
|
// const giftProgressBar = getOssUrl('gift-progress-bar.png'); // Unused
|
|
|
// const wechatLogin = getOssUrl('wechat-login.png');
|
|
|
@@ -439,6 +440,13 @@ export const FirstLoginPage = () => {
|
|
|
onClick={() => {
|
|
|
// 手机号码或邮箱登录时,跳转到验证码页面
|
|
|
if (selectedLoginType === 'phone' && phoneNumber) {
|
|
|
+ // 校验手机号
|
|
|
+ const phoneValidation = validatePhoneNumber(phoneNumber, areaCode);
|
|
|
+ if (!phoneValidation.valid) {
|
|
|
+ message.error(phoneValidation.message || '手机号码格式不正确');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
navigate('/verification-code', {
|
|
|
state: {
|
|
|
loginType: 'phone',
|
|
|
@@ -447,6 +455,12 @@ export const FirstLoginPage = () => {
|
|
|
},
|
|
|
});
|
|
|
} else if (selectedLoginType === 'email' && email) {
|
|
|
+ // 校验邮箱格式
|
|
|
+ if (!isValidEmail(email)) {
|
|
|
+ message.error('请输入正确的邮箱地址');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
navigate('/verification-code', {
|
|
|
state: {
|
|
|
loginType: 'email',
|