You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
// pages/client/bank-add/index.js
|
|
import { postCaptcha, verifyCode } from "../../../api/user"
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
second: '获取验证码',
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
|
|
},
|
|
fetchCaptcha: function(){
|
|
if (!(/^1\d{10}$/.test(this.data.form.account)) || this.data.form.account.length < 11) {
|
|
util.showToast('请输入11位手机号码')
|
|
return
|
|
}
|
|
wx.showLoading({ title: '正在获取', mask: true })
|
|
postCaptcha({ verifiableAccount: this.data.form.account, verifiableAccountType: 1, purpose: 1 }).then(result => {
|
|
wx.hideLoading()
|
|
this.setData({ codeEnable: false })
|
|
util.showToast('验证码已经发送')
|
|
this.countDown = this.countDown || this.selectComponent('.count-down')
|
|
this.countDown.reset()
|
|
this.countDown.start()
|
|
}).catch(err => {
|
|
wx.hideLoading()
|
|
util.showToast(err)
|
|
})
|
|
},
|
|
onCountChange: function(e) {
|
|
if(e.detail.minutes != 0){
|
|
return
|
|
}
|
|
this.setData({ second: e.detail.seconds + ' 秒 ' })
|
|
},
|
|
onFinished: function(){
|
|
this.setData({ second: '重新获取验证码', codeEnable: true })
|
|
},
|
|
})
|