当前位置:网站首页>Wechat applet payment password input
Wechat applet payment password input
2022-06-27 11:50:00 【Draw a flourishing fireworks with a black pencil】
wxml Code
<view catchtap='showInputLayer' class="btn_pay"> Pay now </view>
<!-- Password input box -->
<view wx:if='{
{showPayPwdInput}}'>
<view class='bg_layer'></view>
<view class='input_main'>
<view class='input_title'>
<view class='input_back' catchtap='hidePayLayer'><text></text></view>
<text> Enter payment password </text>
</view>
<view class='input_tip'><text> You need to verify your identity to use your membership card balance to pay , Payment can only be made after verification .</text></view>
<view class='input_row' catchtap='getFocus'>
<view class='pwd_item' wx:for='{
{6}}' wx:key='item' wx:for-index='i'>
<text wx:if='{
{pwdVal.length>i}}'></text>
</view>
</view>
<view class='forget_pwd' catchtap='hidePayLayer'> Forget the password </view>
<input class='input_control' password type='number' focus='{
{payFocus}}' bindinput='inputPwd' maxlength='6'/>
</view>
</view>
js Code
Page({
data: {
showPayPwdInput: false, // Whether the password input layer is displayed
pwdVal: '', // The password entered
payFocus: true, // Text box focus
},
onLoad: function () {
},
/**
* Display the payment password input layer
*/
showInputLayer: function(){
this.setData({ showPayPwdInput: true, payFocus: true });
},
/**
* Hide the payment password input layer
*/
hidePayLayer: function(){
let val = this.data.pwdVal;
this.setData({ showPayPwdInput: false, payFocus: false, pwdVal: '' });
},
/**
* Get focus
*/
getFocus: function(){
this.setData({ payFocus: true });
},
/**
* Enter password to listen
*/
inputPwd: function(e){
let that = this;
this.setData({ pwdVal: e.detail.value });
let pwd = e.detail.value;
if (e.detail.value.length >= 6){
if(pwd == '123456'){
this.hidePayLayer();
wx.showToast({
title: ' success ',
icon: 'success',
duration: 2000
})
}else{
this.hidePayLayer();
wx.showToast({
title: ' Failure ',
icon: 'error',
duration: 2000
})
}
}
}
})
wxss Code
.bg_layer {
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.6);
z-index: 9998;
}
.input_main {
position: fixed;
left: 0;
bottom: 500rpx;
width: 100%;
height: 394rpx;
background-color: #fff;
z-index: 9999;
}
.input_title {
width: 100%;
height: 90rpx;
line-height: 90rpx;
text-align: center;
font-size: 32rpx;
border-bottom: 1rpx solid #e2e2e2;
}
.input_back {
position: absolute;
left: 0;
top: 0;
width: 80rpx;
height: 90rpx;
display: flex;
justify-content: center;
align-items: center;
}
.input_back text {
width: 20rpx;
height: 20rpx;
background-color: white;
border: 1rpx solid #aaa;
border-width: 5rpx 0 0 5rpx;
transform: rotate(-45deg);
}
.input_tip {
margin: 30rpx;
font-size: 24rpx;
color: #888;
}
/* Password mask emulation */
.input_row {
width: 690rpx;
margin: 0 auto;
height: 98rpx;
position: relative;
display: flex;
align-items: center;
border: 1rpx solid #e2e2e2;
border-radius: 20rpx;
}
.input_row .pwd_item {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
height: 100%;
border-right: 1rpx solid #e2e2e2;
position: relative;
}
.pwd_item:nth-last-of-type(1) {
border-right: 0;
}
.pwd_item text {
width: 30rpx;
height: 30rpx;
border-radius: 30rpx;
background-color: #555;
}
.forget_pwd {
float: right;
margin: 30rpx;
width: 100rpx;
text-align: right;
font-size: 24rpx;
color: #ff7800;
}
/* Text input box position : Set to the left to hide */
.input_control {
position: relative;
left: -300rpx;
bottom: 0;
width: 100rpx;
height: 100rpx;
}
边栏推荐
- R语言使用MASS包的polr函数构建有序多分类logistic回归模型、使用VGAM包的vglm函数对有序多分类logistic回归模型进行平行性假设作检验
- Excel中输入整数却总是显示小数,如何调整?
- Uniform Asymptotics by Alexei
- In depth analysis of error solutions and problems in dynamic loading of unity shadow and outline components
- 巅峰小店APP仿站开发玩法模式讲解源码分享
- I.MX6ULL启动方式
- pull request
- R language uses the poisgof function of epidisplay package to test the goodness of fit of Poisson regression and whether there is overdispersion
- c/s 架构
- [tcapulusdb knowledge base] Introduction to tcapulusdb data structure
猜你喜欢
【TcaplusDB知识库】TcaplusDB单据受理-事务执行介绍
QStyle类用法总结(三)
0基础了解电商系统如何对接支付渠道
Oracle-多表查询
飞桨产业级开源模型库:加速企业AI任务开发与应用
[tcapulusdb knowledge base] tcapulusdb operation and maintenance doc introduction
The wonderful use of 0 length array in C language
Summary of qstype class usage (II)
【TcaplusDB知识库】TcaplusDB单据受理-建表审批介绍
一篇抄十篇,CVPR Oral被指大量抄袭
随机推荐
i.mx6ull(单片机) c语言环境搭建
Usage of rxjs mergemap
Matlab exercises - create 50 rows and 50 columns of all zero matrix, all 1 matrix, identity matrix, diagonal matrix, and output the 135 element of the matrix.
JSP custom tag
R language dplyr package arrange function sorts dataframe data, sorts dataframe data through multiple data columns, specifies the first field to be sorted in descending order, and does not specify the
杰理之DAC输出方式设置【篇】
15+城市道路要素分割应用,用这一个分割模型就够了!
Don't miss it. New media operates 15 treasure official account to share
[tcapulusdb knowledge base] Introduction to tmonitor system upgrade
Informatics Olympiad all in one 1332: [example 2-1] weekend dance
0基础了解电商系统如何对接支付渠道
R language uses the polR function of mass package to construct the ordered multi classification logistic regression model, and uses the vglm function of VGAM package to test the parallelism hypothesis
Codeforces Round #786 (Div. 3) ABCDE
【TcaplusDB知识库】TcaplusDB分析型文本导出介绍
deep learning statistical arbitrage
One copy ten, CVPR oral is accused of plagiarizing a lot
Jerry's constant feeding of dogs will cause frequent switch interruptions leading to timer [chapter]
0 basic understanding of how e-commerce systems connect with payment channels
杰理之睡眠以后定时唤醒系统继续跑不复位【篇】
等等, 怎么使用 SetMemoryLimit?