From 0526419dbcab520d5f125d16cdc7f87ea111f730 Mon Sep 17 00:00:00 2001 From: lkddi Date: Sat, 25 Apr 2026 08:05:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E5=95=86=E5=BA=97=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E5=9F=BA=E7=A1=80=E6=8C=89=E9=92=AE=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/js/chat-room.js | 4 ++ resources/js/chat-room/shop-controls.js | 62 +++++++++++++++++++ .../chat/partials/layout/toolbar.blade.php | 10 +-- 3 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 resources/js/chat-room/shop-controls.js diff --git a/resources/js/chat-room.js b/resources/js/chat-room.js index 8c810f9..3af944e 100644 --- a/resources/js/chat-room.js +++ b/resources/js/chat-room.js @@ -21,6 +21,7 @@ export { } from "./chat-room/baccarat-loss-cover-admin.js"; export { bindFishingControls } from "./chat-room/fishing.js"; export { bindProfileControls } from "./chat-room/profile-controls.js"; +export { bindShopControls } from "./chat-room/shop-controls.js"; export { BLOCKABLE_SYSTEM_SENDERS, BLOCKED_SYSTEM_SENDERS_STORAGE_KEY, @@ -66,6 +67,7 @@ import { } from "./chat-room/baccarat-loss-cover-admin.js"; import { bindFishingControls } from "./chat-room/fishing.js"; import { bindProfileControls } from "./chat-room/profile-controls.js"; +import { bindShopControls } from "./chat-room/shop-controls.js"; import { BLOCKABLE_SYSTEM_SENDERS, BLOCKED_SYSTEM_SENDERS_STORAGE_KEY, @@ -117,6 +119,7 @@ if (typeof window !== "undefined") { submitBaccaratLossCoverEvent, bindFishingControls, bindProfileControls, + bindShopControls, CHAT_FONT_SIZE_STORAGE_KEY, restoreChatFontSize, closeChatImageLightbox, @@ -166,6 +169,7 @@ if (typeof window !== "undefined") { bindBaccaratLossCoverAdminControls(); bindFishingControls(); bindProfileControls(); + bindShopControls(); bindChatRightPanelControls(); bindMobileDrawerControls(); bindWelcomeMenuControls(); diff --git a/resources/js/chat-room/shop-controls.js b/resources/js/chat-room/shop-controls.js new file mode 100644 index 0000000..3391dd2 --- /dev/null +++ b/resources/js/chat-room/shop-controls.js @@ -0,0 +1,62 @@ +// 商店弹窗基础按钮事件绑定,替代 toolbar 商店区域内联 onclick。 + +let shopControlEventsBound = false; + +/** + * 调用商店存量全局函数。 + * + * @param {string} functionName 全局函数名 + * @returns {void} + */ +function callShopGlobal(functionName) { + if (typeof window[functionName] === "function") { + window[functionName](); + } +} + +/** + * 绑定商店关闭、改名和赠礼对话框按钮事件。 + * + * @returns {void} + */ +export function bindShopControls() { + if (shopControlEventsBound || typeof document === "undefined") { + return; + } + + shopControlEventsBound = true; + document.addEventListener("click", (event) => { + if (!(event.target instanceof Element)) { + return; + } + + if (event.target.closest("[data-shop-modal-close]")) { + event.preventDefault(); + callShopGlobal("closeShopModal"); + return; + } + + if (event.target.closest("[data-shop-rename-confirm]")) { + event.preventDefault(); + callShopGlobal("submitRename"); + return; + } + + if (event.target.closest("[data-shop-rename-cancel]")) { + event.preventDefault(); + callShopGlobal("closeRenameModal"); + return; + } + + if (event.target.closest("[data-shop-gift-confirm]")) { + event.preventDefault(); + callShopGlobal("confirmGift"); + return; + } + + if (event.target.closest("[data-shop-gift-cancel]")) { + event.preventDefault(); + callShopGlobal("closeGiftDialog"); + } + }); +} diff --git a/resources/views/chat/partials/layout/toolbar.blade.php b/resources/views/chat/partials/layout/toolbar.blade.php index e7ee2ee..b943a90 100644 --- a/resources/views/chat/partials/layout/toolbar.blade.php +++ b/resources/views/chat/partials/layout/toolbar.blade.php @@ -1066,7 +1066,7 @@ async function generateWechatBindCode() {
🛍 道具商店
💰 -- 金币
- + {{-- Toast --}} @@ -1083,8 +1083,8 @@ async function generateWechatBindCode() {

🎭 使用改名卡

- - + +
@@ -1103,9 +1103,9 @@ async function generateWechatBindCode() {
- -