fix: ability

This commit is contained in:
zzc
2026-03-04 12:35:59 +08:00
parent b39ac7cb24
commit d15012841c
6 changed files with 90 additions and 106 deletions

View File

@@ -116,7 +116,8 @@ import {
saveViewRequest,
} from "@/utils/common.js";
import { onShareAppMessage, onShareTimeline, onLoad } from "@dcloudio/uni-app";
import { getShareReward, abilityCheck, watchAdReward } from "@/api/system.js";
import { getShareReward, watchAdReward } from "@/api/system.js";
import { checkAbilityAndHandle } from "@/utils/ability.js";
import { useUserStore } from "@/stores/user";
import NavBar from "@/components/NavBar/NavBar.vue";
import RewardAd from "@/components/RewardAd/RewardAd.vue";
@@ -313,41 +314,11 @@ const downloadAvatar = async (item) => {
return;
}
// Use avatar specific ability check if exists, otherwise reuse generic or skip?
// Assuming 'avatar_download' ability check exists or similar
const abilityRes = await abilityCheck("avatar_download");
if (!abilityRes.canUse) {
if (
abilityRes?.blockType === "need_share" &&
abilityRes?.message === "分享可继续"
) {
uni.showToast({
title: "分享给好友即可下载",
icon: "none",
});
return;
}
if (
abilityRes?.blockType === "need_ad" &&
abilityRes?.message === "观看广告可继续"
) {
uni.showModal({
title: "积分不足",
content: "观看广告可获得50积分继续下载",
success: (res) => {
if (res.confirm) {
rewardAdRef.value.show();
}
},
});
return;
}
uni.showToast({
title: "您今日下载次数已用完,明日再试",
icon: "none",
});
return;
}
const canProceed = await checkAbilityAndHandle(
"avatar_download",
rewardAdRef,
);
if (!canProceed) return;
uni.showLoading({ title: "下载中..." });
try {

View File

@@ -272,7 +272,7 @@
</view>
<view class="rule-item">
<uni-icons type="calendar-filled" size="18" color="#ff9800" />
<text class="rule-text">每日签到+40积分</text>
<text class="rule-text">每日签到+20积分</text>
</view>
<view class="rule-item">
<uni-icons type="videocam-filled" size="18" color="#ff9800" />

View File

@@ -115,7 +115,8 @@ import {
trackRecord,
} from "@/utils/common.js";
import { useUserStore } from "@/stores/user";
import { abilityCheck, watchAdReward } from "@/api/system.js";
import { watchAdReward } from "@/api/system.js";
import { checkAbilityAndHandle } from "@/utils/ability.js";
import LoginPopup from "@/components/LoginPopup/LoginPopup.vue";
import RewardAd from "@/components/RewardAd/RewardAd.vue";
@@ -287,39 +288,11 @@ const downloadWallpaper = async () => {
return;
}
const abilityRes = await abilityCheck("wallpaper_download");
if (!abilityRes.canUse) {
if (
abilityRes?.blockType === "need_share" &&
abilityRes?.message === "分享可继续"
) {
uni.showToast({
title: "分享给好友即可下载",
icon: "none",
});
return;
}
if (
abilityRes?.blockType === "need_ad" &&
abilityRes?.message === "观看广告可继续"
) {
uni.showModal({
title: "积分不足",
content: "观看广告可获得50积分继续下载",
success: (res) => {
if (res.confirm) {
rewardAdRef.value.show();
}
},
});
return;
}
uni.showToast({
title: "您今日壁纸下载次数已用完,明日再试",
icon: "none",
});
return;
}
const canProceed = await checkAbilityAndHandle(
"wallpaper_download",
rewardAdRef,
);
if (!canProceed) return;
uni.showLoading({ title: "下载中..." });
try {

View File

@@ -104,7 +104,8 @@ import {
getShareToken,
} from "@/utils/common.js";
import { onShareAppMessage, onShareTimeline, onLoad } from "@dcloudio/uni-app";
import { getShareReward, abilityCheck, watchAdReward } from "@/api/system.js";
import { getShareReward, watchAdReward } from "@/api/system.js";
import { checkAbilityAndHandle } from "@/utils/ability.js";
import { useUserStore } from "@/stores/user";
import { saveViewRequest, trackRecord } from "@/utils/common.js";
import NavBar from "@/components/NavBar/NavBar.vue";
@@ -303,39 +304,11 @@ const downloadWallpaper = async (item) => {
return;
}
const abilityRes = await abilityCheck("wallpaper_download");
if (!abilityRes.canUse) {
if (
abilityRes?.blockType === "need_share" &&
abilityRes?.message === "分享可继续"
) {
uni.showToast({
title: "分享给好友即可下载",
icon: "none",
});
return;
}
if (
abilityRes?.blockType === "need_ad" &&
abilityRes?.message === "观看广告可继续"
) {
uni.showModal({
title: "积分不足",
content: "观看广告可获得50积分继续下载",
success: (res) => {
if (res.confirm) {
rewardAdRef.value.show();
}
},
});
return;
}
uni.showToast({
title: "您今日壁纸下载次数已用完,明日再试",
icon: "none",
});
return;
}
const canProceed = await checkAbilityAndHandle(
"wallpaper_download",
rewardAdRef,
);
if (!canProceed) return;
uni.showLoading({ title: "下载中..." });
try {