修复弹窗闪烁:添加 [x-cloak] CSS 规则 + 删除重复的 chat:marriage-accepted 监听器
This commit is contained in:
@@ -7,6 +7,11 @@
|
|||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Alpine.js x-cloak:初始化完成前完全隐藏,防止弹窗闪烁 */
|
||||||
|
[x-cloak] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* ═══════════════════════════════════════════════════
|
/* ═══════════════════════════════════════════════════
|
||||||
原版海军蓝聊天室色系 (CHAT.CSS 复刻)
|
原版海军蓝聊天室色系 (CHAT.CSS 复刻)
|
||||||
═══════════════════════════════════════════════════ */
|
═══════════════════════════════════════════════════ */
|
||||||
|
|||||||
@@ -1297,13 +1297,21 @@
|
|||||||
|
|
||||||
// ───────── WebSocket 事件处理 ───────────────────────────
|
// ───────── WebSocket 事件处理 ───────────────────────────
|
||||||
|
|
||||||
/** 收到全局结婚公告 */
|
/** 收到全局结婚公告:弹出全屏通知 + 追加公屏文字 */
|
||||||
window.addEventListener('chat:marriage-accepted', (e) => {
|
window.addEventListener('chat:marriage-accepted', (e) => {
|
||||||
const detail = e.detail;
|
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');
|
const el = document.getElementById('marriage-accepted-modal');
|
||||||
if (el) Alpine.$data(el).open(detail);
|
if (el) Alpine.$data(el).open(detail);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/** 收到求婚通知(私人频道,目标方) */
|
/** 收到求婚通知(私人频道,目标方) */
|
||||||
window.addEventListener('chat:marriage-proposed', (e) => {
|
window.addEventListener('chat:marriage-proposed', (e) => {
|
||||||
const detail = e.detail;
|
const detail = e.detail;
|
||||||
@@ -1379,18 +1387,6 @@
|
|||||||
window.chatDialog?.alert(`+${amount.toLocaleString()} 金币已到账 🎉`, '红包到手!', '#f59e0b');
|
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) => {
|
window.addEventListener('chat:marriage-divorced', (e) => {
|
||||||
const detail = e.detail;
|
const detail = e.detail;
|
||||||
|
|||||||
Reference in New Issue
Block a user