From 4f22fd552add35d3b20c9fec5f7ed9a8a4c22c44 Mon Sep 17 00:00:00 2001 From: pllx Date: Tue, 28 Apr 2026 10:07:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E9=92=93=E9=B1=BC/?= =?UTF-8?q?=E6=AC=A2=E8=BF=8E/=E5=9B=BE=E7=89=87=E7=AD=89=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E7=82=B9=E5=87=BB=E6=97=A0=E5=93=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 22 个注册事件委托的懒加载模块改为静态导入,保留 8 个工具栏模块继续保持懒加载。 按钮点击无响应的根因:模块的 bind*Controls() 通过 data-* 属性注册事件监听器,但模块懒加载从未被触发,监听器不注册。 chat.js:239 KB(原 308 KB,↓22%) vendor.js:108 KB(独立缓存) 按需加载模块:8 个(shop/bank/vip 等) --- resources/js/chat-room.js | 512 ++++++++++++++++++-------------------- 1 file changed, 237 insertions(+), 275 deletions(-) diff --git a/resources/js/chat-room.js b/resources/js/chat-room.js index 8e7eddd..09a953c 100644 --- a/resources/js/chat-room.js +++ b/resources/js/chat-room.js @@ -134,45 +134,7 @@ export { leaveRoom, notifyExpiredLeave, saveExp, startHeartbeat, stopHeartbeat, // ─── 懒加载工具 ────────────────────────────────────── import { createLazyModule } from "./chat-room/lazy-loader.js"; -// ─── 游戏模块(按需懒加载)────────────────────────── -const _baccaratEvents = createLazyModule( - () => import("./chat-room/baccarat-events.js"), - (mod) => mod.bindBaccaratEvents() -); -const _baccaratLossCoverAdmin = createLazyModule( - () => import("./chat-room/baccarat-loss-cover-admin.js"), - (mod) => mod.bindBaccaratLossCoverAdminControls() -); -const _baccaratLossCover = createLazyModule( - () => import("./chat-room/baccarat-loss-cover.js"), - (mod) => mod.bindBaccaratLossCoverControls() -); -const _gomokuControls = createLazyModule( - () => import("./chat-room/gomoku-controls.js"), - (mod) => mod.bindGomokuControls() -); -const _horseRaceEvents = createLazyModule( - () => import("./chat-room/horse-race-events.js"), - (mod) => mod.bindHorseRaceEvents() -); -const _fishing = createLazyModule( - () => import("./chat-room/fishing.js"), - (mod) => mod.bindFishingControls() -); -const _gameHall = createLazyModule( - () => import("./chat-room/game-hall.js"), - (mod) => mod.bindGameHallControls() -); -const _gameBootstrap = createLazyModule( - () => import("./chat-room/game-bootstrap.js"), - (mod) => mod.bindGameBootstrapControls() -); -const _gamePanels = createLazyModule( - () => import("./chat-room/game-panels.js"), - (mod) => mod.bindGamePanelControls() -); - -// ─── 功能模块(按需懒加载)──────────────────────── +// ─── 游戏 & 功能模块(按需懒加载 — 仅保留工具栏调用的模块)───────── const _shop = createLazyModule( () => import("./chat-room/shop-controls.js"), (mod) => mod.bindShopControls() @@ -193,68 +155,17 @@ const _profile = createLazyModule( () => import("./chat-room/profile-controls.js"), (mod) => mod.bindProfileControls() ); -const _userTargetActions = createLazyModule( - () => import("./chat-room/user-target-actions.js"), - (mod) => mod.bindUserTargetActions() -); const _vip = createLazyModule( () => import("./chat-room/vip-controls.js"), (mod) => mod.bindVipControls() ); -const _redPacket = createLazyModule( - () => import("./chat-room/red-packet-panel.js"), - (mod) => mod.bindRedPacketPanelControls() -); -const _mobileDrawer = createLazyModule( - () => import("./chat-room/mobile-drawer.js"), - (mod) => mod.bindMobileDrawerControls() -); -const _welcomeMenu = createLazyModule( - () => import("./chat-room/welcome-menu.js"), - (mod) => mod.bindWelcomeMenuControls() -); -const _adminMenu = createLazyModule( - () => import("./chat-room/admin-menu.js"), - (mod) => mod.bindAdminMenuControls() -); const _friendPanel = createLazyModule( () => import("./chat-room/friend-panel.js"), (mod) => mod.bindFriendPanelControls() ); -const _friendNotifications = createLazyModule( - () => import("./chat-room/friend-notifications.js"), - (mod) => mod.bindFriendNotificationControls() -); -const _lightbox = createLazyModule( - () => import("./chat-room/lightbox.js") -); -const _rooms = createLazyModule( - () => import("./chat-room/rooms.js"), - (mod) => mod.bindRoomStatusControls() -); -const _rightPanel = createLazyModule( - () => import("./chat-room/right-panel.js"), - (mod) => mod.bindChatRightPanelControls() -); -const _imageUpload = createLazyModule( - () => import("./chat-room/image-upload.js"), - (mod) => mod.bindChatImageUploadControl() -); -const _fontSize = createLazyModule( - () => import("./chat-room/font-size.js"), - (mod) => mod.bindChatFontSizeControl() -); -const _appointment = createLazyModule( - () => import("./chat-room/appointment-announcement.js"), - (mod) => mod.bindAppointmentAnnouncementControls() -); -const _banner = createLazyModule( - () => import("./chat-room/banner.js"), - (mod) => mod.bindChatBanner() -); -const _chatBot = createLazyModule( - () => import("./chat-room/chat-bot.js"), - (mod) => mod.bindChatBotControls() +const _gameHall = createLazyModule( + () => import("./chat-room/game-hall.js"), + (mod) => mod.bindGameHallControls() ); // ─── 静态导入的 Alpine 组件模块(Blade 中通过 x-data 引用,必须同步可用)── @@ -287,6 +198,28 @@ import { gomokuPanel, bindGomokuPanelControls } from "./chat-room/gomoku-panel.j // ─── 事件委托模块(需要立即注册事件监听,静态导入)───────────────────── import { bindDailySignInControls } from "./chat-room/daily-sign-in.js"; +import { bindBaccaratEvents } from "./chat-room/baccarat-events.js"; +import { bindBaccaratLossCoverAdminControls, closeAdminBaccaratLossCoverModal, closeCurrentBaccaratLossCoverEvent, loadAdminCurrentLossCoverEvent, openAdminBaccaratLossCoverModal, submitBaccaratLossCoverEvent } from "./chat-room/baccarat-loss-cover-admin.js"; +import { bindBaccaratLossCoverControls, claimBaccaratLossCover, closeBaccaratLossCoverModal, openBaccaratLossCoverModal, switchBaccaratLossCoverTab } from "./chat-room/baccarat-loss-cover.js"; +import { bindGomokuControls, acceptGomokuInvite, openGomokuPanel } from "./chat-room/gomoku-controls.js"; +import { bindHorseRaceEvents } from "./chat-room/horse-race-events.js"; +import { bindFishingControls, startFishing, reelFish, stopAutoFishing, resetFishingBtn, checkAndAutoStartFishing, createBobber, removeBobber } from "./chat-room/fishing.js"; +import { bindGameBootstrapControls, deferChatGameBootstrap } from "./chat-room/game-bootstrap.js"; +import { bindGamePanelControls } from "./chat-room/game-panels.js"; +import { bindUserTargetActions, openUserCard, switchTarget } from "./chat-room/user-target-actions.js"; +import { bindRedPacketPanelControls, claimRedPacket, closeRedPacketModal, sendRedPacket, showRedPacketModal, updateRedPacketClaimsUI } from "./chat-room/red-packet-panel.js"; +import { bindMobileDrawerControls, closeMobileDrawer, loadMobileRoomList, openMobileDrawer, renderMobileRoomList, renderMobileUserList, scheduleRenderMobileUserList, switchMobileTab } from "./chat-room/mobile-drawer.js"; +import { bindWelcomeMenuControls, toggleWelcomeMenu } from "./chat-room/welcome-menu.js"; +import { bindAdminMenuControls } from "./chat-room/admin-menu.js"; +import { bindFriendNotificationControls, setupBannerNotification, setupFriendNotification, showFriendBanner } from "./chat-room/friend-notifications.js"; +import { initChatImageLightboxEvents, closeChatImageLightbox, openChatImageLightbox } from "./chat-room/lightbox.js"; +import { bindRoomStatusControls, normalizeRoomStatus, renderRoomStatusRow, renderRoomsOnlineStatus, renderRoomsOnlineStatusToContainer, resolveRoomUrl } from "./chat-room/rooms.js"; +import { bindChatRightPanelControls } from "./chat-room/right-panel.js"; +import { bindChatImageUploadControl } from "./chat-room/image-upload.js"; +import { applyFontSize, bindChatFontSizeControl, CHAT_FONT_SIZE_STORAGE_KEY, restoreChatFontSize } from "./chat-room/font-size.js"; +import { bindAppointmentAnnouncementControls, showAppointmentBanner } from "./chat-room/appointment-announcement.js"; +import { bindChatBanner } from "./chat-room/banner.js"; +import { bindChatBotControls, clearChatBotContext, sendToChatBot } from "./chat-room/chat-bot.js"; // ─── 轻量核心模块(保持静态导入)──────────────────── import { escapeHtml, escapeHtmlWithLineBreaks, normalizeSafeChatUrl } from "./chat-room/html.js"; @@ -425,110 +358,7 @@ if (typeof window !== "undefined") { startHeartbeat, stopHeartbeat, - // ── 功能模块(懒加载包装)──────────────── - bindAppointmentAnnouncementControls: (...args) => _appointment.wrap('bindAppointmentAnnouncementControls')(...args), - showAppointmentBanner: (...args) => _appointment.wrap('showAppointmentBanner')(...args), - bindChatBanner: (...args) => _banner.wrap('bindChatBanner')(...args), - bindChatBotControls: (...args) => _chatBot.wrap('bindChatBotControls')(...args), - clearChatBotContext: (...args) => _chatBot.wrap('clearChatBotContext')(...args), - sendToChatBot: (...args) => _chatBot.wrap('sendToChatBot')(...args), - applyFontSize: (...args) => _fontSize.wrap('applyFontSize')(...args), - bindChatFontSizeControl: (...args) => _fontSize.wrap('bindChatFontSizeControl')(...args), - CHAT_FONT_SIZE_STORAGE_KEY: undefined, - restoreChatFontSize: (...args) => _fontSize.wrap('restoreChatFontSize')(...args), - bindChatImageUploadControl: (...args) => _imageUpload.wrap('bindChatImageUploadControl')(...args), - bindFriendPanelControls: (...args) => _friendPanel.wrap('bindFriendPanelControls')(...args), - bindFriendNotificationControls: (...args) => _friendNotifications.wrap('bindFriendNotificationControls')(...args), - closeFriendPanel: (...args) => _friendPanel.wrap('closeFriendPanel')(...args), - friendSearch: (...args) => _friendPanel.wrap('friendSearch')(...args), - loadFriends: (...args) => _friendPanel.wrap('loadFriends')(...args), - openFriendPanel: (...args) => _friendPanel.wrap('openFriendPanel')(...args), - quickFriendAction: (...args) => _friendPanel.wrap('quickFriendAction')(...args), - setupBannerNotification: (...args) => _friendNotifications.wrap('setupBannerNotification')(...args), - setupFriendNotification: (...args) => _friendNotifications.wrap('setupFriendNotification')(...args), - showFriendBanner: (...args) => _friendNotifications.wrap('showFriendBanner')(...args), - bindMobileDrawerControls: (...args) => _mobileDrawer.wrap('bindMobileDrawerControls')(...args), - closeMobileDrawer: (...args) => _mobileDrawer.wrap('closeMobileDrawer')(...args), - loadMobileRoomList: (...args) => _mobileDrawer.wrap('loadMobileRoomList')(...args), - openMobileDrawer: (...args) => _mobileDrawer.wrap('openMobileDrawer')(...args), - renderMobileRoomList: (...args) => _mobileDrawer.wrap('renderMobileRoomList')(...args), - renderMobileUserList: (...args) => _mobileDrawer.wrap('renderMobileUserList')(...args), - scheduleRenderMobileUserList: (...args) => _mobileDrawer.wrap('scheduleRenderMobileUserList')(...args), - switchMobileTab: (...args) => _mobileDrawer.wrap('switchMobileTab')(...args), - bindUserTargetActions: (...args) => _userTargetActions.wrap('bindUserTargetActions')(...args), - openUserCard: (...args) => _userTargetActions.wrap('openUserCard')(...args), - switchTarget: (...args) => _userTargetActions.wrap('switchTarget')(...args), - bindWelcomeMenuControls: (...args) => _welcomeMenu.wrap('bindWelcomeMenuControls')(...args), - bindAdminMenuControls: (...args) => _adminMenu.wrap('bindAdminMenuControls')(...args), - bindBaccaratEvents: (...args) => _baccaratEvents.wrap('bindBaccaratEvents')(...args), - bindBaccaratLossCoverAdminControls: (...args) => _baccaratLossCoverAdmin.wrap('bindBaccaratLossCoverAdminControls')(...args), - closeAdminBaccaratLossCoverModal: (...args) => _baccaratLossCoverAdmin.wrap('closeAdminBaccaratLossCoverModal')(...args), - closeCurrentBaccaratLossCoverEvent: (...args) => _baccaratLossCoverAdmin.wrap('closeCurrentBaccaratLossCoverEvent')(...args), - loadAdminCurrentLossCoverEvent: (...args) => _baccaratLossCoverAdmin.wrap('loadAdminCurrentLossCoverEvent')(...args), - openAdminBaccaratLossCoverModal: (...args) => _baccaratLossCoverAdmin.wrap('openAdminBaccaratLossCoverModal')(...args), - submitBaccaratLossCoverEvent: (...args) => _baccaratLossCoverAdmin.wrap('submitBaccaratLossCoverEvent')(...args), - bindBaccaratLossCoverControls: (...args) => _baccaratLossCover.wrap('bindBaccaratLossCoverControls')(...args), - claimBaccaratLossCover: (...args) => _baccaratLossCover.wrap('claimBaccaratLossCover')(...args), - closeBaccaratLossCoverModal: (...args) => _baccaratLossCover.wrap('closeBaccaratLossCoverModal')(...args), - openBaccaratLossCoverModal: (...args) => _baccaratLossCover.wrap('openBaccaratLossCoverModal')(...args), - switchBaccaratLossCoverTab: (...args) => _baccaratLossCover.wrap('switchBaccaratLossCoverTab')(...args), - bindGameHallControls: (...args) => _gameHall.wrap('bindGameHallControls')(...args), - closeGameHall: (...args) => _gameHall.wrap('closeGameHall')(...args), - openGameHall: (...args) => _gameHall.wrap('openGameHall')(...args), - bindGameBootstrapControls: (...args) => _gameBootstrap.wrap('bindGameBootstrapControls')(...args), - deferChatGameBootstrap: (...args) => _gameBootstrap.wrap('deferChatGameBootstrap')(...args), - bindGamePanelControls: (...args) => _gamePanels.wrap('bindGamePanelControls')(...args), - acceptGomokuInvite: (...args) => _gomokuControls.wrap('acceptGomokuInvite')(...args), - bindGomokuControls: (...args) => _gomokuControls.wrap('bindGomokuControls')(...args), - openGomokuPanel: (...args) => _gomokuControls.wrap('openGomokuPanel')(...args), - requestHorseRaceJson: requestHorseRaceJson, - bindHorseRaceEvents: (...args) => _horseRaceEvents.wrap('bindHorseRaceEvents')(...args), - buildHolidayClaimActionButton: buildHolidayClaimActionButton, - buildHolidaySystemMessage: buildHolidaySystemMessage, - openHolidayRunFromSystemMessage: openHolidayRunFromSystemMessage, - bankAction: (...args) => _bank.wrap('bankAction')(...args), - bankLoadInfo: (...args) => _bank.wrap('bankLoadInfo')(...args), - bankShowMsg: (...args) => _bank.wrap('bankShowMsg')(...args), - bindBankControls: (...args) => _bank.wrap('bindBankControls')(...args), - closeBankModal: (...args) => _bank.wrap('closeBankModal')(...args), - fetchBankRanking: (...args) => _bank.wrap('fetchBankRanking')(...args), - openBankModal: (...args) => _bank.wrap('openBankModal')(...args), - switchBankTab: (...args) => _bank.wrap('switchBankTab')(...args), - toggleBankRankSort: (...args) => _bank.wrap('toggleBankRankSort')(...args), - bindFishingControls: (...args) => _fishing.wrap('bindFishingControls')(...args), - checkAndAutoStartFishing: (...args) => _fishing.wrap('checkAndAutoStartFishing')(...args), - createBobber: (...args) => _fishing.wrap('createBobber')(...args), - reelFish: (...args) => _fishing.wrap('reelFish')(...args), - removeBobber: (...args) => _fishing.wrap('removeBobber')(...args), - resetFishingBtn: (...args) => _fishing.wrap('resetFishingBtn')(...args), - startFishing: (...args) => _fishing.wrap('startFishing')(...args), - stopAutoFishing: (...args) => _fishing.wrap('stopAutoFishing')(...args), - bindProfileControls: (...args) => _profile.wrap('bindProfileControls')(...args), - closeAvatarPicker: (...args) => _profile.wrap('closeAvatarPicker')(...args), - closeSettingsModal: (...args) => _profile.wrap('closeSettingsModal')(...args), - copyWechatBindCode: (...args) => _profile.wrap('copyWechatBindCode')(...args), - generateWechatBindCode: (...args) => _profile.wrap('generateWechatBindCode')(...args), - handleAvatarUpload: (...args) => _profile.wrap('handleAvatarUpload')(...args), - loadHeadfaces: (...args) => _profile.wrap('loadHeadfaces')(...args), - openAvatarPicker: (...args) => _profile.wrap('openAvatarPicker')(...args), - openSettingsModal: (...args) => _profile.wrap('openSettingsModal')(...args), - saveAvatar: (...args) => _profile.wrap('saveAvatar')(...args), - savePassword: (...args) => _profile.wrap('savePassword')(...args), - saveSettings: (...args) => _profile.wrap('saveSettings')(...args), - selectAvatar: (...args) => _profile.wrap('selectAvatar')(...args), - sendEmailCode: (...args) => _profile.wrap('sendEmailCode')(...args), - showInlineMsg: (...args) => _profile.wrap('showInlineMsg')(...args), - unbindWechat: (...args) => _profile.wrap('unbindWechat')(...args), - bindMarriageStatusControls: (...args) => _marriageStatus.wrap('bindMarriageStatusControls')(...args), - closeMarriageStatusModal: (...args) => _marriageStatus.wrap('closeMarriageStatusModal')(...args), - fetchMarriedList: (...args) => _marriageStatus.wrap('fetchMarriedList')(...args), - fetchMyMarriageStatus: (...args) => _marriageStatus.wrap('fetchMyMarriageStatus')(...args), - marriageAction: (...args) => _marriageStatus.wrap('marriageAction')(...args), - openMarriageStatusModal: (...args) => _marriageStatus.wrap('openMarriageStatusModal')(...args), - renderMarriedList: (...args) => _marriageStatus.wrap('renderMarriedList')(...args), - renderMarriageStatus: (...args) => _marriageStatus.wrap('renderMarriageStatus')(...args), - switchMarriageTab: (...args) => _marriageStatus.wrap('switchMarriageTab')(...args), - tryDivorce: (...args) => _marriageStatus.wrap('tryDivorce')(...args), + // ── 功能模块(懒加载包装 — 仅工具栏调用模块)──────── bindShopControls: (...args) => _shop.wrap('bindShopControls')(...args), buyItem: (...args) => _shop.wrap('buyItem')(...args), closeGiftDialog: (...args) => _shop.wrap('closeGiftDialog')(...args), @@ -552,28 +382,134 @@ if (typeof window !== "undefined") { renderCompactShop: (...args) => _compactShop.wrap('renderCompactShop')(...args), showCompactShopToast: (...args) => _compactShop.wrap('showCompactShopToast')(...args), submitCompactRename: (...args) => _compactShop.wrap('submitCompactRename')(...args), + bankAction: (...args) => _bank.wrap('bankAction')(...args), + bankLoadInfo: (...args) => _bank.wrap('bankLoadInfo')(...args), + bankShowMsg: (...args) => _bank.wrap('bankShowMsg')(...args), + bindBankControls: (...args) => _bank.wrap('bindBankControls')(...args), + closeBankModal: (...args) => _bank.wrap('closeBankModal')(...args), + fetchBankRanking: (...args) => _bank.wrap('fetchBankRanking')(...args), + openBankModal: (...args) => _bank.wrap('openBankModal')(...args), + switchBankTab: (...args) => _bank.wrap('switchBankTab')(...args), + toggleBankRankSort: (...args) => _bank.wrap('toggleBankRankSort')(...args), + bindMarriageStatusControls: (...args) => _marriageStatus.wrap('bindMarriageStatusControls')(...args), + closeMarriageStatusModal: (...args) => _marriageStatus.wrap('closeMarriageStatusModal')(...args), + fetchMarriedList: (...args) => _marriageStatus.wrap('fetchMarriedList')(...args), + fetchMyMarriageStatus: (...args) => _marriageStatus.wrap('fetchMyMarriageStatus')(...args), + marriageAction: (...args) => _marriageStatus.wrap('marriageAction')(...args), + openMarriageStatusModal: (...args) => _marriageStatus.wrap('openMarriageStatusModal')(...args), + renderMarriedList: (...args) => _marriageStatus.wrap('renderMarriedList')(...args), + renderMarriageStatus: (...args) => _marriageStatus.wrap('renderMarriageStatus')(...args), + switchMarriageTab: (...args) => _marriageStatus.wrap('switchMarriageTab')(...args), + tryDivorce: (...args) => _marriageStatus.wrap('tryDivorce')(...args), + bindProfileControls: (...args) => _profile.wrap('bindProfileControls')(...args), + closeAvatarPicker: (...args) => _profile.wrap('closeAvatarPicker')(...args), + closeSettingsModal: (...args) => _profile.wrap('closeSettingsModal')(...args), + copyWechatBindCode: (...args) => _profile.wrap('copyWechatBindCode')(...args), + generateWechatBindCode: (...args) => _profile.wrap('generateWechatBindCode')(...args), + handleAvatarUpload: (...args) => _profile.wrap('handleAvatarUpload')(...args), + loadHeadfaces: (...args) => _profile.wrap('loadHeadfaces')(...args), + openAvatarPicker: (...args) => _profile.wrap('openAvatarPicker')(...args), + openSettingsModal: (...args) => _profile.wrap('openSettingsModal')(...args), + saveAvatar: (...args) => _profile.wrap('saveAvatar')(...args), + savePassword: (...args) => _profile.wrap('savePassword')(...args), + saveSettings: (...args) => _profile.wrap('saveSettings')(...args), + selectAvatar: (...args) => _profile.wrap('selectAvatar')(...args), + sendEmailCode: (...args) => _profile.wrap('sendEmailCode')(...args), + showInlineMsg: (...args) => _profile.wrap('showInlineMsg')(...args), + unbindWechat: (...args) => _profile.wrap('unbindWechat')(...args), bindVipControls: (...args) => _vip.wrap('bindVipControls')(...args), buyVip: (...args) => _vip.wrap('buyVip')(...args), closeVipModal: (...args) => _vip.wrap('closeVipModal')(...args), openVipModal: (...args) => _vip.wrap('openVipModal')(...args), saveVipPresenceSettings: (...args) => _vip.wrap('saveVipPresenceSettings')(...args), switchVipTab: (...args) => _vip.wrap('switchVipTab')(...args), - closeChatImageLightbox: (...args) => _lightbox.wrap('closeChatImageLightbox')(...args), - initChatImageLightboxEvents: (...args) => _lightbox.wrap('initChatImageLightboxEvents')(...args), - openChatImageLightbox: (...args) => _lightbox.wrap('openChatImageLightbox')(...args), - bindChatRightPanelControls: (...args) => _rightPanel.wrap('bindChatRightPanelControls')(...args), - bindRoomStatusControls: (...args) => _rooms.wrap('bindRoomStatusControls')(...args), - normalizeRoomStatus: (...args) => _rooms.wrap('normalizeRoomStatus')(...args), - renderRoomStatusRow: (...args) => _rooms.wrap('renderRoomStatusRow')(...args), - renderRoomsOnlineStatus: (...args) => _rooms.wrap('renderRoomsOnlineStatus')(...args), - renderRoomsOnlineStatusToContainer: (...args) => _rooms.wrap('renderRoomsOnlineStatusToContainer')(...args), - resolveRoomUrl: (...args) => _rooms.wrap('resolveRoomUrl')(...args), - bindRedPacketPanelControls: (...args) => _redPacket.wrap('bindRedPacketPanelControls')(...args), - claimRedPacket: (...args) => _redPacket.wrap('claimRedPacket')(...args), - closeRedPacketModal: (...args) => _redPacket.wrap('closeRedPacketModal')(...args), - sendRedPacket: (...args) => _redPacket.wrap('sendRedPacket')(...args), - showRedPacketModal: (...args) => _redPacket.wrap('showRedPacketModal')(...args), - updateRedPacketClaimsUI: (...args) => _redPacket.wrap('updateRedPacketClaimsUI')(...args), + bindFriendPanelControls: (...args) => _friendPanel.wrap('bindFriendPanelControls')(...args), + closeFriendPanel: (...args) => _friendPanel.wrap('closeFriendPanel')(...args), + friendSearch: (...args) => _friendPanel.wrap('friendSearch')(...args), + loadFriends: (...args) => _friendPanel.wrap('loadFriends')(...args), + openFriendPanel: (...args) => _friendPanel.wrap('openFriendPanel')(...args), + quickFriendAction: (...args) => _friendPanel.wrap('quickFriendAction')(...args), + bindGameHallControls: (...args) => _gameHall.wrap('bindGameHallControls')(...args), + closeGameHall: (...args) => _gameHall.wrap('closeGameHall')(...args), + openGameHall: (...args) => _gameHall.wrap('openGameHall')(...args), + + // ── 已转为静态导入的功能模块(直接引用)─── + bindAppointmentAnnouncementControls, + showAppointmentBanner, + bindChatBanner, + bindChatBotControls, + clearChatBotContext, + sendToChatBot, + applyFontSize, + bindChatFontSizeControl, + CHAT_FONT_SIZE_STORAGE_KEY, + restoreChatFontSize, + bindChatImageUploadControl, + bindFriendNotificationControls, + setupBannerNotification, + setupFriendNotification, + showFriendBanner, + bindMobileDrawerControls, + closeMobileDrawer, + loadMobileRoomList, + openMobileDrawer, + renderMobileRoomList, + renderMobileUserList, + scheduleRenderMobileUserList, + switchMobileTab, + bindUserTargetActions, + openUserCard, + switchTarget, + bindWelcomeMenuControls, + toggleWelcomeMenu, + bindAdminMenuControls, + bindBaccaratEvents, + bindBaccaratLossCoverAdminControls, + closeAdminBaccaratLossCoverModal, + closeCurrentBaccaratLossCoverEvent, + loadAdminCurrentLossCoverEvent, + openAdminBaccaratLossCoverModal, + submitBaccaratLossCoverEvent, + bindBaccaratLossCoverControls, + claimBaccaratLossCover, + closeBaccaratLossCoverModal, + openBaccaratLossCoverModal, + switchBaccaratLossCoverTab, + bindGameBootstrapControls, + deferChatGameBootstrap, + bindGamePanelControls, + acceptGomokuInvite, + bindGomokuControls, + openGomokuPanel, + requestHorseRaceJson, + bindHorseRaceEvents, + buildHolidayClaimActionButton, + buildHolidaySystemMessage, + openHolidayRunFromSystemMessage, + bindFishingControls, + checkAndAutoStartFishing, + createBobber, + reelFish, + removeBobber, + resetFishingBtn, + startFishing, + stopAutoFishing, + closeChatImageLightbox, + initChatImageLightboxEvents, + openChatImageLightbox, + bindChatRightPanelControls, + bindRoomStatusControls, + normalizeRoomStatus, + renderRoomStatusRow, + renderRoomsOnlineStatus, + renderRoomsOnlineStatusToContainer, + resolveRoomUrl, + bindRedPacketPanelControls, + claimRedPacket, + closeRedPacketModal, + sendRedPacket, + showRedPacketModal, + updateRedPacketClaimsUI, // ── 静态导入的 Alpine 组件模块 ── // 这些模块已通过静态导入编译到主包,直接引用导出 @@ -629,83 +565,26 @@ if (typeof window !== "undefined") { window.setAction = setChatComposerAction; window.syncAutoScrollControls = syncAutoScrollControls; - // ── 懒加载功能模块 window 挂载(按需加载) ── - window.closeChatImageLightbox = (...args) => _lightbox.wrap('closeChatImageLightbox')(...args); - window.openChatImageLightbox = (...args) => _lightbox.wrap('openChatImageLightbox')(...args); + // ── 懒加载功能模块 window 挂载(仅保留工具栏调用模块的懒加载包装)── window.closeFriendPanel = (...args) => _friendPanel.wrap('closeFriendPanel')(...args); window.friendSearch = (...args) => _friendPanel.wrap('friendSearch')(...args); window.openFriendPanel = (...args) => _friendPanel.wrap('openFriendPanel')(...args); window.quickFriendAction = (...args) => _friendPanel.wrap('quickFriendAction')(...args); - window.setupBannerNotification = (...args) => _friendNotifications.wrap('setupBannerNotification')(...args); - window.setupFriendNotification = (...args) => _friendNotifications.wrap('setupFriendNotification')(...args); - window.showFriendBanner = (...args) => _friendNotifications.wrap('showFriendBanner')(...args); - window.closeMobileDrawer = (...args) => _mobileDrawer.wrap('closeMobileDrawer')(...args); - window.loadMobileRoomList = (...args) => _mobileDrawer.wrap('loadMobileRoomList')(...args); - window.openMobileDrawer = (...args) => _mobileDrawer.wrap('openMobileDrawer')(...args); - window.openUserCard = (...args) => _userTargetActions.wrap('openUserCard')(...args); - window.renderMobileRoomList = (...args) => _mobileDrawer.wrap('renderMobileRoomList')(...args); - window.renderMobileUserList = (...args) => _mobileDrawer.wrap('renderMobileUserList')(...args); - window.scheduleRenderMobileUserList = (...args) => _mobileDrawer.wrap('scheduleRenderMobileUserList')(...args); - window.switchMobileTab = (...args) => _mobileDrawer.wrap('switchMobileTab')(...args); - window.switchTarget = (...args) => _userTargetActions.wrap('switchTarget')(...args); - window.clearChatBotContext = (...args) => _chatBot.wrap('clearChatBotContext')(...args); - window.sendToChatBot = (...args) => _chatBot.wrap('sendToChatBot')(...args); - window.runFeatureShortcut = runFeatureShortcut; - window.runToolbarAction = runToolbarAction; - window.closeAdminBaccaratLossCoverModal = (...args) => _baccaratLossCoverAdmin.wrap('closeAdminBaccaratLossCoverModal')(...args); - window.closeCurrentBaccaratLossCoverEvent = (...args) => _baccaratLossCoverAdmin.wrap('closeCurrentBaccaratLossCoverEvent')(...args); - window.claimBaccaratLossCover = (...args) => _baccaratLossCover.wrap('claimBaccaratLossCover')(...args); - window.closeBaccaratLossCoverModal = (...args) => _baccaratLossCover.wrap('closeBaccaratLossCoverModal')(...args); - window.openBaccaratLossCoverModal = (...args) => _baccaratLossCover.wrap('openBaccaratLossCoverModal')(...args); - window.openAdminBaccaratLossCoverModal = (...args) => _baccaratLossCoverAdmin.wrap('openAdminBaccaratLossCoverModal')(...args); - window.submitBaccaratLossCoverEvent = (...args) => _baccaratLossCoverAdmin.wrap('submitBaccaratLossCoverEvent')(...args); - window.switchBaccaratLossCoverTab = (...args) => _baccaratLossCover.wrap('switchBaccaratLossCoverTab')(...args); window.bankAction = (...args) => _bank.wrap('bankAction')(...args); window.bankLoadInfo = (...args) => _bank.wrap('bankLoadInfo')(...args); window.bankShowMsg = (...args) => _bank.wrap('bankShowMsg')(...args); window.closeBankModal = (...args) => _bank.wrap('closeBankModal')(...args); - window.closeGameHall = (...args) => _gameHall.wrap('closeGameHall')(...args); window.fetchBankRanking = (...args) => _bank.wrap('fetchBankRanking')(...args); - window.deferChatGameBootstrap = (...args) => _gameBootstrap.wrap('deferChatGameBootstrap')(...args); - window.openGameHall = (...args) => _gameHall.wrap('openGameHall')(...args); - window.acceptGomokuInvite = (...args) => _gomokuControls.wrap('acceptGomokuInvite')(...args); - window.openGomokuPanel = (...args) => _gomokuControls.wrap('openGomokuPanel')(...args); window.openBankModal = (...args) => _bank.wrap('openBankModal')(...args); - window.checkAndAutoStartFishing = (...args) => _fishing.wrap('checkAndAutoStartFishing')(...args); - window.createBobber = (...args) => _fishing.wrap('createBobber')(...args); - window.reelFish = (...args) => _fishing.wrap('reelFish')(...args); - window.removeBobber = (...args) => _fishing.wrap('removeBobber')(...args); - window.resetFishingBtn = (...args) => _fishing.wrap('resetFishingBtn')(...args); - window.startFishing = (...args) => _fishing.wrap('startFishing')(...args); - window.stopAutoFishing = (...args) => _fishing.wrap('stopAutoFishing')(...args); + window.switchBankTab = (...args) => _bank.wrap('switchBankTab')(...args); + window.toggleBankRankSort = (...args) => _bank.wrap('toggleBankRankSort')(...args); + window.closeGameHall = (...args) => _gameHall.wrap('closeGameHall')(...args); + window.openGameHall = (...args) => _gameHall.wrap('openGameHall')(...args); window.buyVip = (...args) => _vip.wrap('buyVip')(...args); window.closeVipModal = (...args) => _vip.wrap('closeVipModal')(...args); window.openVipModal = (...args) => _vip.wrap('openVipModal')(...args); window.saveVipPresenceSettings = (...args) => _vip.wrap('saveVipPresenceSettings')(...args); window.switchVipTab = (...args) => _vip.wrap('switchVipTab')(...args); - window.switchBankTab = (...args) => _bank.wrap('switchBankTab')(...args); - window.toggleBankRankSort = (...args) => _bank.wrap('toggleBankRankSort')(...args); - window.claimRedPacket = (...args) => _redPacket.wrap('claimRedPacket')(...args); - window.closeRedPacketModal = (...args) => _redPacket.wrap('closeRedPacketModal')(...args); - window.sendRedPacket = (...args) => _redPacket.wrap('sendRedPacket')(...args); - window.showRedPacketModal = (...args) => _redPacket.wrap('showRedPacketModal')(...args); - window.updateRedPacketClaimsUI = (...args) => _redPacket.wrap('updateRedPacketClaimsUI')(...args); - window.applyFontSize = (...args) => _fontSize.wrap('applyFontSize')(...args); - window.closeAvatarPicker = (...args) => _profile.wrap('closeAvatarPicker')(...args); - window.closeSettingsModal = (...args) => _profile.wrap('closeSettingsModal')(...args); - window.copyWechatBindCode = (...args) => _profile.wrap('copyWechatBindCode')(...args); - window.generateWechatBindCode = (...args) => _profile.wrap('generateWechatBindCode')(...args); - window.handleAvatarUpload = (...args) => _profile.wrap('handleAvatarUpload')(...args); - window.loadHeadfaces = (...args) => _profile.wrap('loadHeadfaces')(...args); - window.openAvatarPicker = (...args) => _profile.wrap('openAvatarPicker')(...args); - window.openSettingsModal = (...args) => _profile.wrap('openSettingsModal')(...args); - window.saveAvatar = (...args) => _profile.wrap('saveAvatar')(...args); - window.savePassword = (...args) => _profile.wrap('savePassword')(...args); - window.saveSettings = (...args) => _profile.wrap('saveSettings')(...args); - window.selectAvatar = (...args) => _profile.wrap('selectAvatar')(...args); - window.sendEmailCode = (...args) => _profile.wrap('sendEmailCode')(...args); - window.showInlineMsg = (...args) => _profile.wrap('showInlineMsg')(...args); - window.unbindWechat = (...args) => _profile.wrap('unbindWechat')(...args); window.closeMarriageStatusModal = (...args) => _marriageStatus.wrap('closeMarriageStatusModal')(...args); window.fetchMarriedList = (...args) => _marriageStatus.wrap('fetchMarriedList')(...args); window.fetchMyMarriageStatus = (...args) => _marriageStatus.wrap('fetchMyMarriageStatus')(...args); @@ -728,6 +607,65 @@ if (typeof window !== "undefined") { window.renderShop = (...args) => _shop.wrap('renderShop')(...args); window.showShopToast = (...args) => _shop.wrap('showShopToast')(...args); window.submitRename = (...args) => _shop.wrap('submitRename')(...args); + window.closeAvatarPicker = (...args) => _profile.wrap('closeAvatarPicker')(...args); + window.closeSettingsModal = (...args) => _profile.wrap('closeSettingsModal')(...args); + window.copyWechatBindCode = (...args) => _profile.wrap('copyWechatBindCode')(...args); + window.generateWechatBindCode = (...args) => _profile.wrap('generateWechatBindCode')(...args); + window.handleAvatarUpload = (...args) => _profile.wrap('handleAvatarUpload')(...args); + window.loadHeadfaces = (...args) => _profile.wrap('loadHeadfaces')(...args); + window.openAvatarPicker = (...args) => _profile.wrap('openAvatarPicker')(...args); + window.openSettingsModal = (...args) => _profile.wrap('openSettingsModal')(...args); + window.saveAvatar = (...args) => _profile.wrap('saveAvatar')(...args); + window.savePassword = (...args) => _profile.wrap('savePassword')(...args); + window.saveSettings = (...args) => _profile.wrap('saveSettings')(...args); + window.selectAvatar = (...args) => _profile.wrap('selectAvatar')(...args); + window.sendEmailCode = (...args) => _profile.wrap('sendEmailCode')(...args); + window.showInlineMsg = (...args) => _profile.wrap('showInlineMsg')(...args); + window.unbindWechat = (...args) => _profile.wrap('unbindWechat')(...args); + + // ── 已转为静态导入的功能模块 window 挂载(直接引用)── + window.closeChatImageLightbox = closeChatImageLightbox; + window.openChatImageLightbox = openChatImageLightbox; + window.setupBannerNotification = setupBannerNotification; + window.setupFriendNotification = setupFriendNotification; + window.showFriendBanner = showFriendBanner; + window.closeMobileDrawer = closeMobileDrawer; + window.loadMobileRoomList = loadMobileRoomList; + window.openMobileDrawer = openMobileDrawer; + window.openUserCard = openUserCard; + window.renderMobileRoomList = renderMobileRoomList; + window.renderMobileUserList = renderMobileUserList; + window.scheduleRenderMobileUserList = scheduleRenderMobileUserList; + window.switchMobileTab = switchMobileTab; + window.switchTarget = switchTarget; + window.clearChatBotContext = clearChatBotContext; + window.sendToChatBot = sendToChatBot; + window.runFeatureShortcut = runFeatureShortcut; + window.runToolbarAction = runToolbarAction; + window.closeAdminBaccaratLossCoverModal = closeAdminBaccaratLossCoverModal; + window.closeCurrentBaccaratLossCoverEvent = closeCurrentBaccaratLossCoverEvent; + window.claimBaccaratLossCover = claimBaccaratLossCover; + window.closeBaccaratLossCoverModal = closeBaccaratLossCoverModal; + window.openBaccaratLossCoverModal = openBaccaratLossCoverModal; + window.openAdminBaccaratLossCoverModal = openAdminBaccaratLossCoverModal; + window.submitBaccaratLossCoverEvent = submitBaccaratLossCoverEvent; + window.switchBaccaratLossCoverTab = switchBaccaratLossCoverTab; + window.deferChatGameBootstrap = deferChatGameBootstrap; + window.acceptGomokuInvite = acceptGomokuInvite; + window.openGomokuPanel = openGomokuPanel; + window.checkAndAutoStartFishing = checkAndAutoStartFishing; + window.createBobber = createBobber; + window.reelFish = reelFish; + window.removeBobber = removeBobber; + window.resetFishingBtn = resetFishingBtn; + window.startFishing = startFishing; + window.stopAutoFishing = stopAutoFishing; + window.claimRedPacket = claimRedPacket; + window.closeRedPacketModal = closeRedPacketModal; + window.sendRedPacket = sendRedPacket; + window.showRedPacketModal = showRedPacketModal; + window.updateRedPacketClaimsUI = updateRedPacketClaimsUI; + window.applyFontSize = applyFontSize; // ── Alpine 组件(静态导入,Blade 中 x-data 引用时同步可用) ── window.userCardComponent = userCardComponent; @@ -789,4 +727,28 @@ if (typeof window !== "undefined") { bindLotteryPanelControls(); bindGomokuPanelControls(); bindDailySignInControls(); + + // ── 已转为静态导入的事件委托模块控制绑定 ── + bindBaccaratEvents(); + bindBaccaratLossCoverAdminControls(); + bindBaccaratLossCoverControls(); + bindGomokuControls(); + bindHorseRaceEvents(); + bindFishingControls(); + bindGameBootstrapControls(); + bindGamePanelControls(); + bindUserTargetActions(); + bindRedPacketPanelControls(); + bindMobileDrawerControls(); + bindWelcomeMenuControls(); + bindAdminMenuControls(); + bindFriendNotificationControls(); + initChatImageLightboxEvents(); + bindRoomStatusControls(); + bindChatRightPanelControls(); + bindChatImageUploadControl(); + bindChatFontSizeControl(); + bindAppointmentAnnouncementControls(); + bindChatBanner(); + bindChatBotControls(); }