Procházet zdrojové kódy

手机验证界面

tags/2.2.4
Stormeye.Wu před 6 roky
rodič
revize
7b90e75a7a
3 změnil soubory, kde provedl 28 přidání a 17 odebrání
  1. +1
    -0
      app.json
  2. +26
    -16
      pages/phoneinput/phoneinput.js
  3. +1
    -1
      pages/phoneinput/phoneinput.json

+ 1
- 0
app.json Zobrazit soubor

@@ -4,6 +4,7 @@
"pages/bannerdetail/index", "pages/bannerdetail/index",
"pages/getuserinfo/index", "pages/getuserinfo/index",
"pages/getphoneInfo/index", "pages/getphoneInfo/index",
"pages/phoneinput/phoneinput",
"pages/market/index", "pages/market/index",
"pages/user/index", "pages/user/index",
"pages/coupon/detail/index", "pages/coupon/detail/index",


+ 26
- 16
pages/phoneinput/phoneinput.js Zobrazit soubor

@@ -31,7 +31,7 @@ Page({
}) })
.then(res => { .then(res => {
wx.redirectTo({ 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 => { .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() { send() {
var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/; var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/;
if (phoneReg.test(this.data.phone)) { if (phoneReg.test(this.data.phone)) {
this.setData({ this.setData({
flag: false,
retry: true retry: true
}) })
Http.get({ Http.get({
@@ -58,20 +74,14 @@ Page({
}) })
.then(res => { .then(res => {
console.log(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 => { .catch(error => {
wx.showToast({ wx.showToast({


+ 1
- 1
pages/phoneinput/phoneinput.json Zobrazit soubor

@@ -1,6 +1,6 @@
{ {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff", "navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "找回密码",
"navigationBarTitleText": "手机验证",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
} }

Načítá se…
Zrušit
Uložit