You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<template> <view> <lf-nav title="设置密码" :showIcon="true"></lf-nav> <view class="content"> <view class="list"> <view class="lf-flex"> <input class="input" placeholder="请输入手机号" v-model="phone" maxlength="11" /> </view> <view class="clear" v-if="phone.length" @click="phone = ''"> <text class="lf-iconfont icon--"></text> </view> </view> <view class="list"> <view class="lf-flex"> <input class="input input-code" placeholder="请输入验证码" maxlength="8" v-model="code" /> </view> <view class="code" :class="{'active-bg': is_code}" @click="getCode"> <text>{{ is_code ? num +'秒后重新获取' : '获取验证码' }}</text> </view> </view> </view> <button class="next-btn" hover-class="lf-opacity" @click="next">下一步</button> <lf-pay-password v-if="show_pay" @comfirm="payComfirm"></lf-pay-password> </view></template>
<script> import lfPayPassword from '@/components/lf-payPassword/lf-payPassword.vue' export default { components: { lfPayPassword }, data(){ return { phone: '', code: '', is_code: false, timer: null, num: 10, show_pay: false } }, onLoad(){ }, onUnload(){ if(this.timer){ clearInterval(this.timer); this.timer = null; } }, methods: { getCode(){ if(this.is_code) return; this.is_code = true; if(this.timer){ clearInterval(this.timer); this.timer = null; } console.log("测试重复点击", Math.random()) // TODO 在此发送网络请求
this.timer = setInterval(() => { this.num--; if(this.num <= 0){ clearInterval(this.timer); this.timer = null; this.num = 10; this.is_code = false; } }, 1000); }, next(){ this.show_pay = true; }, payComfirm(event){ console.log("支付密码为:", event); this.show_pay = false; } } }</script>
<style lang="scss" scoped="scoped"> .content{ padding: 0 32rpx; } .next-btn{ width: 550rpx; height: 100rpx; background: #15716E; border-radius: 50rpx; position: fixed; bottom: 10vh; left: calc(50% - 275rpx); line-height: 100rpx; color: #FFFFFF; } .list{ height: 106rpx; width: 100%; border-bottom: 1rpx solid #e5e5e5; display: flex; justify-content: space-between; align-items: center; &:nth-child(2n){ margin-top: 30rpx; } .input{ width: 540rpx; height: 80rpx; font-size: 32rpx; } .input-code{ width: 430rpx; } .clear{ padding: 20rpx; } .code{ min-width: 180rpx; max-width: 220rpx; height: 64rpx; padding: 0 4rpx; font-size: 24rpx; color: #15716E; display: flex; justify-content: center; align-items: center; border-radius: 32rpx; border: 2rpx solid #15716E; } .active-bg{ background: #efefef; } }</style>
|