小程序倒计时60秒以及解决ios页面晃动问题(前端网备份)

1》小程序ios页面晃动问题,上下晃动是因为机子本身问题,左右问题可以解决
.container{
padding-bottom: 0;
background-repeat: no-repeat;
background-size: 100% auto;
background-position: bottom center;
}
包个container
2》小程序倒计时60秒 以及倒计时的时候按钮无法点击 ,60秒之后重新
<form bindsubmit="formSubmit" bindreset="formReset">
<view class="weui-cells weui-cells_after-title">
<view class="weui-cell weui-cell_input">
<view class="weui-cellhd">
<view class="weui-label">手机号</view>
</view>
<view class="weui-cellbd">
<input class="weui-input"name="phone" placeholder="请输入手机号"/>
</view>
</view>
<view class="weui-cell weui-cell_input weui-cell_vcode">
<view class="weui-cellhd">
<view class="weui-label">验证码</view>
</view>
<view class="weui-cellbd">
<input class="weui-input" maxlength='6' name="yzm" placeholder="请输入验证码" />
</view>
<view class="weui-cell__ft">
<view style='width:160rpx;text-align:center;font-size:34rpx' data-id="2" bindtap="getBtn" class="buttonget weui-vcode-btn">{{time}}</view>
</view>
</view>
<view class="weui-cell weui-cell_input weui-cell_vcode"></view>
</view>

<view class='xzsf_bt'>
<button class="weui-btn" formType="submit" type="primary">确定</button>
</view>
</form>

js
data: {
nickName: wx.getStorageSync('nickName'),
head: wx.getStorageSync('head'),
time:"获取验证码",
currentTime:60,
disabled: true
},
formSubmit: function (res) {
console.log(res);
var phone = res.detail.value.phone;
var yzm = res.detail.value.yzm;
var rePhone = /^1\d{10}$/;
if (!rePhone.test(phone)) {
wx.showToast({
title: '请输入正确的手机号码',
icon: 'none',
duration: 2000
})
return;
}

var reyzms = /^\d{6}$/;
if (!reyzms.test(yzm)) {
  wx.showToast({
    title: '请输入正确的验证码',
    icon: 'none',
    duration: 2000
  })
  return;
}

},
getBtn: function (options) {
var that = this;
var currentTime = that.data.currentTime;
console.log(currentTime);
//这里是60秒内不能再点击
if (that.data.disabled){
that.setData({
time: currentTime + '秒',
disabled: false
})
var interval = setInterval(function () {
that.setData({
time: (currentTime - 1) + '秒',
})
currentTime--;
if (currentTime <= 50) {
clearInterval(interval)
that.setData({
time: '重新获取',
currentTime: 60,
disabled: true
})

    }

  }, 1000)
}

},

转载于:https://www.cnblogs.com/lsc-boke/p/10996880.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值