迁移婚礼红包领取事件

This commit is contained in:
2026-04-25 10:48:05 +08:00
parent db545aa32e
commit e9a3310649
2 changed files with 28 additions and 3 deletions
+26 -1
View File
@@ -29,7 +29,25 @@ function resolveCurrentMarriedPage() {
}
/**
* 绑定婚姻弹窗 tab、分页、用户名片和状态操作按钮事件
* 打开婚礼红包领取弹窗
*
* @param {string} ceremonyId 婚礼记录 ID
* @returns {void}
*/
function openWeddingEnvelopeClaim(ceremonyId) {
const detail = window._weddingEnvelopes?.[ceremonyId];
const modal = document.getElementById("wedding-envelope-modal");
if (!detail || !modal || typeof window.Alpine?.$data !== "function") {
return;
}
// 红包详情仍由 Blade 旧脚本写入 window._weddingEnvelopes,这里只按 ID 打开现有 Alpine 弹窗。
window.Alpine.$data(modal).open(detail);
}
/**
* 绑定婚姻弹窗 tab、分页、用户名片、状态操作和婚礼红包领取事件。
*
* @returns {void}
*/
@@ -67,6 +85,13 @@ export function bindMarriageStatusControls() {
return;
}
const weddingEnvelopeButton = event.target.closest("[data-wedding-envelope-claim]");
if (weddingEnvelopeButton) {
event.preventDefault();
openWeddingEnvelopeClaim(weddingEnvelopeButton.getAttribute("data-wedding-envelope-claim") || "");
return;
}
const pageButton = event.target.closest("[data-marriage-page-delta]");
if (pageButton) {
event.preventDefault();
@@ -1339,7 +1339,7 @@
// 公屏追加带按钮的系统消息(按钮通过 ceremonyId 引用全局 Map
if (typeof appendSystemMessage === 'function') {
const claimBtn = `<button onclick="(function(){var d=window._weddingEnvelopes[${ceremonyId}];var el=document.getElementById('wedding-envelope-modal');if(el&&d)Alpine.$data(el).open(d);})()"
const claimBtn = `<button data-wedding-envelope-claim="${Number(ceremonyId)}"
style="display:inline-block; margin-left:10px; padding:4px 14px; border-radius:20px;
background:#d97706; color:#fff;
border:none; font-size:12px; font-weight:bold; cursor:pointer;
@@ -1453,7 +1453,7 @@
// 在包厢窗口追加提示 + 领取按钮
if (typeof appendSystemMessage === 'function') {
const claimBtn = `<button onclick="(function(){var d=window._weddingEnvelopes[${ceremonyId}];var el=document.getElementById('wedding-envelope-modal');if(el&&d)Alpine.$data(el).open(d);})()"
const claimBtn = `<button data-wedding-envelope-claim="${Number(ceremonyId)}"
style="display:inline-block; margin-left:10px; padding:4px 14px; border-radius:20px;
background:#d97706; color:#fff;
border:none; font-size:12px; font-weight:bold; cursor:pointer;