From f653e6659a8af0824bd243080b55a8d1af979999 Mon Sep 17 00:00:00 2001 From: zzc <1761997216@qq.com> Date: Wed, 11 Mar 2026 17:44:24 +0800 Subject: [PATCH] fix: lock resousers --- pages/make/index.vue | 67 +++++++++++++++++++++++++++++++++++--------- utils/ability.js | 8 ++++-- 2 files changed, 59 insertions(+), 16 deletions(-) diff --git a/pages/make/index.vue b/pages/make/index.vue index ae5a07d..bb83aa7 100644 --- a/pages/make/index.vue +++ b/pages/make/index.vue @@ -169,6 +169,21 @@ + + + + + {{ getUnlockLabel(title.unlockType) }} + + + + + + + 加载中... @@ -1397,15 +1412,21 @@ const handleUnlock = (tpl) => { currentUnlockTpl.value = tpl; rewardAdRef.value.show(); break; - case "sing1": + case "sing3": uni.showToast({ - title: "需要登录1天解锁", + title: "需要连续签到1天解锁", icon: "none", }); break; - case "sing3": + case "sing5": uni.showToast({ - title: "需要登录3天解锁", + title: "需要连续签到5天解锁", + icon: "none", + }); + break; + case "sing7": + uni.showToast({ + title: "需要连续签到7天解锁", icon: "none", }); break; @@ -1433,15 +1454,27 @@ const handleAdReward = async (token) => { // 解锁成功后,更新本地状态,允许使用 if (currentUnlockTpl.value) { currentUnlockTpl.value.isUnlock = true; - // 同时更新列表中的状态 - const index = templates.value.findIndex( - (t) => t.id === currentUnlockTpl.value.id, - ); - if (index !== -1) { - templates.value[index].isUnlock = true; + + if (activeTool.value === "template") { + // 同时更新列表中的状态 + const index = templates.value.findIndex( + (t) => t.id === currentUnlockTpl.value.id, + ); + if (index !== -1) { + templates.value[index].isUnlock = true; + } + applyTemplate(currentUnlockTpl.value); + } else if (activeTool.value === "title") { + // 同时更新列表中的状态 + const index = titles.value.findIndex( + (t) => t.id === currentUnlockTpl.value.id, + ); + if (index !== -1) { + titles.value[index].isUnlock = true; + } + selectTitle(currentUnlockTpl.value); } - applyTemplate(currentUnlockTpl.value); currentUnlockTpl.value = null; } } @@ -1452,6 +1485,10 @@ const handleAdReward = async (token) => { }; const selectTitle = (title) => { + if (title.unlockType && !title.isUnlock) { + handleUnlock(title); + return; + } trackRecord({ eventName: "card_title_choose", eventType: "click", @@ -2045,7 +2082,9 @@ function drawRoundRect(ctx, x, y, w, h, r, color) { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); } &.sing1, - &.sing3 { + &.sing3, + &.sing5, + &.sing7 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); } } @@ -2296,7 +2335,9 @@ function drawRoundRect(ctx, x, y, w, h, r, color) { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); } &.sing1, - &.sing3 { + &.sing3, + &.sing5, + &.sing7 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); } } diff --git a/utils/ability.js b/utils/ability.js index 1affb6a..7b26ffd 100644 --- a/utils/ability.js +++ b/utils/ability.js @@ -78,9 +78,11 @@ export const getUnlockLabel = (unlockType) => { if (!unlockType) return "解锁"; switch (unlockType) { case "sing3": - return "登录3天"; - case "sing1": - return "登录1天"; + return "连续签到3天"; + case "sing5": + return "连续签到5天"; + case "sing7": + return "连续签到7天"; case "ad": return "广告"; case "vip":