九月线上版本1.2.0

This commit is contained in:
xk_guohonglei
2020-09-09 17:07:57 +08:00
parent 856f0c8167
commit 0bcbc4b3e1
12 changed files with 125 additions and 102 deletions

View File

@@ -34,7 +34,7 @@
<view class="cu-form-group">
<view class="title text-black">手机号</view>
<input type="number" v-model="auth.phone" placeholder="请输入手机号" name="input"></input>
<button class='cu-btn bg-main-oil shadow' @tap="sendMsg">验证码</button>
<text :class="frozen?'text-gray':'oil-main-color'" @tap="sendMsg">{{tips}}</text>
</view>
<view class="cu-form-group">
<view class="title text-black">验证码</view>
@@ -71,6 +71,8 @@
mainURL: this.global.mainURL,
oilSiteNo: '',
oilSite: {},
tips: '发送验证码',
frozen: false, // 二维码冷却时间
auth: {
}
@@ -90,30 +92,53 @@
},
methods: {
sendMsg() {
uni.login({
provider: 'weixin',
success: loginRes => {
const code = loginRes.code
console.log(code)
const data2 = {
code: code,
name: this.auth.userName,
phone: this.auth.phone,
oilSiteCode: this.oilSiteNo
}
loginApi.registerWeixinSMS(data2).then(res => {
console.log('res', res)
uni.showToast({
title: res.msg,
icon: 'none'
})
if (!this.frozen) {
if (this.auth.phone) {
uni.login({
provider: 'weixin',
success: loginRes => {
const code = loginRes.code
console.log(code)
const data2 = {
code: code,
name: this.auth.userName,
phone: this.auth.phone,
oilSiteCode: this.oilSiteNo
}
loginApi.registerWeixinSMS(data2).then(res => {
console.log('res', res)
uni.showToast({
title: res.msg,
icon: 'none'
})
if (res.code === 20000) {
this.frozen = true
setTimeout(() => {
this.frozen = false
clearInterval(timer)
this.tips = `发送验证码`
}, 1000 * 60);
let second = 60
const timer = setInterval(() => {
second--
if (second) {
this.tips = `${second}秒后重发`
} else {
this.tips = `发送验证码`
}
}, 1000)
}
})
},
fail: err => {
console.log(err)
}
})
},
fail: err => {
console.log(err)
}
});
}
},
register() {
uni.login({