Commit cc09b294 authored by xiangzj's avatar xiangzj

登录成功记住账号密码

parent d762a457
......@@ -12,9 +12,9 @@
placeholder-class='placeholder-text' />
</view>
<view class="password-block" v-show="loginType==='password'">
<input ref="password" class="password" :cursor='cursorNumber' :password="!passwordVisible"
<input ref="password" class="password" :cursor='cursorNumber' type='text' :password="!passwordVisible"
v-model="password" placeholder="请输入密码" placeholder-class='placeholder-text' />
<template v-if="!passwordVisible">
<template v-if="passwordVisible">
<image class="icon-visible" src="../../static/image/visible@3x.png" mode="aspectFit"
@click="handlePasswordVisible"></image>
</template>
......@@ -57,9 +57,9 @@
export default {
data() {
return {
account: '0050000215',
account: '',
// password: 'DO1tjHPW0Z',
password: 'Wly12345',
password: '',
phone: '',
code: '',
loginType: 'password',
......@@ -108,6 +108,29 @@
// this.code = this.option.code
// }
},
//页面初始加载
mounted() {
let that = this;
//缓存的账号
const username = uni.getStorageSync('username');
//缓存的密码
const password = uni.getStorageSync('password');
console.log("密码",password,username)
//有缓存就赋值给文本没有就清空
if (username && password) {
that.account = username;
that.password = password;
} else {
that.account = '';
that.password = '';
}
that.handlePasswordVisible()
that.$nextTick(()=>{
setTimeout(function() {
that.handlePasswordVisible()
}, 100);
})
},
methods: {
// 切换密码可见性
handlePasswordVisible() {
......@@ -134,6 +157,8 @@
// status: 1
// }
if (res.status === 1) {
uni.setStorageSync('username', this.account);
uni.setStorageSync('password', this.password);
this.$uStore({
name: 'userInfo',
value: {
......@@ -297,4 +322,4 @@
font-size: 28rpx;
color: #666660;
}
</style>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment