lw-cdp-ui 1.5.49 → 1.5.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,10 +41,10 @@
41
41
  </template>
42
42
 
43
43
  <script>
44
- import bu from './bu.vue'
45
- import task from './task.vue'
46
- import empty from '@/assets/images/empty.jpg'
47
- import setting from './setting.vue'
44
+ import empty from '@/assets/images/empty.jpg';
45
+ import bu from './bu.vue';
46
+ import setting from './setting.vue';
47
+ import task from './task.vue';
48
48
  export default {
49
49
  props: {
50
50
  isShowBu: {
@@ -106,7 +106,8 @@ export default {
106
106
  }
107
107
  })
108
108
  }
109
-
109
+ // 更彻底地清除所有相关 cookie
110
+ this.clearAllCookies()
110
111
  window.location.href = '/#/passport-login'
111
112
  })
112
113
  .catch(() => {
@@ -123,6 +124,8 @@ export default {
123
124
  this.$store.commit('clearViewTags')
124
125
  this.$store.commit('clearKeepLive')
125
126
  this.$store.commit('clearIframeList')
127
+ // 更彻底地清除所有相关 cookie
128
+ this.clearAllCookies()
126
129
  window.location.href = this.$config?.LOGIN_URL || '/#/passport-login'
127
130
  })
128
131
  .catch(() => {
@@ -146,6 +149,28 @@ export default {
146
149
  //任务
147
150
  tasks() {
148
151
  this.tasksVisible = true
152
+ },
153
+ // 清除所有相关 cookie
154
+ clearAllCookies() {
155
+ // 清除 token cookie
156
+ document.cookie = 'token=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/';
157
+ document.cookie = 'token=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=' + window.location.hostname;
158
+
159
+ // 清除可能存在的其他认证相关 cookie
160
+ const cookies = document.cookie.split(';');
161
+ cookies.forEach(cookie => {
162
+ const eqPos = cookie.indexOf('=');
163
+ const name = eqPos > -1 ? cookie.substr(0, eqPos).trim() : cookie.trim();
164
+ // 清除常见的认证相关 cookie
165
+ if (name.includes('token') || name.includes('auth') || name.includes('session') || name.includes('user')) {
166
+ document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/';
167
+ document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=' + window.location.hostname;
168
+ }
169
+ });
170
+
171
+ // 清除 localStorage 和 sessionStorage 中的认证信息
172
+ localStorage.clear();
173
+ sessionStorage.clear();
149
174
  }
150
175
  }
151
176
  }