修复礼包红包弹窗领取展示残留

This commit is contained in:
pllx
2026-04-30 16:23:37 +08:00
parent f354516869
commit ee525f049e
2 changed files with 2 additions and 45 deletions
+1 -22
View File
@@ -318,8 +318,6 @@ function renderRedPacketModal(payload) {
byId("rp-countdown").textContent = payload.expireSeconds;
byId("rp-timer-bar").style.width = "100%";
byId("rp-status-msg").textContent = "";
byId("rp-claims-list").style.display = "none";
byId("rp-claims-items").textContent = "";
const emoji = modal.querySelector(".rp-emoji");
if (emoji) {
@@ -556,7 +554,7 @@ function updateClaimButtonAfterFailure(button, message) {
}
/**
* 收到领取广播后,同步弹窗内领取名单与剩余数
* 收到领取广播后,同步弹窗内剩余份数与抢完状态
*
* @param {string} username 领取者用户名
* @param {number|string} amount 领取数量
@@ -570,25 +568,6 @@ export function updateRedPacketClaimsUI(username, amount, remaining, type = redP
remainingElement.textContent = remaining;
}
const list = byId("rp-claims-list");
const items = byId("rp-claims-items");
if (!list || !items) {
return;
}
list.style.display = "block";
const item = document.createElement("div");
const name = document.createElement("span");
const value = document.createElement("span");
const typeLabel = type === "exp" ? "经验" : "金币";
item.className = "rp-claim-item";
name.textContent = username;
value.textContent = `+${amount} ${typeLabel}`;
item.append(name, value);
items.prepend(item);
if (remaining <= 0) {
const button = byId("rp-claim-btn");
if (button && !redPacketClaimed) {
@@ -11,7 +11,7 @@
window.showRedPacketModal(...) 展示红包弹窗(收到 WebSocket 事件触发)
window.closeRedPacketModal() 关闭红包弹窗
window.claimRedPacket() 用户抢红包
window.updateRedPacketClaimsUI() 更新领取名单WebSocket 广播后调用)
window.updateRedPacketClaimsUI() 更新剩余份数WebSocket 广播后调用)
注:依赖 window.chatBannerchat-banner.blade.php)、window.chatDialog、window.chatToast。
@@ -190,28 +190,6 @@
transform: none;
}
/* 已领取名单 */
#rp-claims-list {
margin-top: 12px;
max-height: 100px;
overflow-y: auto;
border-top: 1px dashed #fca5a5;
padding-top: 8px;
}
.rp-claim-item {
display: flex;
justify-content: space-between;
font-size: 11px;
color: #555;
padding: 2px 0;
}
.rp-claim-item span:last-child {
color: #dc2626;
font-weight: bold;
}
/* 关闭按钮 */
#rp-close-btn {
position: absolute;