移动端记住密码功能

jg-waiwang-pro
vayne 3 months ago
parent a62968fdcb
commit 331e000f3a

@ -188,7 +188,15 @@
this.isCode = needCode this.isCode = needCode
this.changeCode() this.changeCode()
this.getLoginConfig() this.getLoginConfig()
this.formData.password = ''; const userName = uni.getStorageSync('userName');
const userPsw = uni.getStorageSync('userPsw');
if(userName && userPsw){
this.formData.account = userName;
this.formData.password = userPsw;
}else{
this.formData.account = '';
this.formData.password = '';
}
if (options.data) { if (options.data) {
this.tenantUserInfo = JSON.parse(options.data) this.tenantUserInfo = JSON.parse(options.data)
if (this.tenantUserInfo) this.show = true if (this.tenantUserInfo) this.show = true
@ -444,6 +452,8 @@
let token = res.data.token let token = res.data.token
this.$store.commit('user/SET_TOKEN', token) this.$store.commit('user/SET_TOKEN', token)
uni.setStorageSync('token', token) uni.setStorageSync('token', token)
uni.setStorageSync("userName",this.formData.account)
uni.setStorageSync("userPsw",this.formData.password)
this.$store.dispatch('user/getCurrentUser').then((res) => { this.$store.dispatch('user/getCurrentUser').then((res) => {
this.loading = false this.loading = false
uni.switchTab({ uni.switchTab({

Loading…
Cancel
Save