有关密码框都加上小眼睛控制密码显隐
This commit is contained in:
@@ -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)
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user