From 0c496c9e8a0465b187ac5f961d98470ca0697a11 Mon Sep 17 00:00:00 2001 From: fengchenchen Date: Thu, 24 Aug 2023 09:06:04 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90update=E3=80=91-token=E8=BF=87?= =?UTF-8?q?=E6=9C=9F=20=E9=80=80=E5=87=BA=E7=99=BB=E5=BD=95=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=20=E4=B8=8D=E8=B0=83=E7=94=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mixins/JeroListMixin.js | 2 +- src/screenRequest/request.js | 4 ++-- src/store/modules/user.js | 19 +++++++++++++++++++ src/utils/request.js | 4 ++-- .../modules/UploadMeetFileModal.vue | 2 +- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/mixins/JeroListMixin.js b/src/mixins/JeroListMixin.js index 4126af3..e0ee388 100644 --- a/src/mixins/JeroListMixin.js +++ b/src/mixins/JeroListMixin.js @@ -363,7 +363,7 @@ export const JeroListMixin = { okText: '重新登录', mask: false, onOk: () => { - store.dispatch('Logout').then(() => { + store.dispatch('LogoutNotRequest').then(() => { Vue.ls.remove(ACCESS_TOKEN) window.location.reload() }) diff --git a/src/screenRequest/request.js b/src/screenRequest/request.js index f649408..d2e950c 100644 --- a/src/screenRequest/request.js +++ b/src/screenRequest/request.js @@ -42,7 +42,7 @@ const err = (error) => { okText: '重新登录', mask: false, onOk: () => { - store.dispatch('Logout').then(() => { + store.dispatch('LogoutNotRequest').then(() => { Vue.ls.remove(ACCESS_TOKEN) try { let path = window.document.location.pathname @@ -149,7 +149,7 @@ function blobToJson(data) { okText: '重新登录', mask: false, onOk: () => { - store.dispatch('Logout').then(() => { + store.dispatch('LogoutNotRequest').then(() => { Vue.ls.remove(ACCESS_TOKEN) window.location.reload() }) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index f6b8dd7..b4c3cd3 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -185,6 +185,25 @@ const user = { }) }) }, + + // 登出 不调用接口 + LogoutNotRequest({ commit, state }) { + return new Promise((resolve) => { + commit('SET_TOKEN', '') + commit('SET_PERMISSIONLIST', []) + Vue.ls.remove(ACCESS_TOKEN) + Vue.ls.remove(USER_INFO) + Vue.ls.remove(USER_NAME) + Vue.ls.remove(UI_CACHE_DB_DICT_DATA) + Vue.ls.remove(CACHE_INCLUDED_ROUTES) + if (process.env.VUE_APP_SSO == 'true') { + let sevice = 'http://' + window.location.host + '/' + let serviceUrl = encodeURIComponent(sevice) + window.location.href = process.env.VUE_APP_CAS_BASE_URL + '/logout?service=' + serviceUrl + } + resolve() + }) + }, // 第三方登录 ThirdLogin({ commit }, param) { return new Promise((resolve, reject) => { diff --git a/src/utils/request.js b/src/utils/request.js index 9cd8c59..7913c49 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -49,7 +49,7 @@ const err = (error) => { okText: '重新登录', mask: false, onOk: () => { - store.dispatch('Logout').then(() => { + store.dispatch('LogoutNotRequest').then(() => { Vue.ls.remove(ACCESS_TOKEN) try { let path = window.document.location.pathname @@ -147,7 +147,7 @@ function blobToJson(data) { okText: '重新登录', mask: false, onOk: () => { - store.dispatch('Logout').then(() => { + store.dispatch('LogoutNotRequest').then(() => { Vue.ls.remove(ACCESS_TOKEN) window.location.reload() }) diff --git a/src/views/incomePayments/meetManage/modules/UploadMeetFileModal.vue b/src/views/incomePayments/meetManage/modules/UploadMeetFileModal.vue index 42c9ca6..dfff4be 100644 --- a/src/views/incomePayments/meetManage/modules/UploadMeetFileModal.vue +++ b/src/views/incomePayments/meetManage/modules/UploadMeetFileModal.vue @@ -441,7 +441,7 @@ export default { okText: '重新登录', mask: false, onOk: () => { - store.dispatch('Logout').then(() => { + store.dispatch('LogoutNotRequest').then(() => { Vue.ls.remove(ACCESS_TOKEN) window.location.reload() })