优化:周卡分组标题显示当前已激活的特效名称
购买了全屏特效(周卡)后,商店「📅 周卡」分组标题旁 显示绿色徽章「✅ 已激活:XXX」,与自动钓鱼卡的剩余时间 徽章风格统一。
This commit is contained in:
@@ -822,13 +822,22 @@
|
||||
const header = document.createElement('div');
|
||||
header.className = 'shop-group-header';
|
||||
|
||||
// 自动钓鱼卡分组:若持有有效卡,在标题后附加剩余时间徽章
|
||||
// 分组标题徽章:
|
||||
// - auto_fishing:显示剩余时间(紫色)
|
||||
// - duration:显示当前已激活的周卡名称(绿色)
|
||||
let groupSuffix = '';
|
||||
if (g.type === 'auto_fishing' && (data.auto_fishing_minutes_left || 0) > 0) {
|
||||
const left = data.auto_fishing_minutes_left;
|
||||
const leftStr = left >= 60 ? Math.floor(left / 60) + ' 小时' : left + ' 分钟';
|
||||
groupSuffix =
|
||||
` <span style="display:inline-block;margin-left:8px;padding:1px 8px;background:#7c3aed;color:#fff;border-radius:10px;font-size:10px;font-weight:bold;vertical-align:middle;">⏳ 剩余 ${leftStr}</span>`;
|
||||
} else if (g.type === 'duration' && data.active_week_effect) {
|
||||
// active_week_effect 是 effectKey 字符串,从 items 列表反查对应商品名称
|
||||
const effKey = data.active_week_effect;
|
||||
const effItem = data.items.find(i => i.type === 'duration' && i.slug.includes(effKey));
|
||||
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>`;
|
||||
}
|
||||
header.innerHTML = `${g.label}${groupSuffix}${g.desc ? ` <span>${g.desc}</span>` : ''}`;
|
||||
list.appendChild(header);
|
||||
|
||||
Reference in New Issue
Block a user