diff --git a/resources/js/chat-room.js b/resources/js/chat-room.js index 483bc6f..d2592f3 100644 --- a/resources/js/chat-room.js +++ b/resources/js/chat-room.js @@ -19,7 +19,7 @@ export { switchMobileTab, } from "./chat-room/mobile-drawer.js"; export { bindMarriageStatusControls } from "./chat-room/marriage-status.js"; -export { bindToolbarControls } from "./chat-room/toolbar.js"; +export { bindToolbarControls, runFeatureShortcut, runToolbarAction } from "./chat-room/toolbar.js"; export { bindWelcomeMenuControls } from "./chat-room/welcome-menu.js"; export { bindAdminMenuControls } from "./chat-room/admin-menu.js"; export { @@ -88,7 +88,7 @@ import { switchMobileTab, } from "./chat-room/mobile-drawer.js"; import { bindMarriageStatusControls } from "./chat-room/marriage-status.js"; -import { bindToolbarControls } from "./chat-room/toolbar.js"; +import { bindToolbarControls, runFeatureShortcut, runToolbarAction } from "./chat-room/toolbar.js"; import { bindWelcomeMenuControls } from "./chat-room/welcome-menu.js"; import { bindAdminMenuControls } from "./chat-room/admin-menu.js"; import { @@ -163,6 +163,8 @@ if (typeof window !== "undefined") { scheduleRenderMobileUserList, switchMobileTab, bindToolbarControls, + runFeatureShortcut, + runToolbarAction, bindWelcomeMenuControls, bindAdminMenuControls, bindBaccaratLossCoverAdminControls, @@ -225,6 +227,8 @@ if (typeof window !== "undefined") { window.renderMobileUserList = renderMobileUserList; window.scheduleRenderMobileUserList = scheduleRenderMobileUserList; window.switchMobileTab = switchMobileTab; + window.runFeatureShortcut = runFeatureShortcut; + window.runToolbarAction = runToolbarAction; window.closeAdminBaccaratLossCoverModal = closeAdminBaccaratLossCoverModal; window.closeCurrentBaccaratLossCoverEvent = closeCurrentBaccaratLossCoverEvent; window.openAdminBaccaratLossCoverModal = openAdminBaccaratLossCoverModal; diff --git a/resources/js/chat-room/toolbar.js b/resources/js/chat-room/toolbar.js index a08e3e4..57e5a33 100644 --- a/resources/js/chat-room/toolbar.js +++ b/resources/js/chat-room/toolbar.js @@ -8,7 +8,7 @@ let toolbarEventsBound = false; * @param {string} action 工具条动作 * @returns {void} */ -function runToolbarAction(action) { +export function runToolbarAction(action) { // 工具条只做入口分发,具体业务仍由原有全局函数负责。 const actions = { shop: () => window.openShopModal?.(), @@ -26,6 +26,18 @@ function runToolbarAction(action) { actions[action]?.(); } +/** + * 执行功能菜单快捷入口,并在打开目标面板前关闭功能菜单。 + * + * @param {string} action 快捷入口动作 + * @returns {void} + */ +export function runFeatureShortcut(action) { + // 功能菜单和竖向工具条共享同一组业务入口,只额外关闭菜单浮层。 + window.closeFeatureMenu?.(); + runToolbarAction(action); +} + /** * 确认并执行离开聊天室动作。 * diff --git a/resources/views/chat/partials/scripts.blade.php b/resources/views/chat/partials/scripts.blade.php index d8ca2be..4bb7494 100644 --- a/resources/views/chat/partials/scripts.blade.php +++ b/resources/views/chat/partials/scripts.blade.php @@ -357,54 +357,6 @@ } } - /** - * 执行功能菜单中的快捷入口,并在打开目标面板前先关闭功能菜单。 - * - * @param {string} action 快捷入口动作名 - */ - function runFeatureShortcut(action) { - closeFeatureMenu(); - - if (action === 'shop' && typeof window.openShopModal === 'function') { - window.openShopModal(); - return; - } - - if (action === 'vip' && typeof window.openVipModal === 'function') { - window.openVipModal(); - return; - } - - if (action === 'game' && typeof window.openGameHall === 'function') { - window.openGameHall(); - return; - } - - if (action === 'avatar' && typeof window.openAvatarPicker === 'function') { - window.openAvatarPicker(); - return; - } - - if (action === 'bank' && typeof window.openBankModal === 'function') { - window.openBankModal(); - return; - } - - if (action === 'marriage' && typeof window.openMarriageStatusModal === 'function') { - window.openMarriageStatusModal(); - return; - } - - if (action === 'friend' && typeof window.openFriendPanel === 'function') { - window.openFriendPanel(); - return; - } - - if (action === 'settings' && typeof window.openSettingsModal === 'function') { - window.openSettingsModal(); - } - } - /** * 提交状态设置/清除请求。 * @@ -3270,7 +3222,6 @@ window.closeFeatureMenu = closeFeatureMenu; window.openDailyStatusEditor = openDailyStatusEditor; window.closeDailyStatusEditor = closeDailyStatusEditor; - window.runFeatureShortcut = runFeatureShortcut; window.runAdminAction = runAdminAction; window.selectEffect = selectEffect; window.triggerEffect = triggerEffect;