From fb0a6f1f2107919bdfe8bd849e2cbf0a196f435d Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期五, 06 九月 2024 10:28:31 +0800
Subject: [PATCH] 1
---
pages/login/supplier-login.vue | 35 ++++++++++++++++++++++++++---------
1 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/pages/login/supplier-login.vue b/pages/login/supplier-login.vue
index ea5734f..99366f4 100644
--- a/pages/login/supplier-login.vue
+++ b/pages/login/supplier-login.vue
@@ -22,7 +22,7 @@
</view>
<view class="t-a input form-input" v-if="loginType=='pwd'">
<!-- <input type="text" name="userName" placeholder="请输入账号" v-model="userName" /> -->
- <u-input placeholder="请输入账号" :border="false" v-model="userName"></u-input>
+ <u-input placeholder="请输入账号" :border="false" v-model="userName" @blur="validatePhoneNumber()"></u-input>
</view>
<view class="t-a input form-input" v-if="loginType=='pwd'">
@@ -31,7 +31,7 @@
<view class="t-a input form-input" v-if="loginType=='code'">
- <u-input placeholder="请输入手机号" :border="false" v-model="phoneNumber">
+ <u-input placeholder="请输入手机号" :border="false" v-model="phoneNumber" @blur="validatePhoneNumber()">
<template slot="suffix">
<view class="get-code" :style="{'color':getCodeBtnColor}" @click.stop="getCode()">
{{ getCodeText }}
@@ -142,9 +142,9 @@
}
try {
if (!querydto.partnerUserId) {
- if (options.query && options.query.scene) {
+ if (options.query && options.query.scene || options.scene) {
//说明是特殊小程序二维码扫码跳转的
- var keyvalues = decodeURIComponent(options.query.scene).split("&")
+ var keyvalues = decodeURIComponent(options.query&&options.query.scene || options.scene).split("&")
for (var item of keyvalues) {
var tarr = item.split("=")
querydto[tarr[0]] = tarr[1]
@@ -385,7 +385,7 @@
getCodeText: '获取验证码',
getCodeBtnColor: "#20613D",
getCodeisWaiting: false,
- Timer: undefined,
+ Timer: undefined,
protocal:false,
// #ifdef PUB_SUPPLIER
apitype: 'loginSupplier',
@@ -400,6 +400,23 @@
};
},
methods: {
+ // 手机号码正则表达式校验
+ validatePhoneNumber() {
+
+ // 手机号码正则表达式,可以根据需要调整
+ const phoneRegex = /^[1][3-9][0-9]{9}$/;
+ if (this.loginType == 'pwd') {
+ if (!phoneRegex.test(this.userName)) {
+ this.$message.showToast('请填写正确手机号码')
+ }
+ }
+ if (this.loginType == 'code') {
+ if (!phoneRegex.test(this.phoneNumber)) {
+ this.$message.showToast('请填写正确手机号码')
+ }
+ }
+
+ },
async getCode() {
console.log('getCode')
uni.hideKeyboard() //隐藏已经显示的软键盘,如果软键盘没有显示则不做任何操作。
@@ -499,10 +516,10 @@
changeAll(e) {
this.pcfvalue = e.detail.value[0]
},
- async login() {
- if(!this.protocal){
- this.$message.showToast('请同意用户协议')
- return
+ async login() {
+ if(!this.protocal){
+ this.$message.showToast('请同意用户协议')
+ return
}
uni.showLoading({
title: '登陆中'
--
Gitblit v1.9.3