diff --git a/public/css/chat.css b/public/css/chat.css index 830e7f4..bd9fd75 100644 --- a/public/css/chat.css +++ b/public/css/chat.css @@ -7,6 +7,11 @@ * @version 1.0.0 */ +/* Alpine.js x-cloak:初始化完成前完全隐藏,防止弹窗闪烁 */ +[x-cloak] { + display: none !important; +} + /* ═══════════════════════════════════════════════════ 原版海军蓝聊天室色系 (CHAT.CSS 复刻) ═══════════════════════════════════════════════════ */ diff --git a/resources/views/chat/partials/marriage-modals.blade.php b/resources/views/chat/partials/marriage-modals.blade.php index bb6eeab..7a426f7 100644 --- a/resources/views/chat/partials/marriage-modals.blade.php +++ b/resources/views/chat/partials/marriage-modals.blade.php @@ -1297,13 +1297,21 @@ // ───────── WebSocket 事件处理 ─────────────────────────── - /** 收到全局结婚公告 */ + /** 收到全局结婚公告:弹出全屏通知 + 追加公屏文字 */ window.addEventListener('chat:marriage-accepted', (e) => { const detail = e.detail; + const groomName = detail.user?.username ?? detail.groom_name ?? '??'; + const brideName = detail.partner?.username ?? detail.bride_name ?? '??'; + // 追加公屏消息 + if (typeof appendSystemMessage === 'function') { + appendSystemMessage(`💑 ${groomName} 与 ${brideName} 喜结连理!`); + } + // 弹出全屏公告(fireworks 效果) const el = document.getElementById('marriage-accepted-modal'); if (el) Alpine.$data(el).open(detail); }); + /** 收到求婚通知(私人频道,目标方) */ window.addEventListener('chat:marriage-proposed', (e) => { const detail = e.detail; @@ -1379,18 +1387,6 @@ window.chatDialog?.alert(`+${amount.toLocaleString()} 金币已到账 🎉`, '红包到手!', '#f59e0b'); }); - /** 结婚/离婚全局公告:弹出全屏通知 + 追加公屏文字 */ - window.addEventListener('chat:marriage-accepted', (e) => { - const detail = e.detail; - const groomName = detail.user?.username ?? detail.groom_name ?? '??'; - const brideName = detail.partner?.username ?? detail.bride_name ?? '??'; - if (typeof appendSystemMessage === 'function') { - appendSystemMessage(`💑 ${groomName} 与 ${brideName} 喜结连理!`); - } - // 触发全屏结婚公告弹窗(由 marriageAcceptedModal 组件监听此事件) - const modal = document.getElementById('marriage-accepted-modal')?._x_dataStack?.[0]; - if (modal && typeof modal.open === 'function') modal.open(detail); - }); window.addEventListener('chat:marriage-divorced', (e) => { const detail = e.detail;