fix: lock resousers

This commit is contained in:
zzc
2026-03-11 17:44:24 +08:00
parent 9c4f0c5650
commit f653e6659a
2 changed files with 59 additions and 16 deletions

View File

@@ -169,6 +169,21 @@
<view v-if="title?.id === currentTitle?.id" class="tpl-check" <view v-if="title?.id === currentTitle?.id" class="tpl-check"
></view ></view
> >
<!-- Lock Overlay -->
<view
v-if="!title.isUnlock && title.unlockType"
class="lock-overlay"
>
<!-- Badge -->
<view class="unlock-badge" :class="title.unlockType">
{{ getUnlockLabel(title.unlockType) }}
</view>
<!-- Center Lock -->
<view class="center-lock">
<uni-icons type="locked-filled" size="18" color="#fff" />
</view>
</view>
</view> </view>
</view> </view>
<view v-if="loadingTitles" class="loading-more">加载中...</view> <view v-if="loadingTitles" class="loading-more">加载中...</view>
@@ -1397,15 +1412,21 @@ const handleUnlock = (tpl) => {
currentUnlockTpl.value = tpl; currentUnlockTpl.value = tpl;
rewardAdRef.value.show(); rewardAdRef.value.show();
break; break;
case "sing1": case "sing3":
uni.showToast({ uni.showToast({
title: "需要登录1天解锁", title: "需要连续签到1天解锁",
icon: "none", icon: "none",
}); });
break; break;
case "sing3": case "sing5":
uni.showToast({ uni.showToast({
title: "需要登录3天解锁", title: "需要连续签到5天解锁",
icon: "none",
});
break;
case "sing7":
uni.showToast({
title: "需要连续签到7天解锁",
icon: "none", icon: "none",
}); });
break; break;
@@ -1433,6 +1454,8 @@ const handleAdReward = async (token) => {
// 解锁成功后,更新本地状态,允许使用 // 解锁成功后,更新本地状态,允许使用
if (currentUnlockTpl.value) { if (currentUnlockTpl.value) {
currentUnlockTpl.value.isUnlock = true; currentUnlockTpl.value.isUnlock = true;
if (activeTool.value === "template") {
// 同时更新列表中的状态 // 同时更新列表中的状态
const index = templates.value.findIndex( const index = templates.value.findIndex(
(t) => t.id === currentUnlockTpl.value.id, (t) => t.id === currentUnlockTpl.value.id,
@@ -1440,8 +1463,18 @@ const handleAdReward = async (token) => {
if (index !== -1) { if (index !== -1) {
templates.value[index].isUnlock = true; templates.value[index].isUnlock = true;
} }
applyTemplate(currentUnlockTpl.value); 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);
}
currentUnlockTpl.value = null; currentUnlockTpl.value = null;
} }
} }
@@ -1452,6 +1485,10 @@ const handleAdReward = async (token) => {
}; };
const selectTitle = (title) => { const selectTitle = (title) => {
if (title.unlockType && !title.isUnlock) {
handleUnlock(title);
return;
}
trackRecord({ trackRecord({
eventName: "card_title_choose", eventName: "card_title_choose",
eventType: "click", eventType: "click",
@@ -2045,7 +2082,9 @@ function drawRoundRect(ctx, x, y, w, h, r, color) {
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
} }
&.sing1, &.sing1,
&.sing3 { &.sing3,
&.sing5,
&.sing7 {
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); 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%); background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
} }
&.sing1, &.sing1,
&.sing3 { &.sing3,
&.sing5,
&.sing7 {
background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
} }
} }

View File

@@ -78,9 +78,11 @@ export const getUnlockLabel = (unlockType) => {
if (!unlockType) return "解锁"; if (!unlockType) return "解锁";
switch (unlockType) { switch (unlockType) {
case "sing3": case "sing3":
return "登录3天"; return "连续签到3天";
case "sing1": case "sing5":
return "登录1天"; return "连续签到5天";
case "sing7":
return "连续签到7天";
case "ad": case "ad":
return "广告"; return "广告";
case "vip": case "vip":