diff --git a/me.html b/me.html index a415d89..97507ed 100644 --- a/me.html +++ b/me.html @@ -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"; });