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){ setCode(param){
return req.post("index/sendMsm", param) return req.post("index/sendMsm", param)
}, },
//登录
smsLogin(param){
return req.post("index/msmLogin", param)
},
// 登录协议 // 登录协议
getLoginProtocol(param) { getLoginProtocol(param) {
return req.post("index/getLoginProtocol", param) return req.post("index/getLoginProtocol", param)

@ -45,7 +45,7 @@
</u--input> </u--input>
<!-- #endif --> <!-- #endif -->
</view> </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 >登录</view> -->
<view class="otherLogin"> <view class="otherLogin">
<view class="line"></view> <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) { async toLogin(userInfo) {
let user_info = await this.$api.base.appLogin({ let user_info = await this.$api.base.appLogin({
data: userInfo data: userInfo
@ -238,13 +253,14 @@
phone:this.phone phone:this.phone
}) })
console.log(res,"999") console.log(res,"999")
setTimeout(() => { if(res){
uni.hideLoading(); uni.hideLoading();
// this.start() // this.start()
uni.$u.toast('验证码已发送'); uni.$u.toast('验证码已发送');
// //
this.$refs.uCode.start(); this.$refs.uCode.start();
}, 2000); }
} else { } else {
uni.$u.toast('倒计时结束后再发送'); uni.$u.toast('倒计时结束后再发送');
} }

Loading…
Cancel
Save