|
|
@@ -8,6 +8,7 @@ Page({
|
|
|
*/
|
|
|
data: {
|
|
|
info:{},
|
|
|
+ text:'发送验证码',
|
|
|
labels: {
|
|
|
company: '单位', name: '姓名', tax_company: '发票单位', idcard: '身份证号',
|
|
|
email: '邮箱', sex: '性别', age: '年龄', title: '职称',
|
|
|
@@ -95,11 +96,12 @@ Page({
|
|
|
url: host + '/api/phcode',
|
|
|
method: 'POST',
|
|
|
data: { phone: this.data.phone },
|
|
|
- success: function (res) {
|
|
|
+ success: res => {
|
|
|
if (res.data.code == 0) {
|
|
|
wx.showToast({
|
|
|
title: '验证码已发送',
|
|
|
})
|
|
|
+ this.countdown()
|
|
|
} else {
|
|
|
wx.showToast({
|
|
|
title: '发送失败',
|
|
|
@@ -109,6 +111,21 @@ Page({
|
|
|
},
|
|
|
})
|
|
|
},
|
|
|
+ countdown: function () {
|
|
|
+ var time = 60, text;
|
|
|
+ var timer = setInterval(() => {
|
|
|
+ if (time > 0) {
|
|
|
+ time--;
|
|
|
+ text = time + 's'
|
|
|
+ } else {
|
|
|
+ text = '发送验证码'
|
|
|
+ clearInterval(timer)
|
|
|
+ }
|
|
|
+ this.setData({
|
|
|
+ text: text
|
|
|
+ })
|
|
|
+ }, 1000)
|
|
|
+ },
|
|
|
bindSexChange: function (e) {
|
|
|
this.setData({
|
|
|
sex: e.detail.value
|