新增每日签到与补签卡功能
This commit is contained in:
@@ -186,6 +186,8 @@ $welcomeMessages = [
|
||||
</div>
|
||||
<div style="font-size:10px;color:#4338ca;padding:10px 2px 8px;">快捷入口</div>
|
||||
<div style="display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;">
|
||||
<button type="button" onclick="closeFeatureMenu();quickDailySignIn()"
|
||||
style="font-size:11px;padding:6px 8px;background:#fff;color:#334155;border:1px solid #cbd5e1;border-radius:6px;cursor:pointer;">✅ 签到</button>
|
||||
<button type="button" onclick="runFeatureShortcut('shop')"
|
||||
style="font-size:11px;padding:6px 8px;background:#fff;color:#334155;border:1px solid #cbd5e1;border-radius:6px;cursor:pointer;">🛍 商店</button>
|
||||
<button type="button" onclick="runFeatureShortcut('vip')"
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<button class="mobile-drawer-close" onclick="closeMobileDrawer()">✕</button>
|
||||
</div>
|
||||
<div class="mobile-drawer-body">
|
||||
<div class="mobile-tool-btn" onclick="closeMobileDrawer();quickDailySignIn();">✅<br>签到</div>
|
||||
<div class="mobile-tool-btn" onclick="closeMobileDrawer();openShopModal();">🛒<br>商店</div>
|
||||
<div class="mobile-tool-btn" onclick="closeMobileDrawer();openVipModal();">👑<br>会员</div>
|
||||
<div class="mobile-tool-btn" onclick="closeMobileDrawer();saveExp();">💾<br>存点</div>
|
||||
|
||||
@@ -1204,7 +1204,7 @@ async function generateWechatBindCode() {
|
||||
{
|
||||
label: '🎭 道具',
|
||||
desc: '',
|
||||
type: 'one_time'
|
||||
type: 'tools'
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1212,7 +1212,7 @@ async function generateWechatBindCode() {
|
||||
list.innerHTML = '';
|
||||
|
||||
groups.forEach(g => {
|
||||
const items = data.items.filter(i => i.type === g.type);
|
||||
const items = data.items.filter(i => g.type === 'tools' ? ['one_time', 'sign_repair'].includes(i.type) : i.type === g.type);
|
||||
if (!items.length) return;
|
||||
|
||||
// 分组标题(独占一整行)
|
||||
@@ -1235,6 +1235,9 @@ async function generateWechatBindCode() {
|
||||
const effName = effItem ? effItem.name : effKey;
|
||||
groupSuffix =
|
||||
` <span style="display:inline-block;margin-left:8px;padding:1px 8px;background:#16a34a;color:#fff;border-radius:10px;font-size:10px;font-weight:bold;vertical-align:middle;">✅ 已激活:${effName}</span>`;
|
||||
} else if (g.type === 'tools' && (data.sign_repair_card_count || 0) > 0) {
|
||||
groupSuffix =
|
||||
` <span style="display:inline-block;margin-left:8px;padding:1px 8px;background:#0f766e;color:#fff;border-radius:10px;font-size:10px;font-weight:bold;vertical-align:middle;">🎫 可用 ${data.sign_repair_card_count} 张</span>`;
|
||||
}
|
||||
header.innerHTML = `${g.label}${groupSuffix}${g.desc ? ` <span>${g.desc}</span>` : ''}`;
|
||||
list.appendChild(header);
|
||||
@@ -1295,10 +1298,15 @@ async function generateWechatBindCode() {
|
||||
btn.className = 'shop-btn';
|
||||
btn.innerHTML = `💰 ${Number(item.price).toLocaleString()}`;
|
||||
btn.onclick = async () => {
|
||||
let quantity = 1;
|
||||
if (item.type === 'sign_repair') {
|
||||
quantity = await window.promptSignRepairQuantity?.(item);
|
||||
if (quantity === null || quantity === undefined) return;
|
||||
}
|
||||
const confirmMsg =
|
||||
`确认花费 💰 ${Number(item.price).toLocaleString()} 金币购买\n【${item.name}】吗?`;
|
||||
`确认花费 💰 ${Number(item.price * quantity).toLocaleString()} 金币购买\n【${item.name}】${quantity > 1 ? ' × ' + quantity : ''} 吗?`;
|
||||
const ok = await window.chatDialog.confirm(confirmMsg, '确认购买');
|
||||
if (ok) buyItem(item.id, item.name, item.price, 'all', '');
|
||||
if (ok) buyItem(item.id, item.name, item.price, 'all', '', quantity);
|
||||
};
|
||||
}
|
||||
card.appendChild(btn);
|
||||
@@ -1341,7 +1349,7 @@ async function generateWechatBindCode() {
|
||||
};
|
||||
|
||||
/** 购买商品(最终执行) */
|
||||
window.buyItem = function(itemId, name, price, recipient, message) {
|
||||
window.buyItem = function(itemId, name, price, recipient, message, quantity = 1) {
|
||||
const roomId = window.chatContext?.roomId ?? 0;
|
||||
fetch('{{ route('shop.buy') }}', {
|
||||
method: 'POST',
|
||||
@@ -1354,6 +1362,7 @@ async function generateWechatBindCode() {
|
||||
item_id: itemId,
|
||||
recipient: recipient || 'all',
|
||||
message: message || '',
|
||||
quantity: quantity || 1,
|
||||
room_id: roomId,
|
||||
}),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user