diff --git a/server/public/index.html b/server/public/index.html index 7f576ce..e8729ed 100644 --- a/server/public/index.html +++ b/server/public/index.html @@ -139,9 +139,14 @@

小财记账

- +
+ + +
@@ -248,6 +253,16 @@ localStorage.removeItem('currentUser'); localStorage.removeItem('isAdmin'); } + function logout() { + if (ws) { ws.close(); ws = null; } + clearAuth(); + document.getElementById('login-page').classList.remove('hidden'); + document.getElementById('main-page').classList.add('hidden'); + currentRoom = null; + rooms = []; + document.getElementById('chat-list-container').innerHTML = ''; + document.getElementById('messages-container').innerHTML = ''; + } if (typeof marked !== 'undefined') marked.setOptions({ breaks: true, gfm: true, sanitize: false });