系统优化

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: '', name: '',
idCard: '', idCard: '',
trueCode: '', trueCode: '',
activityId: '' activityId: '',
restTime: 120,
timer: '',
gotCode: false
}, },
getToken: function() { getToken: function() {
var self = this; var self = this;
@ -40,7 +43,23 @@ Page({
{}, null, function(code, data) { {}, null, function(code, data) {
console.log(data) console.log(data)
if('200' == code) { 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) { }, function(code, data) {
app.dialog.msg(data.msg) app.dialog.msg(data.msg)

View File

@ -41,7 +41,8 @@
<view class="info-box"> <view class="info-box">
验证码: 验证码:
<input placeholder="请输入验证码" model:value="{{code}}"></input> <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>
<view class="info-box"> <view class="info-box">
姓 名: 姓 名:

View File

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