fix: implement real logout in personal center

This commit is contained in:
light committed 2026-11-07 11:12:29 +08:00
1 parent 281f64209e
commit ef0cfec6d9
1 file changed
+17 -2
+17 -2
View File
@@ -1477,6 +1477,21 @@ html, body { height: 100%; margin: 0; }
toastTimer = window.setTimeout(function () { toast.classList.remove("is-visible"); }, 2200);
}
function logout() {
[
"access_token",
"open_token",
"user_info",
"team_id",
"team_score",
"current_session_id",
"trip_team_id",
"trip_team_score",
].forEach(function (key) { localStorage.removeItem(key); });
showToast("已退出登录");
window.setTimeout(function () { window.location.href = "/login/"; }, 300);
}
function goGenerate() { window.location.href = "/generate"; }
function goHome() { window.location.href = "/"; }
@@ -1518,7 +1533,7 @@ html, body { height: 100%; margin: 0; }
function setTab(tab) {
if (tab === "logout") {
showToast("已退出登录(演示)");
logout();
return;
}
@@ -1857,7 +1872,7 @@ html, body { height: 100%; margin: 0; }
copyText(uid, "用户 ID 已复制");
});
const logoutBtn = Array.prototype.slice.call(profilePanel.querySelectorAll("button")).find(function (b) { return b.textContent.trim() === "退出登录"; });
if (logoutBtn) logoutBtn.addEventListener("click", function () { showToast("已退出登录(演示)"); });
if (logoutBtn) logoutBtn.addEventListener("click", logout);
}
const invitePanel = panels.find(function (p) { return p.getAttribute("data-panel") === "invite"; });