Răsfoiți Sursa

fix: 注册校验修复

liangan 2 săptămâni în urmă
părinte
comite
de0af62d67
4 a modificat fișierele cu 9 adăugiri și 5 ștergeri
  1. 1 0
      src/locale/bn.json
  2. 1 0
      src/locale/en.json
  3. 1 0
      src/locale/zh-Hans.json
  4. 6 5
      src/pages/register/register.vue

+ 1 - 0
src/locale/bn.json

@@ -11,6 +11,7 @@
   "auth.register.loginNow": "এখনই লগইন করুন",
   "auth.register.error.emptyUsername": "অনুগ্রহ করে ব্যবহারকারীর নাম লিখুন",
   "auth.register.error.emptyPhone": "অনুগ্রহ করে ফোন নম্বর লিখুন",
+  "auth.register.error.invalidPhone": "অনুগ্রহ করে বৈধ বাংলাদেশি ফোন নম্বর লিখুন",
   "auth.register.error.emptyVerifyCode": "অনুগ্রহ করে ভেরিফিকেশন কোড লিখুন",
   "auth.register.error.emptyPassword": "অনুগ্রহ করে পাসওয়ার্ড লিখুন",
   "auth.register.error.passwordLength": "পাসওয়ার্ড 6-20 অক্ষরের মধ্যে হতে হবে",

+ 1 - 0
src/locale/en.json

@@ -11,6 +11,7 @@
   "auth.register.loginNow": "Login Now",
   "auth.register.error.emptyUsername": "Please enter username",
   "auth.register.error.emptyPhone": "Please enter phone number",
+  "auth.register.error.invalidPhone": "Please enter a valid Bangladesh phone number",
   "auth.register.error.emptyVerifyCode": "Please enter verification code",
   "auth.register.error.emptyPassword": "Please enter password",
   "auth.register.error.passwordLength": "Password should be 6-20 characters",

+ 1 - 0
src/locale/zh-Hans.json

@@ -11,6 +11,7 @@
   "auth.register.loginNow": "立即登录",
   "auth.register.error.emptyUsername": "请输入用户名",
   "auth.register.error.emptyPhone": "请输入手机号码",
+  "auth.register.error.invalidPhone": "请输入有效的孟加拉手机号",
   "auth.register.error.emptyVerifyCode": "请输入验证码",
   "auth.register.error.emptyPassword": "请输入密码",
   "auth.register.error.passwordLength": "密码应为6-20位字符",

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

@@ -166,10 +166,11 @@ function validateForm() {
       return
     }
 
-    // 验证手机号格式
-    const phoneRegex = /^1[3-9]\d{9}$/
-    if (!phoneRegex.test(formData.value.phone)) {
-      toast.error(t('auth.register.error.emptyPhone'))
+    // 孟加拉手机号校验:支持 01xxxxxxxxx 或 1xxxxxxxxx
+    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'))
       resolve(false)
       return
     }
@@ -290,7 +291,7 @@ onUnmounted(() => {
       </wd-form>
 
       <!-- 登录提示 -->
-      <view class="fixed bottom-20rpx left-0 w-full text-center" :style="{ paddingBottom: `${safeAreaInsets?.bottom + 20}px` }">
+      <view class="mt-300rpx w-full text-center" :style="{ paddingBottom: `${safeAreaInsets?.bottom + 20}px` }">
         <text class="text-28rpx text-#5C5C5C">
           By regstration,you agree to our
         </text>