有关密码框都加上小眼睛控制密码显隐

This commit is contained in:
姚亚男
2021-10-22 11:09:47 +08:00
parent 8a819d829e
commit dcc0e8b1fa
12 changed files with 181 additions and 88 deletions
+37 -3
View File
@@ -11,10 +11,37 @@ Page({
newPassword: '', // 密码
verifyPassword: '', // 确认密码
rsaPublicKey: '',
flag: false
flag: false,
show: true, // 默认显示的是闭眼睛
showVerify: true,
type: 'password',
typeVerify: 'password'
},
bindBlurInput(e){
showPassword(){
if(this.data.show){ // 显示睁开眼睛的时候 type="text"
this.setData({
type: 'text',
show: false
})
}else{
this.setData({
type: 'password',
show: true
})
}
},
showPasswordVerify(){
if(this.data.showVerify){ // 显示睁开眼睛的时候 type="text"
this.setData({
typeVerify: 'text',
showVerify: false
})
}else{
this.setData({
typeVerify: 'password',
showVerify: true
})
}
},
// 登录
formSubmit(e) {
@@ -84,6 +111,10 @@ Page({
key: 'X-Access-Token',
data: that.data.password
})
wx.setStorage({
key: 'userInfo',
data: this.data.userInfo
})
// 绑定微信
this.wxBindPhone()
wx.switchTab({
@@ -111,6 +142,9 @@ Page({
UserApi.wxBind(params).then(res=>{})
})
},
onLoad(options){
this.data.userInfo = JSON.parse(options.userInfo)
},
/**
* 生命周期函数--监听页面显示
*/
+6 -2
View File
@@ -5,13 +5,17 @@
<view class="form-item">
<view class="text-label">密码</view>
<view class="text-value">
<input name="newPassword" bindblur="bindBlurInput" value="{{newPassword}}" type="password" placeholder="请输入密码" />
<input name="newPassword" bindblur="bindBlurInput" value="{{newPassword}}" type="{{type}}" placeholder="请输入密码" />
<image src="../../assets/images/show.png" class="show" wx:if="{{!show}}" bindtap="showPassword"></image>
<image src="../../assets/images/none.png" class="show" wx:if="{{show}}" bindtap="showPassword"></image>
</view>
</view>
<view class="form-item">
<view class="text-label">确认密码</view>
<view class="text-value">
<input name="verifyPassword" bindblur="bindBlurInput" value="{{verifyPassword}}" type="password" placeholder="请确认密码" />
<input name="verifyPassword" bindblur="bindBlurInput" value="{{verifyPassword}}" type="{{typeVerify}}" placeholder="请确认密码" />
<image src="../../assets/images/show.png" class="show" wx:if="{{!showVerify}}" bindtap="showPasswordVerify"></image>
<image src="../../assets/images/none.png" class="show" wx:if="{{showVerify}}" bindtap="showPasswordVerify"></image>
</view>
</view>
<view class="btn-area">
+11
View File
@@ -7,6 +7,9 @@ page {
.form-box{
transform: translateY(100%);
}
.text-value{
position: relative;
}
.set-password{
display: block;
font-size: 16px;
@@ -16,3 +19,11 @@ page {
margin-bottom: 20px;
letter-spacing: 0.5px;
}
.show{
width: 15px;
height: 15px;
position: absolute;
right: 10px;
top: 8px;
z-index: 9;
}