From 2c9f3179c1d2da712f65300190afc3493ecc7a48 Mon Sep 17 00:00:00 2001 From: aixianling Date: Fri, 10 Jun 2022 16:24:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=A1=B5=E9=9D=A2=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=99=BB=E5=87=BA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/login.vue | 9 ++++++++- src/store/index.js | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pages/login.vue b/src/pages/login.vue index 4b100925..6c1ed547 100644 --- a/src/pages/login.vue +++ b/src/pages/login.vue @@ -47,7 +47,7 @@ export default { }, methods: { ...mapActions(['getToken']), - ...mapMutations(['login']), + ...mapMutations(['login', 'logout']), handleLogin() { this.$refs.loginForm.validate(v => { if (v) { @@ -65,6 +65,13 @@ export default { } }) }, + handleLogout() { + this.logout() + this.$http.delete("/auth/token/logout") + } + }, + onShow() { + this.handleLogout() }, mounted() { this.$refs.loginForm.setRules(this.rules) diff --git a/src/store/index.js b/src/store/index.js index 83e2f5e9..cabf098b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -24,6 +24,7 @@ const store = new Vuex.Store({ logout(state) { state.token = "" state.openUser = {} + state.user = {} }, setOpenUser(state, user) { state.openUser = user