迁移游戏大厅关闭事件
This commit is contained in:
@@ -32,6 +32,7 @@ export {
|
||||
submitBaccaratLossCoverEvent,
|
||||
} from "./chat-room/baccarat-loss-cover-admin.js";
|
||||
export { bindBaccaratLossCoverControls } from "./chat-room/baccarat-loss-cover.js";
|
||||
export { bindGameHallControls } from "./chat-room/game-hall.js";
|
||||
export {
|
||||
bankAction,
|
||||
bankLoadInfo,
|
||||
@@ -104,6 +105,7 @@ import {
|
||||
submitBaccaratLossCoverEvent,
|
||||
} from "./chat-room/baccarat-loss-cover-admin.js";
|
||||
import { bindBaccaratLossCoverControls } from "./chat-room/baccarat-loss-cover.js";
|
||||
import { bindGameHallControls } from "./chat-room/game-hall.js";
|
||||
import {
|
||||
bankAction,
|
||||
bankLoadInfo,
|
||||
@@ -179,6 +181,7 @@ if (typeof window !== "undefined") {
|
||||
closeAdminBaccaratLossCoverModal,
|
||||
closeCurrentBaccaratLossCoverEvent,
|
||||
bindBaccaratLossCoverControls,
|
||||
bindGameHallControls,
|
||||
loadAdminCurrentLossCoverEvent,
|
||||
openAdminBaccaratLossCoverModal,
|
||||
submitBaccaratLossCoverEvent,
|
||||
@@ -265,6 +268,7 @@ if (typeof window !== "undefined") {
|
||||
bindAdminMenuControls();
|
||||
bindBaccaratLossCoverAdminControls();
|
||||
bindBaccaratLossCoverControls();
|
||||
bindGameHallControls();
|
||||
bindBankControls();
|
||||
bindFishingControls();
|
||||
bindMarriageStatusControls();
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
// 娱乐大厅弹窗事件代理,替代静态关闭按钮内联 onclick。
|
||||
|
||||
let gameHallEventsBound = false;
|
||||
|
||||
/**
|
||||
* 关闭娱乐大厅弹窗。
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
function closeGameHallThroughGlobal() {
|
||||
// 游戏大厅加载、缓存和卡片行为仍在 Blade 旧脚本内,模块阶段只统一关闭入口。
|
||||
if (typeof window.closeGameHall === "function") {
|
||||
window.closeGameHall();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定娱乐大厅基础控件事件。
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
export function bindGameHallControls() {
|
||||
if (gameHallEventsBound || typeof document === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
gameHallEventsBound = true;
|
||||
document.addEventListener("click", (event) => {
|
||||
if (!(event.target instanceof Element) || !event.target.closest("[data-game-hall-close]")) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
closeGameHallThroughGlobal();
|
||||
});
|
||||
}
|
||||
@@ -50,7 +50,7 @@
|
||||
background:rgba(0,0,0,.2); padding:2px 8px; border-radius:10px;">
|
||||
💰 <strong id="game-hall-jjb" style="color:#ffe082; font-size:13px;">--</strong> 金币
|
||||
</div>
|
||||
<span onclick="closeGameHall()"
|
||||
<span data-game-hall-close
|
||||
style="cursor:pointer; font-size:18px; opacity:.8; line-height:1; transition:opacity .15s;"
|
||||
onmouseover="this.style.opacity=1" onmouseout="this.style.opacity=.8">×</span>
|
||||
</div>
|
||||
@@ -80,7 +80,7 @@
|
||||
<div
|
||||
style="background:#fff; border-top:1px solid #d0e4f5; padding:8px 16px;
|
||||
display:flex; justify-content:center; flex-shrink:0;">
|
||||
<button onclick="closeGameHall()"
|
||||
<button type="button" data-game-hall-close
|
||||
style="padding:5px 24px; background:#f0f6ff; border:1px solid #b0d0ee; border-radius:4px;
|
||||
font-size:12px; color:#336699; cursor:pointer; transition:all .15s;"
|
||||
onmouseover="this.style.background='#ddeeff'" onmouseout="this.style.background='#f0f6ff'">关闭</button>
|
||||
|
||||
Reference in New Issue
Block a user