diff --git a/app.json b/app.json index 17ce9cc..d097115 100644 --- a/app.json +++ b/app.json @@ -4,6 +4,7 @@ "pages/bannerdetail/index", "pages/getuserinfo/index", "pages/getphoneInfo/index", + "pages/phoneinput/phoneinput", "pages/market/index", "pages/user/index", "pages/coupon/detail/index", diff --git a/pages/phoneinput/phoneinput.js b/pages/phoneinput/phoneinput.js index 8c37990..49c2a72 100644 --- a/pages/phoneinput/phoneinput.js +++ b/pages/phoneinput/phoneinput.js @@ -31,7 +31,7 @@ Page({ }) .then(res => { wx.redirectTo({ - url: '../coupon/detail/index?id=' + that.data.couponId + "&flag=pay", + url: '/pages/coupon/detail/index?id=' + that.data.couponId + "&flag=pay", }) }) .catch(error => { @@ -40,11 +40,27 @@ Page({ }) }) }, + //计时器 + timerInfo() { + var timer = setInterval(() => { + this.data.time-- + this.setData({ + time: this.data.time + }) + if (this.data.time == 0) { + clearInterval(timer) + this.setData({ + flag: true, + retry: false, + time: 60 + }) + } + }, 1000) + }, send() { var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/; if (phoneReg.test(this.data.phone)) { this.setData({ - flag: false, retry: true }) Http.get({ @@ -58,20 +74,14 @@ Page({ }) .then(res => { console.log(res) - var timer = setInterval(() => { - this.data.time-- - this.setData({ - time: this.data.time - }) - if (this.data.time == 0) { - clearInterval(timer) - this.setData({ - flag: true, - retry: false, - time: 60 - }) - } - }, 1000) + that.timerInfo() + if (res.code == 200) { + console.log(res) + } else { + wx.showToast({ + title: res.message + }) + } }) .catch(error => { wx.showToast({ diff --git a/pages/phoneinput/phoneinput.json b/pages/phoneinput/phoneinput.json index e12c62e..2c11417 100644 --- a/pages/phoneinput/phoneinput.json +++ b/pages/phoneinput/phoneinput.json @@ -1,6 +1,6 @@ { "backgroundTextStyle": "light", "navigationBarBackgroundColor": "#fff", - "navigationBarTitleText": "找回密码", + "navigationBarTitleText": "手机验证", "navigationBarTextStyle": "black" } \ No newline at end of file