最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

微信小程序?qū)崿F(xiàn)獲取手機(jī)號(hào)60s倒計(jì)時(shí)

 更新時(shí)間:2022年07月07日 17:25:11   作者:asteriaV  
這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)獲取手機(jī)號(hào)60s倒計(jì)時(shí),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了微信小程序?qū)崿F(xiàn)獲取手機(jī)號(hào)60s倒計(jì)時(shí)的具體代碼,供大家參考,具體內(nèi)容如下

1.效果:點(diǎn)擊獲取》60s倒計(jì)時(shí)》重新獲取

2.wxml

<view class="cu-form-group" style="border-top: 1rpx solid #eee;">
? ? ? <view class="title">手機(jī)號(hào)</view>
? ? ? <input name='phone' placeholder="請(qǐng)輸入新手機(jī)號(hào)" ?value="{{phone}}" type="number" bindinput="inputBindPhone" ></input>
? ? </view> ?
?
<view class="cu-form-group" style="border-bottom: 1rpx solid #eee;">
? ? ? <view class="title">驗(yàn)證碼</view>
? ? ? <input name='code' placeholder="請(qǐng)輸入驗(yàn)證碼" value="{[code]}" type="number" bindinput="inputBindCode"></input>
? ? ? <button class="cu-btn shadow {{disabled ? '':'bg-blue'}}" style="width:180rpx;height:72rpx;" ? bindtap='sendRegistCode'>{{time}}</button>
</view>

3.js

Page({
?
? /**
? ?* 頁(yè)面的初始數(shù)據(jù)
? ?*/
? data: {
? ? disabled:false,
? ? time: '點(diǎn)擊獲取',
? ? currentTime: 60,
? ? phone: '',
? ? code: '',
? },
?
??
? // 新手機(jī)號(hào)
? inputBindPhone: function (e) {
? ? console.log(e.detail.value)
? ? this.setData({
? ? ? phone: e.detail.value
? ? })
? },
? // 驗(yàn)證碼
? inputBindCode: function (e) {
? ? console.log(e.detail.value)
? ? this.setData({
? ? ? code: e.detail.value
? ? })
? },
?
? sendRegistCode: function(e){
? ? var that = this;
? ? var currentTime = that.data.currentTime;
? ? ? var interval;
? ? ? that.setData({
? ? ? ? time: currentTime + 's',
? ? ? ? disabled: true,
? ? ? })
? ? ? interval = setInterval(function () {
? ? ? ? that.setData({
? ? ? ? ? time: (currentTime - 1) + ' s'
? ? ? ? })
? ? ? ? currentTime--;
? ? ? ? if (currentTime <= 0) {
? ? ? ? ? clearInterval(interval)
? ? ? ? ? that.setData({
? ? ? ? ? ? time: '重新獲取',
? ? ? ? ? ? currentTime: 60,
? ? ? ? ? ? disabled: false
? ? ? ? ? })
? ? ? ? }
? ? ? }, 1000)
},
?
?
? formSubmit: function (e) {
? ? var that = this,
? ? ? value = e.detail.value,
? ? ? formId = e.detail.formId;
? ? // value.phone = this.data.phone
? ? // value.code = this.data.code
?
?
? ? var mPattern = /^1[3-9]\d{9}$/; //手機(jī)號(hào)碼
? ? var authReg = /^\d{4}$/; //4位純數(shù)字驗(yàn)證碼
? ? var notempty = /^\\S+$/; //非空
?
? ? if (this.data.phone == '' || this.data.phone == undefined) {
? ? ? return wx.showToast({
? ? ? ? title: '請(qǐng)輸入手機(jī)號(hào)碼',
? ? ? ? icon: 'none'
? ? ? })
? ? } else if (!mPattern.test(this.data.phone)) {
? ? ? return wx.showToast({
? ? ? ? title: '請(qǐng)輸入正確的手機(jī)號(hào)碼',
? ? ? ? icon: 'none'
? ? ? })
?
? ? } else {
? ? ? value.phone = this.data.phone
? ? ? console.log('value.phone', value.phone)
? ? }
?
?
? ? if (value.code == '' || value.code == undefined) {
? ? ? return wx.showToast({
? ? ? ? icon: 'none',
? ? ? ? title: '請(qǐng)輸入驗(yàn)證碼',
? ? ? });
? ? } else if (!authReg.test(this.data.code)) {
? ? ? return wx.showToast({
? ? ? ? title: '請(qǐng)輸入正確的驗(yàn)證碼',
? ? ? ? icon: 'none'
? ? ? })
?
? ? } else {
? ? ? value.code = this.data.code
? ? ? console.log('value.code', value.code)
? ? }
?
?
? ? wx.showToast({
? ? ? title: '提交成功',
? ? ? icon: 'success',
? ? ? duration: 2000,
? ? ? success: function () {
? ? ? ? ?console.log(value)
? ? ? ? that.setData({
? ? ? ? ? code: '',
? ? ? ? ? phone: ''?
? ? ? ? })
? ? ? }
? ? })
?
? },
??
?
})

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

平昌县| 东港市| 固始县| 贞丰县| 朔州市| 陇西县| 宜丰县| 青河县| 永德县| 阳原县| 齐河县| 深泽县| 定远县| 莲花县| 瑞金市| 漳浦县| 榆中县| 南开区| 德江县| 田林县| 冕宁县| 灌阳县| 都匀市| 盐边县| 社旗县| 芦溪县| 沧源| 堆龙德庆县| 于都县| 崇左市| 新津县| 武陟县| 从化市| 县级市| 抚远县| 青海省| 定西市| 通化市| 桃园县| 商水县| 邛崃市|