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

微信小程序?qū)崿F(xiàn)接收驗(yàn)證碼

 更新時(shí)間:2022年05月24日 10:25:09   作者:keepfitt  
這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)接收驗(yàn)證碼,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了微信小程序?qū)崿F(xiàn)接收驗(yàn)證碼的具體代碼,供大家參考,具體內(nèi)容如下

效果如下圖:

wxml部分如下:

<!--驗(yàn)證碼-->
? <view class="mod t-name" style='position:relative'>
? ? <text class="key">驗(yàn)證碼:</text>
? ? <input type="digit" bindinput="bindKeyInput" data-inputname="phoneCode" value='{{phoneCode}}' class="input" maxlength="100" placeholder="請(qǐng)輸入手機(jī)驗(yàn)證碼" />
? ? <text class='logbook'></text>
? ? <text class='getkey' bindtap="clickGainCode">{{tipsCode}}</text>
</view>

css部分代碼如下:

.mod{
? display: flex;
? flex-direction: row;
? justify-content: space-between;
? align-items: center;
? height: 100rpx;
? padding: 0 20rpx;
? border-bottom:1rpx solid #ccc;
? box-sizing: border-box;
}
.mod .key{
? font-size: 28rpx;
? font-weight: bold;
? text-align: right;
? width: 160rpx;
}
.t-name{
? background-color: rgb(254,254,254);
? box-sizing: border-box;
}
.t-name .input{
? width: 540rpx;
? font-size: 28rpx;
? margin-left: 30rpx;
}
.logbook {
? font-size: 24rpx;
? width: 150rpx;
? text-align: right;
? font-weight: bold;
}

.getkey {
? width: 200rpx;
? position: absolute;
? right: 0rpx;
? text-align: center;
? color: rgb(31, 45, 210);
? font-size: 24rpx;
? border-left: 1px solid #f0f0f0;
}

js的data里定義如下內(nèi)容:

data: {
?? ??? ?tipsCode: "獲取驗(yàn)證碼",
? ? ?? ?timeNum: 60,
? ? ?? ?clikType: false,
? ? ?? ?phone: null,
? ? ?? ?phoneCode: null,
? ? ? }

獲取驗(yàn)證碼方法如下:

?bindKeyInput: function(e) {
? ? this.data[e.currentTarget.dataset.inputname] = e.detail.value;
? ? this.setData(this.data);
? },
? //獲取驗(yàn)證碼時(shí)的顯示時(shí)間
? getTime() {
? ? var that = this;
? ? var timer = setInterval(function() {
? ? ? that.data.timeNum--;
? ? ? if (that.data.timeNum <= 0) {
? ? ? ? that.setData({
? ? ? ? ? tipsCode: "重新獲取驗(yàn)證碼",
? ? ? ? ? timeNum: timeOut,
? ? ? ? ? clikType: false
? ? ? ? });
? ? ? ? clearInterval(timer);
? ? ? } else {
? ? ? ? that.setData({
? ? ? ? ? tipsCode: "重新發(fā)送" + that.data.timeNum + "秒",
? ? ? ? })
? ? ? }
? ? }, 1000)
? },

? //輸入手機(jī)號(hào)獲取驗(yàn)證碼
? gainCode() {
? ? var that = this;
? ? if (this.data.phone == '' || this.data.phone == null) {
? ? ? wx.showToast({
? ? ? ? title: '手機(jī)號(hào)不能為空',
? ? ? ? icon: 'none',
? ? ? })
? ? } ?else {
? ? ? that.setData({
? ? ? ? clikType: true
? ? ? })
? ? ? if (this.data.timeNum < timeOut) {
? ? ? } else {
? ? ? ? wx.request({
? ? ? ? ? url: wxapp_api_url + '/common/getCode',
? ? ? ? ? header: {
? ? ? ? ? ? 'content-type': 'application/x-www-form-urlencoded'
? ? ? ? ? },
? ? ? ? ? method: "get",
? ? ? ? ? data: {
? ? ? ? ? ? phone: this.data.phone
? ? ? ? ? },
? ? ? ? ? success: function(res) {
? ? ? ? ? ? that.getTime();
? ? ? ? ? }
? ? ? ? })
? ? ? }
? ? }
? },
? // 點(diǎn)擊獲取手機(jī)驗(yàn)證碼
? clickGainCode(e) {
? ? if (!this.data.clikType) {
? ? ? this.gainCode();
? ? }
? },

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

相關(guān)文章

最新評(píng)論

筠连县| 贡嘎县| 调兵山市| 始兴县| 信阳市| 星座| 龙岩市| 二连浩特市| 江陵县| 梓潼县| 板桥市| 长治市| 巴林右旗| 洛阳市| 平乐县| 水城县| 荔波县| 红河县| 沧源| 靖西县| 彭山县| 武定县| 英德市| 吉林省| 新营市| 祁东县| 额济纳旗| 永川市| 巨野县| 荥阳市| 长阳| 利辛县| 娱乐| 田林县| 古交市| 册亨县| 项城市| 南岸区| 石嘴山市| 长垣县| 贺州市|