有关密码框都加上小眼睛控制密码显隐
This commit is contained in:
@@ -10,6 +10,8 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
show: true, // 默认显示的是闭眼睛
|
||||
type: 'password',
|
||||
form: {
|
||||
currdatetime: '',
|
||||
requestCodeSuccess: true,
|
||||
@@ -18,7 +20,19 @@ Page({
|
||||
rsaPublicKey: '', // 公钥
|
||||
flag: false
|
||||
},
|
||||
|
||||
showPassword(){
|
||||
if(this.data.show){ // 显示睁开眼睛的时候 type="text"
|
||||
this.setData({
|
||||
type: 'text',
|
||||
show: false
|
||||
})
|
||||
}else{
|
||||
this.setData({
|
||||
type: 'password',
|
||||
show: true
|
||||
})
|
||||
}
|
||||
},
|
||||
back(){
|
||||
wx.navigateBack({
|
||||
delta: 1
|
||||
@@ -108,21 +122,33 @@ Page({
|
||||
if(this.data.flag){
|
||||
UserApi.passWordLogin(params).then(res => {
|
||||
if(res.success){
|
||||
// 绑定微信
|
||||
this.wxBindPhone()
|
||||
// 存token和userInfo
|
||||
wx.setStorage({
|
||||
key: 'X-Access-Token',
|
||||
data: res.result.token
|
||||
})
|
||||
wx.setStorage({
|
||||
key: 'userInfo',
|
||||
data: res.result.userInfo
|
||||
})
|
||||
// 跳转首页
|
||||
wx.switchTab({
|
||||
url: '../home/home',
|
||||
})
|
||||
if(res.message == '请先用手机号登录'){
|
||||
wx.showToast({
|
||||
title: '首次登录请用验证码方式登录',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
setTimeout(() => {
|
||||
wx.navigateBack()
|
||||
}, 2000);
|
||||
return
|
||||
}else{
|
||||
// 绑定微信
|
||||
this.wxBindPhone()
|
||||
// 存token和userInfo
|
||||
wx.setStorage({
|
||||
key: 'X-Access-Token',
|
||||
data: res.result.token
|
||||
})
|
||||
wx.setStorage({
|
||||
key: 'userInfo',
|
||||
data: res.result.userInfo
|
||||
})
|
||||
// 跳转首页
|
||||
wx.switchTab({
|
||||
url: '../home/home',
|
||||
})
|
||||
}
|
||||
}else{
|
||||
wx.showToast({
|
||||
title: res.message,
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
<view class="form-item">
|
||||
<view class="text-label">密码</view>
|
||||
<view class="text-value">
|
||||
<input name="password" value="{{password}}" type="password" placeholder="请输入密码" />
|
||||
<input name="password" value="{{password}}" 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">
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
.text-label {
|
||||
width: 60px !important;
|
||||
}
|
||||
.text-value{
|
||||
position: relative;
|
||||
}
|
||||
.forget{
|
||||
color: #999;
|
||||
font-size: 14px;
|
||||
@@ -27,4 +30,12 @@
|
||||
width: 100%;
|
||||
height: 90%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.show{
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 8px;
|
||||
z-index: 9;
|
||||
}
|
||||
Reference in New Issue
Block a user