Explorar el Código

fix: 优化手机号输入体验,11位自动触发检查

User hace 5 meses
padre
commit
d659c10c48
Se han modificado 1 ficheros con 10 adiciones y 0 borrados
  1. 10 0
      zxyj-frontend/pages/login/login.vue

+ 10 - 0
zxyj-frontend/pages/login/login.vue

@@ -17,6 +17,7 @@
           placeholder="请输入手机号" 
           maxlength="11"
           @blur="onPhoneBlur"
+          @input="onPhoneInput"
         />
       </view>
       
@@ -105,6 +106,15 @@ export default {
     handleImageError(e) {
       console.log('Logo加载失败,使用默认显示')
     },
+    // 手机号输入完成时检查(11位时触发)
+    onPhoneInput() {
+      if (this.phone.length === 11 && /^1[3-9]\d{9}$/.test(this.phone)) {
+        // 重置检查状态,准备检查新手机号
+        if (this.lastCheckedPhone !== this.phone) {
+          this.codeChecked = false
+        }
+      }
+    },
     onRoleChange(e) {
       this.role = e.detail.value
     },