2026-03-09 11:30:11 +08:00
|
|
|
|
{{--
|
|
|
|
|
|
文件功能:礼包红包弹窗面板(HTML + CSS + 交互脚本)
|
|
|
|
|
|
|
|
|
|
|
|
包含:
|
|
|
|
|
|
1. 红包遮罩弹窗 DOM(#red-packet-modal)
|
|
|
|
|
|
2. 红包弹窗样式(CSS)
|
|
|
|
|
|
3. 红包前端交互 JS(发包、抢包、倒计时、WebSocket 监听)
|
|
|
|
|
|
|
|
|
|
|
|
全局函数:
|
|
|
|
|
|
window.sendRedPacket() → superlevel 发包(弹 chatBanner 选类型)
|
|
|
|
|
|
window.showRedPacketModal(...) → 展示红包弹窗(收到 WebSocket 事件触发)
|
|
|
|
|
|
window.closeRedPacketModal() → 关闭红包弹窗
|
|
|
|
|
|
window.claimRedPacket() → 用户抢红包
|
|
|
|
|
|
window.updateRedPacketClaimsUI() → 更新领取名单(WebSocket 广播后调用)
|
|
|
|
|
|
|
|
|
|
|
|
注:依赖 window.chatBanner(chat-banner.blade.php)、window.chatDialog、window.chatToast。
|
|
|
|
|
|
|
|
|
|
|
|
从 scripts.blade.php 提取,与其他游戏面板(baccarat-panel、slot-machine 等)保持统一结构。
|
|
|
|
|
|
|
|
|
|
|
|
@author ChatRoom Laravel
|
|
|
|
|
|
@version 1.0.0
|
|
|
|
|
|
--}}
|
|
|
|
|
|
<style>
|
|
|
|
|
|
/* 红包弹窗遮罩 */
|
|
|
|
|
|
#red-packet-modal {
|
|
|
|
|
|
display: none;
|
|
|
|
|
|
position: fixed !important;
|
|
|
|
|
|
inset: 0 !important;
|
|
|
|
|
|
z-index: 10500 !important;
|
|
|
|
|
|
background: rgba(0, 0, 0, 0.6) !important;
|
|
|
|
|
|
justify-content: center !important;
|
|
|
|
|
|
align-items: center !important;
|
|
|
|
|
|
animation: rpFadeIn 0.25s ease;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes rpFadeIn {
|
|
|
|
|
|
from {
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
to {
|
|
|
|
|
|
opacity: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 红包卡片主体 */
|
|
|
|
|
|
#red-packet-card {
|
|
|
|
|
|
width: 300px;
|
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(220, 38, 38, 0.4);
|
|
|
|
|
|
animation: rpCardIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes rpCardIn {
|
|
|
|
|
|
from {
|
|
|
|
|
|
transform: scale(0.7) translateY(40px);
|
|
|
|
|
|
opacity: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
to {
|
|
|
|
|
|
transform: scale(1) translateY(0);
|
|
|
|
|
|
opacity: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 红包顶部区 */
|
|
|
|
|
|
#rp-header {
|
|
|
|
|
|
background: linear-gradient(160deg, #dc2626 0%, #b91c1c 50%, #991b1b 100%);
|
|
|
|
|
|
padding: 24px 20px 20px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#rp-header::before {
|
|
|
|
|
|
content: '';
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
inset: 0;
|
|
|
|
|
|
background: radial-gradient(ellipse at 50% 0%, rgba(255, 100, 0, 0.3) 0%, transparent 70%);
|
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.rp-emoji {
|
|
|
|
|
|
font-size: 52px;
|
|
|
|
|
|
display: block;
|
|
|
|
|
|
filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
|
|
|
|
|
|
animation: rpBounce 1.5s ease-in-out infinite;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes rpBounce {
|
|
|
|
|
|
|
|
|
|
|
|
0%,
|
|
|
|
|
|
100% {
|
|
|
|
|
|
transform: translateY(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
50% {
|
|
|
|
|
|
transform: translateY(-6px);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.rp-sender {
|
|
|
|
|
|
color: #fde68a;
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
margin-top: 8px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.rp-title {
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
margin-top: 4px;
|
|
|
|
|
|
letter-spacing: 1px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.rp-amount {
|
|
|
|
|
|
color: #fde68a;
|
|
|
|
|
|
font-size: 28px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
margin-top: 6px;
|
|
|
|
|
|
text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.rp-amount small {
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
opacity: 0.85;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 红包底部区 */
|
|
|
|
|
|
#rp-body {
|
|
|
|
|
|
background: #fff8f0;
|
|
|
|
|
|
padding: 16px 20px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.rp-info-row {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: #92400e;
|
|
|
|
|
|
margin-bottom: 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 倒计时条 */
|
|
|
|
|
|
#rp-timer-bar-wrap {
|
|
|
|
|
|
background: #fee2e2;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
height: 6px;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
margin-bottom: 14px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#rp-timer-bar {
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
background: linear-gradient(90deg, #dc2626, #f97316);
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
transition: width 1s linear;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 领取按钮 */
|
|
|
|
|
|
#rp-claim-btn {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
padding: 13px;
|
|
|
|
|
|
background: linear-gradient(135deg, #dc2626, #ea580c);
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
letter-spacing: 1px;
|
|
|
|
|
|
box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
|
|
|
|
|
|
transition: opacity .2s, transform .15s;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#rp-claim-btn:hover {
|
|
|
|
|
|
opacity: 0.9;
|
|
|
|
|
|
transform: translateY(-1px);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#rp-claim-btn:active {
|
|
|
|
|
|
transform: translateY(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#rp-claim-btn:disabled {
|
|
|
|
|
|
background: #9ca3af;
|
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
|
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;
|
|
|
|
|
|
top: 10px;
|
|
|
|
|
|
right: 12px;
|
|
|
|
|
|
color: rgba(255, 255, 255, 0.7);
|
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
line-height: 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#rp-close-btn:hover {
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 状态提示 */
|
|
|
|
|
|
#rp-status-msg {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
margin-top: 8px;
|
|
|
|
|
|
min-height: 16px;
|
|
|
|
|
|
color: #16a34a;
|
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
|
|
{{-- 红包弹窗 DOM --}}
|
|
|
|
|
|
<div id="red-packet-modal">
|
|
|
|
|
|
<div id="red-packet-card">
|
|
|
|
|
|
{{-- 顶部标题区 --}}
|
|
|
|
|
|
<div id="rp-header">
|
2026-04-25 10:51:46 +08:00
|
|
|
|
<span id="rp-close-btn" data-red-packet-close>✕</span>
|
2026-03-09 11:30:11 +08:00
|
|
|
|
<span class="rp-emoji">🧧</span>
|
|
|
|
|
|
<div class="rp-sender" id="rp-sender-name">xxx 的礼包</div>
|
|
|
|
|
|
<div class="rp-title">聊天室专属礼包</div>
|
|
|
|
|
|
<div class="rp-amount"><small>总计 </small><span id="rp-total-amount">888</span><small id="rp-type-label">
|
|
|
|
|
|
金币</small></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
{{-- 底部操作区 --}}
|
|
|
|
|
|
<div id="rp-body">
|
|
|
|
|
|
<div class="rp-info-row">
|
|
|
|
|
|
<span>剩余份数:<b id="rp-remaining">10</b> / <span id="rp-total-count">10</span> 份</span>
|
|
|
|
|
|
<span>倒计时:<b id="rp-countdown">120</b>s</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div id="rp-timer-bar-wrap">
|
|
|
|
|
|
<div id="rp-timer-bar" style="width:100%;"></div>
|
|
|
|
|
|
</div>
|
2026-04-25 10:51:46 +08:00
|
|
|
|
<button id="rp-claim-btn" data-red-packet-claim>🧧 立即抢红包</button>
|
2026-03-09 11:30:11 +08:00
|
|
|
|
<div id="rp-status-msg"></div>
|
|
|
|
|
|
{{-- 领取名单 --}}
|
|
|
|
|
|
<div id="rp-claims-list" style="display:none;">
|
|
|
|
|
|
<div style="font-size:11px; color:#92400e; margin-bottom:4px; font-weight:bold;">已领取名单:</div>
|
|
|
|
|
|
<div id="rp-claims-items"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-04-25 18:22:27 +08:00
|
|
|
|
{{-- 礼包红包前端交互脚本已迁移到 resources/js/chat-room/red-packet-panel.js --}}
|