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

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
+42 -16
View File
@@ -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,