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

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