优化退出登录

This commit is contained in:
TOP糯米 2023-04-01 21:54:07 +08:00
parent 9489139da3
commit 6ba275d5b9
2 changed files with 10 additions and 6 deletions

View File

@ -253,11 +253,11 @@ export default {
* 注销登录 * 注销登录
*/ */
logout() { logout() {
return new Promise((resolve, reject) => {
prototype.$storage.set('user_access_token', null); prototype.$storage.set('user_access_token', null);
prototype.$storage.set('userinfo', null); prototype.$storage.set('userinfo', null);
$store.commit('user/token', ""); $store.commit('user/token', "");
prototype.$utils.toast('请重新登录').then(() => { return resolve();
prototype.$utils.toPage('/pages/index/index', {}, 'switch');
}); });
}, },
/** /**

View File

@ -60,7 +60,11 @@ export default {
this.$utils.toPage(url); this.$utils.toPage(url);
}, },
logout() { logout() {
this.$models.user.logout(); this.$models.user.logout().then(() => {
this.$utils.toast("请重新登录").then(() => {
this.$utils.toPage("/pages/index/index", {}, "switch");
});
});
}, },
}, },
}; };