From b800f737fd21f5d2386f09919b26e8a95a546bd1 Mon Sep 17 00:00:00 2001 From: gg <109777030+yuf19-2022@users.noreply.github.com> Date: Wed, 12 Feb 2025 14:41:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=A1=E6=9C=89roomId=E6=97=B6=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E5=A4=B1=E8=B4=A5=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/www/index.js b/www/index.js index fcd5f38..fc747b6 100644 --- a/www/index.js +++ b/www/index.js @@ -141,12 +141,14 @@ function connectWebSocket() { console.error('WebSocket error:', error); if (error.target.readyState === WebSocket.CLOSED) { alert('密码错误或连接失败'); - // 显示密码输入框,隐藏主界面 - document.querySelector('.left').style.display = 'none'; - document.querySelector('.right').style.display = 'none'; - document.getElementById('passwordModal').style.display = 'block'; - document.getElementById('roomPasswordInput').value = ''; - document.getElementById('roomPasswordInput').focus(); + if (roomId) { + // 显示密码输入框,隐藏主界面 + document.querySelector('.left').style.display = 'none'; + document.querySelector('.right').style.display = 'none'; + document.getElementById('passwordModal').style.display = 'block'; + document.getElementById('roomPasswordInput').value = ''; + document.getElementById('roomPasswordInput').focus(); + } } }; } @@ -670,4 +672,4 @@ document.addEventListener('DOMContentLoaded', function() { if (window.innerWidth <= 768) { document.body.classList.remove('show-users'); } -}); \ No newline at end of file +});