修复:全员清屏改用 Echo 直接监听(不依赖编译产物)

- 从 CustomEvent 中转改为 window.Echo.join().listen() 直接监听
- Blade 模板同步即生效,无需 npm run build
This commit is contained in:
2026-02-26 23:20:02 +08:00
parent 065e82f8b7
commit 0e82c3fff0
@@ -507,9 +507,11 @@
document.getElementById('room-title-display').innerText = e.detail.title; document.getElementById('room-title-display').innerText = e.detail.title;
}); });
// ── 管理员全员清屏事件 ─────────────────────── // ── 管理员全员清屏事件(直接用 Echo 监听,不依赖编译产物) ───────
window.addEventListener('chat:screen-cleared', (e) => { if (window.Echo) {
const operator = e.detail.operator; window.Echo.join(`room.${window.chatContext.roomId}`)
.listen('ScreenCleared', (e) => {
const operator = e.operator;
// 清除公聊窗口(say1)所有消息 // 清除公聊窗口(say1)所有消息
const say1 = document.getElementById('say'); const say1 = document.getElementById('say');
@@ -541,6 +543,7 @@
say1.scrollTop = say1.scrollHeight; say1.scrollTop = say1.scrollHeight;
} }
}); });
}
// ── 发送消息(Enter 发送) ─────────────────────── // ── 发送消息(Enter 发送) ───────────────────────
document.getElementById('content').addEventListener('keydown', function(e) { document.getElementById('content').addEventListener('keydown', function(e) {