submit
This commit is contained in:
parent
b614ca7766
commit
3d9a85083f
@ -21,7 +21,8 @@
|
|||||||
<view style="position: relative" v-if="!loginStatus" class="t-a">
|
<view style="position: relative" v-if="!loginStatus" class="t-a">
|
||||||
<text class="txt">验证码</text>
|
<text class="txt">验证码</text>
|
||||||
<input name="code" maxlength="18" placeholder="请输入您的验证码" v-model="code" />
|
<input name="code" maxlength="18" placeholder="请输入您的验证码" v-model="code" />
|
||||||
<view class="sendCode" @click="send1" >发送</view>
|
<view v-if="showText" class="sendCode" @click="send1" >发送</view>
|
||||||
|
<view v-else class="sendCode" >{{second}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="reg" @tap="switchLogin()">切换{{loginStatus?'验证码':'密码'}}登录</view>
|
<view class="reg" @tap="switchLogin()">切换{{loginStatus?'验证码':'密码'}}登录</view>
|
||||||
<button @tap="login1()">登 录</button>
|
<button @tap="login1()">登 录</button>
|
||||||
@ -37,6 +38,8 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
showText:true,
|
||||||
|
second:60,
|
||||||
loading:false,
|
loading:false,
|
||||||
loginStatus:true,
|
loginStatus:true,
|
||||||
phone: '', //手机号码
|
phone: '', //手机号码
|
||||||
@ -47,30 +50,49 @@ export default {
|
|||||||
onLoad() {},
|
onLoad() {},
|
||||||
methods: {
|
methods: {
|
||||||
async send1(){
|
async send1(){
|
||||||
const data={
|
|
||||||
telNum:this.phone
|
|
||||||
}
|
|
||||||
const res= await send(data)
|
|
||||||
console.log(res,'send')
|
|
||||||
},
|
|
||||||
//当前登录按钮操作
|
|
||||||
async login1() {
|
|
||||||
this.loading=true
|
|
||||||
if (!this.phone) {
|
if (!this.phone) {
|
||||||
uni.showToast({ title: '请输入您的手机号', icon: 'none' });
|
uni.showToast({ title: '请输入您的手机号', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* if (!/^[1][3,4,5,7,8,9][0-9]{9}$/.test(this.phone)) {
|
const data={
|
||||||
uni.showToast({ title: '请输入正确手机号', icon: 'none' });
|
telNum:this.phone
|
||||||
|
}
|
||||||
|
const res= await send(data)
|
||||||
|
if (res.code===200){
|
||||||
|
let interval = setInterval(() => {
|
||||||
|
this.showText = false;
|
||||||
|
this.second = this.second - 1;
|
||||||
|
}, 1000);
|
||||||
|
setTimeout(() => {
|
||||||
|
clearInterval(interval);
|
||||||
|
this.second = 60;
|
||||||
|
this.showText = true;
|
||||||
|
}, 60000);
|
||||||
|
uni.showToast({ title:'发送成功', icon: 'none' });
|
||||||
|
}else {
|
||||||
|
uni.showToast({ title:res.err, icon: 'none' });
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
//当前登录按钮操作
|
||||||
|
async login1() {
|
||||||
|
if (!this.phone) {
|
||||||
|
uni.showToast({ title: '请输入您的手机号', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
}*/
|
}
|
||||||
if (!this.pwd) {
|
if (this.loginStatus&&!this.pwd) {
|
||||||
uni.showToast({ title: '请输入您的密码', icon: 'none' });
|
uni.showToast({ title: '请输入您的密码', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!this.loginStatus&&!this.code) {
|
||||||
|
uni.showToast({ title: '请输入您的验证码', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.loading=true
|
||||||
const data={
|
const data={
|
||||||
|
code:this.loginStatus?'':this.code,
|
||||||
telNum:this.phone,
|
telNum:this.phone,
|
||||||
password:this.pwd
|
password:this.loginStatus?this.pwd:''
|
||||||
}
|
}
|
||||||
const res=await login(data)
|
const res=await login(data)
|
||||||
if (res.code===0){
|
if (res.code===0){
|
||||||
|
Loading…
Reference in New Issue
Block a user