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

View File

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