迁移买单前台弹窗事件
This commit is contained in:
@@ -31,6 +31,7 @@ export {
|
||||
openAdminBaccaratLossCoverModal,
|
||||
submitBaccaratLossCoverEvent,
|
||||
} from "./chat-room/baccarat-loss-cover-admin.js";
|
||||
export { bindBaccaratLossCoverControls } from "./chat-room/baccarat-loss-cover.js";
|
||||
export {
|
||||
bankAction,
|
||||
bankLoadInfo,
|
||||
@@ -102,6 +103,7 @@ import {
|
||||
openAdminBaccaratLossCoverModal,
|
||||
submitBaccaratLossCoverEvent,
|
||||
} from "./chat-room/baccarat-loss-cover-admin.js";
|
||||
import { bindBaccaratLossCoverControls } from "./chat-room/baccarat-loss-cover.js";
|
||||
import {
|
||||
bankAction,
|
||||
bankLoadInfo,
|
||||
@@ -176,6 +178,7 @@ if (typeof window !== "undefined") {
|
||||
bindBaccaratLossCoverAdminControls,
|
||||
closeAdminBaccaratLossCoverModal,
|
||||
closeCurrentBaccaratLossCoverEvent,
|
||||
bindBaccaratLossCoverControls,
|
||||
loadAdminCurrentLossCoverEvent,
|
||||
openAdminBaccaratLossCoverModal,
|
||||
submitBaccaratLossCoverEvent,
|
||||
@@ -261,6 +264,7 @@ if (typeof window !== "undefined") {
|
||||
bindToolbarControls();
|
||||
bindAdminMenuControls();
|
||||
bindBaccaratLossCoverAdminControls();
|
||||
bindBaccaratLossCoverControls();
|
||||
bindBankControls();
|
||||
bindFishingControls();
|
||||
bindMarriageStatusControls();
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
// 百乐加强买单活动前台弹窗事件代理,替代 Blade 内联 onclick。
|
||||
|
||||
let baccaratLossCoverEventsBound = false;
|
||||
|
||||
/**
|
||||
* 调用买单活动前台存量全局函数。
|
||||
*
|
||||
* @param {string} functionName 全局函数名
|
||||
* @param {...unknown} args 参数
|
||||
* @returns {void}
|
||||
*/
|
||||
function callLossCoverGlobal(functionName, ...args) {
|
||||
// 前台弹窗的数据加载、领取接口和金币同步仍由 Blade 旧脚本维护。
|
||||
if (typeof window[functionName] === "function") {
|
||||
window[functionName](...args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定买单活动前台弹窗关闭、Tab 切换与领取按钮事件。
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
export function bindBaccaratLossCoverControls() {
|
||||
if (baccaratLossCoverEventsBound || typeof document === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
baccaratLossCoverEventsBound = true;
|
||||
document.addEventListener("click", (event) => {
|
||||
if (!(event.target instanceof Element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.target.closest("[data-blc-close]")) {
|
||||
event.preventDefault();
|
||||
callLossCoverGlobal("closeBaccaratLossCoverModal");
|
||||
return;
|
||||
}
|
||||
|
||||
const tabButton = event.target.closest("[data-blc-tab]");
|
||||
if (tabButton) {
|
||||
event.preventDefault();
|
||||
callLossCoverGlobal("switchBaccaratLossCoverTab", tabButton.getAttribute("data-blc-tab") || "overview");
|
||||
return;
|
||||
}
|
||||
|
||||
const claimButton = event.target.closest("[data-blc-claim]");
|
||||
if (claimButton) {
|
||||
event.preventDefault();
|
||||
// 动态活动卡片只传活动 ID,领取流程继续复用旧全局函数。
|
||||
callLossCoverGlobal("claimBaccaratLossCover", claimButton.getAttribute("data-blc-claim") || "");
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user