fix(登录态): 退出和换人登录时整页重载,不留上一个人的数据
signOut 只清了 profile 和 localStorage,AI 分析、学情小结等 store 还在内存里。
机房一台机器轮着用,下一个学生登进来就能看到上一个人的 AI 分析。
- 主动退出:router.replace 换成 window.location.replace("/")
- 被动下线(会话过期、别的标签页登出)仍然原地弹登录框,学生正在写的代码不丢;
getMyProfile 记住本页最后一个登录的用户,登进来的换了人就整页重载
挨个 store 去 reset 迟早漏一个,重载一次最彻底。
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fb240d4254
commit
ca0dbbf0c5
2 files changed
+18
-2
No files matched your search
@@ -90,7 +90,9 @@ const active = computed(() => route.path.split("/")[1] || "problem")
|
||||
|
||||
async function handleLogout() {
|
||||
await userStore.signOut()
|
||||
router.replace("/")
|
||||
// 整页跳转而不是 router.replace:AI 分析、学情小结这些 store 还装着这个人的数据,
|
||||
// 机房下一个学生坐下来就能看到。重载一次把内存清干净,比挨个 reset 可靠。
|
||||
window.location.replace("/")
|
||||
}
|
||||
|
||||
function handleToggleDemoMode() {
|
||||
|
||||
Reference in new issue
Block a user