feat(每日充值活动页面): 调整接口、添加奖励、调整网络图片路径

This commit is contained in:
hzj 2026-04-30 16:54:44 +08:00
parent 4458ff3aa6
commit 52b0f313a5
2 changed files with 104 additions and 9 deletions

View File

@ -88,9 +88,9 @@ export const getDailyRechargeInfo = async () => {
}
// 领取每日充值活动 task1 历史累计奖励
export const claimDailyRechargeTask1 = async () => {
export const claimDailyRechargeTask1 = async (data) => {
try {
const response = await post('/activity/daily-recharge/claim/task1')
const response = await post('/activity/daily-recharge/claim/task1', data)
return response
} catch (error) {
console.error('Failed to claim daily recharge task1 reward:', error)

View File

@ -316,7 +316,7 @@ justify-content: flex-start;
justify-content: center;
"
>
<div class="reward-showcase-vap-wrap">
<div class="reward-showcase-vap-wrap" :key="mainRewardRenderKey">
<VapMp4Player
v-if="mainReward.sourceUrl"
:model-value="true"
@ -355,7 +355,7 @@ justify-content: flex-start;
<div class="reward-showcase-grid">
<div
v-for="(reward, index) in rewardGridList"
:key="index"
:key="getRewardRenderKey(reward, index)"
class="reward-showcase-item"
>
<div
@ -368,6 +368,15 @@ justify-content: flex-start;
"
>
<img
v-if="isLocalRewardAsset(reward)"
v-smart-img.noFade
:src="reward.cover || ''"
alt=""
style="display: block; width: 90%; object-fit: contain"
@error="(e) => handleRewardImageError(e, reward.type)"
/>
<img
v-else
:src="reward.cover || ''"
alt=""
style="display: block; width: 90%; object-fit: contain"
@ -500,8 +509,8 @@ const isRtlLayout = computed(() => {
locale.value && setDocumentDirection(locale.value)
const imageUrl = (filename) => getPngUrl('Activities/ActiveGame/', filename)
const mp4Url = (filename) => getMp4Url('Activities/ActiveGame/', filename)
const imageUrl = (filename) => getPngUrl('Activities/DailyRecharge/', filename)
const mp4Url = (filename) => getMp4Url('Activities/DailyRecharge/', filename)
const bgVapUrl = mp4Url('bg')
const CHEST_PROGRESS_GAP_VW = 2
const CHEST_PROGRESS_ITEM_WIDTH_VW = 14
@ -562,7 +571,6 @@ const currentTask2RewardTop = computed(() => {
const canClaimTask2Reward = computed(() => {
return (
!taskInfo.value.task2Claimed &&
task1Completed.value &&
taskInfo.value.task2Completed &&
Boolean(currentTask2RewardTop.value?.rule?.id) &&
!claimingTask2Reward.value
@ -658,6 +666,89 @@ const mainReward = computed(() => {
const rewardGridList = computed(() => {
return selectedRewardList.value.slice(1, 7)
})
const mainRewardRenderKey = computed(() => {
return mainReward.value ? getRewardRenderKey(mainReward.value, 0) : 'empty-main-reward'
})
const isLocalRewardAsset = (reward) => {
return Boolean(reward?.localRewardAsset)
}
const getRewardRenderKey = (reward, index) => {
return [
selectedRewardLevel.value,
index,
reward?.type || '',
reward?.detailType || '',
reward?.cover || '',
reward?.sourceUrl || '',
].join('-')
}
const getExtraRewardsByLevel = (level) => {
switch (Number(level)) {
case 8:
return [
{
type: 'GIFT',
cover: imageUrl('reward_gift'),
content: 1,
localRewardAsset: true,
},
]
case 9:
return [
{
type: 'PROPS',
detailType: 'AVATAR_FRAME',
cover: imageUrl('reward_frame'),
quantity: 365,
localRewardAsset: true,
},
]
case 10:
return [
{
type: 'PROPS',
detailType: 'RIDE',
cover: imageUrl('reward_ride'),
quantity: 60,
localRewardAsset: true,
},
{
type: 'BANNER',
cover: imageUrl('reward_banner'),
quantity: 15,
localRewardAsset: true,
},
]
default:
return []
}
}
const appendExtraRewards = (rewardTopList) => {
return rewardTopList.map((rewardTop, index) => {
const level = Number(rewardTop?.rule?.level || index + 1)
const extraRewards = getExtraRewardsByLevel(level)
if (!extraRewards.length) {
return rewardTop
}
const propsGroup = rewardTop.propsGroup || {}
const activityRewardProps = Array.isArray(propsGroup.activityRewardProps)
? propsGroup.activityRewardProps
: []
return {
...rewardTop,
propsGroup: {
...propsGroup,
activityRewardProps: [...activityRewardProps, ...extraRewards],
},
}
})
}
const toggleAmountVisible = () => {
amountVisible.value = !amountVisible.value
@ -711,7 +802,7 @@ const claimTask1Reward = useThrottle(async () => {
claimingTask1Reward.value = true
try {
const res = await claimDailyRechargeTask1()
const res = await claimDailyRechargeTask1({})
if (res.status) {
await getDailyRechargeTaskInfo()
}
@ -759,7 +850,7 @@ const getDailyRechargeTaskInfo = async () => {
const getActivityRewards = async () => {
const res = await apiGetActivityResource('DAILY_RECHARGE_TASK2')
if (res.status && res.body) {
activityRewards.value = Array.isArray(res.body) ? res.body : []
activityRewards.value = Array.isArray(res.body) ? appendExtraRewards(res.body) : []
}
}
@ -781,6 +872,10 @@ const preloadCriticalImages = async () => {
imageUrl('amountHiddenBt'),
imageUrl('done'),
imageUrl('LvActive'),
imageUrl('reward_gift'),
imageUrl('reward_frame'),
imageUrl('reward_ride'),
imageUrl('reward_banner'),
...chestImages,
imageUrl(getImgName('LvRewardTitle')),
imageUrl(getImgName('receiveBt')),