main
liudan 2 years ago
parent 7238db5633
commit 8380524d80
  1. 4
      api/modules/base.js
  2. 32
      pages/login.vue

@ -18,6 +18,10 @@ export default {
setCode(param){
return req.post("index/sendMsm", param)
},
//登录
smsLogin(param){
return req.post("index/msmLogin", param)
},
// 登录协议
getLoginProtocol(param) {
return req.post("index/getLoginProtocol", param)

@ -45,7 +45,7 @@
</u--input>
<!-- #endif -->
</view>
<u-button text="登录" :disabled="!phone||!code" class="loginBtn"></u-button>
<u-button text="登录" :disabled="!phone||!code" @click="smsLogin" class="loginBtn"></u-button>
<!-- <view >登录</view> -->
<view class="otherLogin">
<view class="line"></view>
@ -175,6 +175,21 @@
}
},
async smsLogin(){
let res = await this.$api.base.smsLogin({
phone:this.phone,
code:this.code
})
console.log(res,"---")
this.$util.showLoading({
title: "登录中..."
})
try {
this.toLogin(res)
} catch (e) {
this.$util.hideAll()
}
},
async toLogin(userInfo) {
let user_info = await this.$api.base.appLogin({
data: userInfo
@ -238,13 +253,14 @@
phone:this.phone
})
console.log(res,"999")
setTimeout(() => {
uni.hideLoading();
// this.start()
uni.$u.toast('验证码已发送');
//
this.$refs.uCode.start();
}, 2000);
if(res){
uni.hideLoading();
// this.start()
uni.$u.toast('验证码已发送');
//
this.$refs.uCode.start();
}
} else {
uni.$u.toast('倒计时结束后再发送');
}

Loading…
Cancel
Save