补充前端小模块说明注释
This commit is contained in:
@@ -26,6 +26,7 @@ export function bindGlobalDialogControls() {
|
||||
event.preventDefault();
|
||||
|
||||
const action = actionButton.getAttribute("data-chat-dialog-action");
|
||||
// 全局弹窗只允许确认/取消两类动作,继续承接旧 Promise 回调流程。
|
||||
if (action === "confirm") {
|
||||
window.chatDialog?._confirm?.();
|
||||
return;
|
||||
|
||||
@@ -23,6 +23,7 @@ export function bindChatImageUploadControl() {
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
// 点击按钮只打开隐藏文件框;真正上传在 change 事件与旧函数中处理。
|
||||
document.getElementById("chat_image")?.click();
|
||||
});
|
||||
|
||||
@@ -31,6 +32,7 @@ export function bindChatImageUploadControl() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 文件校验、上传请求和消息插入继续复用存量 handleChatImageSelected。
|
||||
if (typeof window.handleChatImageSelected === "function") {
|
||||
window.handleChatImageSelected(event.target);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ let shopControlEventsBound = false;
|
||||
* @returns {void}
|
||||
*/
|
||||
function callShopGlobal(functionName) {
|
||||
// 商店主体逻辑仍在 Blade 全局函数内,这里只把 data 事件桥接到旧函数。
|
||||
if (typeof window[functionName] === "function") {
|
||||
window[functionName]();
|
||||
}
|
||||
@@ -30,12 +31,14 @@ export function bindShopControls() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 商店弹窗关闭入口与遮罩关闭逻辑保持同一个旧函数。
|
||||
if (event.target.closest("[data-shop-modal-close]")) {
|
||||
event.preventDefault();
|
||||
callShopGlobal("closeShopModal");
|
||||
return;
|
||||
}
|
||||
|
||||
// 改名确认/取消只转发按钮意图,接口请求仍由 Blade 内的 submitRename 处理。
|
||||
if (event.target.closest("[data-shop-rename-confirm]")) {
|
||||
event.preventDefault();
|
||||
callShopGlobal("submitRename");
|
||||
@@ -48,6 +51,7 @@ export function bindShopControls() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 赠礼确认/取消对应单次特效卡流程,先保留旧的弹窗状态管理函数。
|
||||
if (event.target.closest("[data-shop-gift-confirm]")) {
|
||||
event.preventDefault();
|
||||
callShopGlobal("confirmGift");
|
||||
|
||||
@@ -19,6 +19,7 @@ export function bindWelcomeMenuControls() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 欢迎语菜单外部点击关闭仍由主脚本处理,这里只负责菜单按钮与菜单内部。
|
||||
const toggleButton = event.target.closest("[data-chat-welcome-menu-toggle]");
|
||||
if (toggleButton) {
|
||||
event.preventDefault();
|
||||
@@ -32,6 +33,7 @@ export function bindWelcomeMenuControls() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 阻止菜单内部点击冒泡,避免选择模板时被外层关闭逻辑抢先处理。
|
||||
event.stopPropagation();
|
||||
|
||||
const item = event.target.closest("[data-chat-welcome-template]");
|
||||
@@ -40,6 +42,7 @@ export function bindWelcomeMenuControls() {
|
||||
}
|
||||
|
||||
const template = item.getAttribute("data-chat-welcome-template") || "";
|
||||
// 模板内容只从 data 属性读取,实际发送仍交给旧的 sendWelcomeTpl。
|
||||
if (template && typeof window.sendWelcomeTpl === "function") {
|
||||
window.sendWelcomeTpl(template);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user