Compare commits

...

2 Commits

Author SHA1 Message Date
48b8aa0769 报错解决 2025-08-18 17:06:34 +08:00
14f4e59640 1.退出登录清除AI聊天 2025-08-18 17:04:32 +08:00
3 changed files with 35 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ import {
getTokenKeySessionStorage,
removeToken,
setTokenKeySessionStorage,
clearAllUserCache,
} from "@/utils/auth";
const user = {
@@ -92,7 +93,9 @@ const user = {
commit("SET_TOKEN", "");
commit("SET_ROLES", []);
commit("SET_PERMISSIONS", []);
removeToken();
commit("SET_USERINFO", {});
// 清理所有用户相关的缓存数据包括conversation_id
clearAllUserCache();
resolve();
})
.catch((error) => {
@@ -105,7 +108,11 @@ const user = {
FedLogOut({ commit }) {
return new Promise((resolve) => {
commit("SET_TOKEN", "");
removeToken();
commit("SET_ROLES", []);
commit("SET_PERMISSIONS", []);
commit("SET_USERINFO", {});
// 清理所有用户相关的缓存数据包括conversation_id
clearAllUserCache();
resolve();
});
},

View File

@@ -23,3 +23,28 @@ export function getTokenKeySessionStorage() {
export function removeToken() {
return Cookies.remove(TokenKey)
}
// 清理sessionStorage中的token
export function removeTokenFromSessionStorage() {
sessionStorage.removeItem(TokenKey)
}
// 清理AI聊天相关的localStorage数据
export function clearAIChatCache() {
localStorage.removeItem('conversation_id')
// 可以根据需要添加其他AI聊天相关的缓存清理
}
// 清理所有用户相关的缓存数据
export function clearAllUserCache() {
// 清理token相关
removeToken()
removeTokenFromSessionStorage()
// 清理AI聊天缓存
clearAIChatCache()
// 清理其他用户相关的localStorage数据
localStorage.removeItem('userId')
localStorage.removeItem('userName')
}

View File

@@ -86,7 +86,7 @@ export default {
name: "knzzgl",
value: 0,
url: "/hard/gl/xg"
}
},
{
label: "学工·学生证补办审核",
name: "xszb",