| | |
| | | </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'">
|
| | |
| | | <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 }}
|
| | |
| | | };
|
| | | },
|
| | | 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() //隐藏已经显示的软键盘,如果软键盘没有显示则不做任何操作。
|