diff --git a/src/components/layout/index.vue b/src/components/layout/index.vue index 2d26bd7b1c0aafd2c5ed7df720fc3805f8356602..8e084f445ebb1bb5390ea784ce1791ff9aa9bac6 100644 --- a/src/components/layout/index.vue +++ b/src/components/layout/index.vue @@ -45,7 +45,7 @@
是否确认退出?
', - onOk: () => { - setTimeout(() => { - localStorage.removeItem("agcs") - this.allianceToken = "" - }, 500) + message: h("p", null, [h("span", null, "是否确认退出登录?")]), + showCancelButton: true, + confirmButtonText: "确定", + cancelButtonText: "取消", + beforeClose: (action, instance, done) => { + if (action === "confirm") { + instance.confirmButtonLoading = true + instance.confirmButtonText = "执行中..." + this.$store.dispatch("user/logout").then(() => { + this.allianceToken = "" + done() + instance.confirmButtonLoading = false + }) + } else { + done() + } }, - onCancel: () => {}, + }).then((action) => { + // this.$message({ + // type: "info", + // message: "action: " + action, + // }) }) }, }, @@ -247,6 +263,7 @@ export default { font-size: 20px; font-family: AlibabaPuHuiTiM; color: #ffffff; + margin: 10px 0; } .exit { font-size: 16px; diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 73d36c1cb5cccb0551511b6420395ab5401dfd81..8c2481d22f2e0716a61a39822655eb3a131e1850 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -35,6 +35,7 @@ const mutations = { setAccessToken(accessToken) }, setUserInfo(state, userInfo) { + localStorage.setItem("userInfo", JSON.stringify(userInfo)) state.userInfo = userInfo }, setGroup(state, group) {