feat: 记住最后登录账号

This commit is contained in:
kuaifan 2021-12-22 21:19:22 +08:00
parent c120686fae
commit 8a7186c1b1
2 changed files with 5 additions and 1 deletions

View File

@ -59,7 +59,7 @@ export default {
codeUrl: this.$store.state.method.apiUrl('users/login/codeimg'),
loginType: 'login',
email: '',
email: this.$store.state.method.getStorageString("cacheLoginEmail") || '',
password: '',
password2: '',
code: '',
@ -143,6 +143,7 @@ export default {
},
}).then(({data}) => {
this.loadIng--;
this.$store.state.method.setStorage("cacheLoginEmail", this.email)
this.$store.dispatch("handleClearCache", data).then(() => {
this.goNext();
}).catch(() => {

View File

@ -388,6 +388,8 @@ export default {
handleClearCache({state, dispatch}, userInfo) {
return new Promise(function (resolve, reject) {
try {
const cacheLoginEmail = state.method.getStorageString("cacheLoginEmail");
//
window.localStorage.clear();
//
state.cacheUserBasic = [];
@ -397,6 +399,7 @@ export default {
state.cacheTasks = state.tasks = state.taskSubs = [];
//
state.method.setStorage("cacheTablePanel", state.cacheTablePanel);
state.method.setStorage("cacheLoginEmail", cacheLoginEmail);
dispatch("saveUserInfo", state.method.isJson(userInfo) ? userInfo : state.userInfo);
//
resolve()