fix: lock resousers
This commit is contained in:
@@ -110,12 +110,15 @@ export const createTracking = async (data) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const watchAdReward = async (token) => {
|
export const watchAdReward = async (token, scene, type, resourceId) => {
|
||||||
return request({
|
return request({
|
||||||
url: "/api/ad/reward",
|
url: "/api/ad/reward",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: {
|
data: {
|
||||||
rewardToken: token,
|
rewardToken: token,
|
||||||
|
scene,
|
||||||
|
type,
|
||||||
|
resourceId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -210,17 +210,7 @@
|
|||||||
>
|
>
|
||||||
<!-- Badge -->
|
<!-- Badge -->
|
||||||
<view class="unlock-badge" :class="tpl.unlockType">
|
<view class="unlock-badge" :class="tpl.unlockType">
|
||||||
{{
|
{{ getUnlockLabel(tpl.unlockType) }}
|
||||||
tpl.unlockType === "sing3"
|
|
||||||
? "登录3天"
|
|
||||||
: tpl.unlockType === "sing1"
|
|
||||||
? "登录1天"
|
|
||||||
: tpl.unlockType === "ad"
|
|
||||||
? "广告"
|
|
||||||
: tpl.unlockType === "vip"
|
|
||||||
? "VIP"
|
|
||||||
: "解锁"
|
|
||||||
}}
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- Center Lock -->
|
<!-- Center Lock -->
|
||||||
@@ -564,7 +554,7 @@ import {
|
|||||||
getCardMusicList,
|
getCardMusicList,
|
||||||
} from "@/api/make";
|
} from "@/api/make";
|
||||||
import { getShareReward, msgCheckApi, watchAdReward } from "@/api/system";
|
import { getShareReward, msgCheckApi, watchAdReward } from "@/api/system";
|
||||||
import { checkAbilityAndHandle } from "@/utils/ability.js";
|
import { checkAbilityAndHandle, getUnlockLabel } from "@/utils/ability.js";
|
||||||
import {
|
import {
|
||||||
onShareAppMessage,
|
onShareAppMessage,
|
||||||
onShareTimeline,
|
onShareTimeline,
|
||||||
@@ -1383,7 +1373,7 @@ const currentTemplate = ref(templates.value[0]);
|
|||||||
const currentUnlockTpl = ref(null);
|
const currentUnlockTpl = ref(null);
|
||||||
|
|
||||||
const applyTemplate = (tpl) => {
|
const applyTemplate = (tpl) => {
|
||||||
if (tpl.isUnlock === false) {
|
if (tpl.unlockType && !tpl.isUnlock) {
|
||||||
handleUnlock(tpl);
|
handleUnlock(tpl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1405,17 +1395,17 @@ const handleUnlock = (tpl) => {
|
|||||||
break;
|
break;
|
||||||
case "ad":
|
case "ad":
|
||||||
currentUnlockTpl.value = tpl;
|
currentUnlockTpl.value = tpl;
|
||||||
rewardAdRef.value.showAd();
|
rewardAdRef.value.show();
|
||||||
break;
|
break;
|
||||||
case "sing1":
|
case "sing1":
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "需要连续登录1天解锁",
|
title: "需要登录1天解锁",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "sing3":
|
case "sing3":
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "需要连续登录3天解锁",
|
title: "需要登录3天解锁",
|
||||||
icon: "none",
|
icon: "none",
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@@ -1429,7 +1419,12 @@ const handleUnlock = (tpl) => {
|
|||||||
|
|
||||||
const handleAdReward = async (token) => {
|
const handleAdReward = async (token) => {
|
||||||
try {
|
try {
|
||||||
const res = await watchAdReward(token);
|
const res = await watchAdReward(
|
||||||
|
token,
|
||||||
|
"unlock",
|
||||||
|
activeTool.value === "template" ? "card_template" : "card_title_template",
|
||||||
|
currentUnlockTpl.value.id,
|
||||||
|
);
|
||||||
if (res) {
|
if (res) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "解锁成功",
|
title: "解锁成功",
|
||||||
|
|||||||
@@ -68,3 +68,24 @@ export const checkAbilityAndHandle = async (scene) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the display label for an unlock type.
|
||||||
|
* @param {string} unlockType - The unlock type identifier.
|
||||||
|
* @returns {string} - The display label.
|
||||||
|
*/
|
||||||
|
export const getUnlockLabel = (unlockType) => {
|
||||||
|
if (!unlockType) return "解锁";
|
||||||
|
switch (unlockType) {
|
||||||
|
case "sing3":
|
||||||
|
return "登录3天";
|
||||||
|
case "sing1":
|
||||||
|
return "登录1天";
|
||||||
|
case "ad":
|
||||||
|
return "广告";
|
||||||
|
case "vip":
|
||||||
|
return "VIP";
|
||||||
|
default:
|
||||||
|
return "解锁";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user