Parcourir la source

fix: 注册校验修复

liangan il y a 2 semaines
Parent
commit
c00bb3cf90
1 fichiers modifiés avec 6 ajouts et 5 suppressions
  1. 6 5
      src/pages/register/register.vue

+ 6 - 5
src/pages/register/register.vue

@@ -48,10 +48,11 @@ async function getVerificationCode() {
     return
   }
 
-  // 验证手机号格式
-  const phoneRegex = /^1[3-9]\d{9}$/
-  if (!phoneRegex.test(formData.value.phone)) {
-    toast.error(t('auth.register.error.emptyPhone'))
+  // 孟加拉手机号校验:可接受本地格式 01xxxxxxxxx (11 位) 或去掉前导 0 的 1xxxxxxxxx (10 位)
+  const phoneDigits = formData.value.phone.replace(/\D/g, '')
+  const bdPhoneRegex = /^0?1\d{9}$/
+  if (!bdPhoneRegex.test(phoneDigits)) {
+    toast.error(t('auth.register.error.invalidPhone'))
     return
   }
 
@@ -291,7 +292,7 @@ onUnmounted(() => {
       </wd-form>
 
       <!-- 登录提示 -->
-      <view class="mt-300rpx w-full text-center" :style="{ paddingBottom: `${safeAreaInsets?.bottom + 20}px` }">
+      <view class="mt-140rpx w-full text-center" :style="{ paddingBottom: `${safeAreaInsets?.bottom + 20}px` }">
         <text class="text-28rpx text-#5C5C5C">
           By regstration,you agree to our
         </text>