chore: save work before switching to dev

This commit is contained in:
2026-04-24 09:36:56 +08:00
parent 9e45acf60b
commit 415ba67d01
14 changed files with 587 additions and 583 deletions

View File

@@ -1,5 +1,11 @@
import Cookies from 'js-cookie';
/**
* 这些 key 属于登录态或用户会话上下文。
* 退出登录时只清理这部分数据,避免误删主题、语言、布局等本地个性化配置。
*/
const SESSION_AUTH_KEYS = ['token', 'userInfo', 'userMenu', 'permissions'];
/**
* window.localStorage 浏览器永久缓存
* @method set 设置永久缓存
@@ -33,6 +39,7 @@ export const Local = {
* @method get 获取临时缓存
* @method remove 移除临时缓存
* @method clear 移除全部临时缓存
* @method clearAuth 移除登录态相关缓存
*/
export const Session = {
// 设置临时缓存
@@ -56,4 +63,10 @@ export const Session = {
Cookies.remove('token');
window.sessionStorage.clear();
},
// 只清理登录态相关缓存,保留非登录相关的页面状态与本地配置
clearAuth() {
SESSION_AUTH_KEYS.forEach((key) => this.remove(key));
},
};
export { SESSION_AUTH_KEYS };