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

@@ -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 {