系统优化

This commit is contained in:
Renpc-kilig 2020-08-06 16:55:58 +08:00
parent 8555f8c2cd
commit 6a356bdbad
3 changed files with 31 additions and 4 deletions

View File

@ -14,7 +14,10 @@ Page({
name: '',
idCard: '',
trueCode: '',
activityId: ''
activityId: '',
restTime: 120,
timer: '',
gotCode: false
},
getToken: function() {
var self = this;
@ -40,7 +43,23 @@ Page({
{}, null, function(code, data) {
console.log(data)
if('200' == code) {
self.setData({
gotCode: true
})
self.data.timer = setInterval(function () {
var cur = self.data.restTime - 1
if (cur == 0) {
clearInterval(self.data.timer)
self.setData({
restTime: 120,
gotCode: false
})
} else {
self.setData({
restTime: cur
})
}
}, 1000)
}
}, function(code, data) {
app.dialog.msg(data.msg)

View File

@ -41,7 +41,8 @@
<view class="info-box">
验证码:
<input placeholder="请输入验证码" model:value="{{code}}"></input>
<view class="get-code" bindtap="getCode">获取验证码</view>
<view class="get-code" bindtap="getCode" wx:if="{{!gotCode}}">获取验证码</view>
<view class="got-code" wx:if="{{gotCode}}">{{restTime}}</view>
</view>
<view class="info-box">
姓 名:

View File

@ -63,7 +63,7 @@
height: 40rpx;
margin-top: -5rpx;
}
.get-code{
.get-code, .got-code{
position: absolute;
top: 15rpx;
right: 0;
@ -73,6 +73,13 @@
color: #9F1512;
font-size: 26rpx;
}
.got-code{
width: 120rpx;
background: #eee;
color: #4a4d52;
border: 1px solid #eaeaea;
text-align: center;
}
.sign-box{
position: fixed;
bottom: 0;