修复:聊天室初次加载时附带历史消息,解决因网络延迟错失入场欢迎语的问题

This commit is contained in:
2026-02-28 11:17:09 +08:00
parent cb2e962116
commit 9a98bdfbe6
2 changed files with 23 additions and 5 deletions
+16
View File
@@ -103,6 +103,22 @@
@include('chat.partials.scripts')
{{-- 页面初始加载时,渲染自带的历史记录(解决入场欢迎语错过断网的问题) --}}
@if (!empty($historyMessages))
<script>
document.addEventListener('DOMContentLoaded', () => {
const historyMsgs = @json($historyMessages);
if (historyMsgs && historyMsgs.length > 0) {
// 全局函数 appendMessage 在 scripts.blade.php 中定义
historyMsgs.forEach(msg => {
if (typeof window.appendMessage === 'function') {
window.appendMessage(msg);
}
});
}
});
</script>
@endif
{{-- 进房特效自动播放:新人烟花礼包 / 周卡特效 --}}
@if (!empty($newbieEffect) || !empty($weekEffect))
<script>