From 918b88e5e2ad59add390a703151a0c8d9404b41b Mon Sep 17 00:00:00 2001 From: aixianling Date: Mon, 20 Jun 2022 11:01:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/App.vue | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/App.vue b/examples/App.vue index 2227e9d5..14fab565 100644 --- a/examples/App.vue +++ b/examples/App.vue @@ -44,14 +44,17 @@ export default { methods: { ...mapMutations(['setToken']), getToken(params) { - this.setToken([params.token_type, params.access_token].join(' ')) - this.dialog = false - this.$message.success("登录成功,正在刷新页面...") - location.reload() + if (params.access_token) { + this.setToken([params.token_type, params.access_token].join(' ')) + this.dialog = false + this.$message.success("登录成功,正在刷新页面...") + location.reload() + } else this.$message.error(params.msg || "登录失败!") + }, getUserInfo() { this.$axios.post("/admin/user/detail-phone").then(res => { - if (res && res.data) { + if (res?.data) { this.$store.commit("setUserInfo", res.data) if (/^\/project\/xiushan/.test(location.pathname)) { this.$store.commit("setFinanceUser") @@ -60,7 +63,7 @@ export default { }) }, handleLogin() { - this.$axios.delete("/auth/token/logout").then(() => { + this.$axios.delete("/auth/token/logout").finally(() => { this.dialog = true }) },