diff --git a/resources/views/chat/partials/scripts.blade.php b/resources/views/chat/partials/scripts.blade.php index 43af87d..e8764b1 100644 --- a/resources/views/chat/partials/scripts.blade.php +++ b/resources/views/chat/partials/scripts.blade.php @@ -1507,48 +1507,8 @@ return; } - if (!data.rooms || !data.rooms.length) { - container.innerHTML = - '
暂无房间
'; - return; - } - const roomRows = data.rooms.map(room => { - const roomId = Number.parseInt(room.id, 10); - if (!Number.isInteger(roomId)) { - return ''; - } - - const isCurrent = roomId === _currentRoomId; - const closed = !room.door_open; - const safeRoomName = escapeHtml(String(room.name ?? '')); - const safeOnlineCount = Math.max(Number.parseInt(room.online, 10) || 0, 0); - const bg = isCurrent ? '#ecf4ff' : '#fff'; - const border = isCurrent ? '#aac5f0' : '#e0eaf5'; - const nameColor = isCurrent ? '#336699' : (closed ? '#bbb' : '#444'); - const badge = safeOnlineCount > 0 ? - `${safeOnlineCount} 人` : - ``; - const currentTag = isCurrent ? - `当前` : - ''; - const clickAttributes = isCurrent ? '' : - `data-room-url="/room/${roomId}" data-room-hover-bg="#ddeeff" data-room-normal-bg="${bg}"`; - - return `
- - ${safeRoomName}${currentTag} - - ${badge} -
`; - }).filter(Boolean).join(''); - - container.innerHTML = roomRows || - '
暂无房间
'; + // 极端慢网下 Vite 可能还未挂载 ChatRoomTools,先显示空态,下一轮刷新会走模块渲染。 + container.innerHTML = '
暂无房间
'; }