feat(每日充值活动页面): 调整接口、添加奖励、调整网络图片路径
This commit is contained in:
parent
4458ff3aa6
commit
52b0f313a5
@ -88,9 +88,9 @@ export const getDailyRechargeInfo = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 领取每日充值活动 task1 历史累计奖励
|
// 领取每日充值活动 task1 历史累计奖励
|
||||||
export const claimDailyRechargeTask1 = async () => {
|
export const claimDailyRechargeTask1 = async (data) => {
|
||||||
try {
|
try {
|
||||||
const response = await post('/activity/daily-recharge/claim/task1')
|
const response = await post('/activity/daily-recharge/claim/task1', data)
|
||||||
return response
|
return response
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to claim daily recharge task1 reward:', error)
|
console.error('Failed to claim daily recharge task1 reward:', error)
|
||||||
|
|||||||
@ -316,7 +316,7 @@ justify-content: flex-start;
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<div class="reward-showcase-vap-wrap">
|
<div class="reward-showcase-vap-wrap" :key="mainRewardRenderKey">
|
||||||
<VapMp4Player
|
<VapMp4Player
|
||||||
v-if="mainReward.sourceUrl"
|
v-if="mainReward.sourceUrl"
|
||||||
:model-value="true"
|
:model-value="true"
|
||||||
@ -355,7 +355,7 @@ justify-content: flex-start;
|
|||||||
<div class="reward-showcase-grid">
|
<div class="reward-showcase-grid">
|
||||||
<div
|
<div
|
||||||
v-for="(reward, index) in rewardGridList"
|
v-for="(reward, index) in rewardGridList"
|
||||||
:key="index"
|
:key="getRewardRenderKey(reward, index)"
|
||||||
class="reward-showcase-item"
|
class="reward-showcase-item"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@ -368,6 +368,15 @@ justify-content: flex-start;
|
|||||||
"
|
"
|
||||||
>
|
>
|
||||||
<img
|
<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 || ''"
|
:src="reward.cover || ''"
|
||||||
alt=""
|
alt=""
|
||||||
style="display: block; width: 90%; object-fit: contain"
|
style="display: block; width: 90%; object-fit: contain"
|
||||||
@ -500,8 +509,8 @@ const isRtlLayout = computed(() => {
|
|||||||
|
|
||||||
locale.value && setDocumentDirection(locale.value)
|
locale.value && setDocumentDirection(locale.value)
|
||||||
|
|
||||||
const imageUrl = (filename) => getPngUrl('Activities/ActiveGame/', filename)
|
const imageUrl = (filename) => getPngUrl('Activities/DailyRecharge/', filename)
|
||||||
const mp4Url = (filename) => getMp4Url('Activities/ActiveGame/', filename)
|
const mp4Url = (filename) => getMp4Url('Activities/DailyRecharge/', filename)
|
||||||
const bgVapUrl = mp4Url('bg')
|
const bgVapUrl = mp4Url('bg')
|
||||||
const CHEST_PROGRESS_GAP_VW = 2
|
const CHEST_PROGRESS_GAP_VW = 2
|
||||||
const CHEST_PROGRESS_ITEM_WIDTH_VW = 14
|
const CHEST_PROGRESS_ITEM_WIDTH_VW = 14
|
||||||
@ -562,7 +571,6 @@ const currentTask2RewardTop = computed(() => {
|
|||||||
const canClaimTask2Reward = computed(() => {
|
const canClaimTask2Reward = computed(() => {
|
||||||
return (
|
return (
|
||||||
!taskInfo.value.task2Claimed &&
|
!taskInfo.value.task2Claimed &&
|
||||||
task1Completed.value &&
|
|
||||||
taskInfo.value.task2Completed &&
|
taskInfo.value.task2Completed &&
|
||||||
Boolean(currentTask2RewardTop.value?.rule?.id) &&
|
Boolean(currentTask2RewardTop.value?.rule?.id) &&
|
||||||
!claimingTask2Reward.value
|
!claimingTask2Reward.value
|
||||||
@ -658,6 +666,89 @@ const mainReward = computed(() => {
|
|||||||
const rewardGridList = computed(() => {
|
const rewardGridList = computed(() => {
|
||||||
return selectedRewardList.value.slice(1, 7)
|
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 = () => {
|
const toggleAmountVisible = () => {
|
||||||
amountVisible.value = !amountVisible.value
|
amountVisible.value = !amountVisible.value
|
||||||
@ -711,7 +802,7 @@ const claimTask1Reward = useThrottle(async () => {
|
|||||||
|
|
||||||
claimingTask1Reward.value = true
|
claimingTask1Reward.value = true
|
||||||
try {
|
try {
|
||||||
const res = await claimDailyRechargeTask1()
|
const res = await claimDailyRechargeTask1({})
|
||||||
if (res.status) {
|
if (res.status) {
|
||||||
await getDailyRechargeTaskInfo()
|
await getDailyRechargeTaskInfo()
|
||||||
}
|
}
|
||||||
@ -759,7 +850,7 @@ const getDailyRechargeTaskInfo = async () => {
|
|||||||
const getActivityRewards = async () => {
|
const getActivityRewards = async () => {
|
||||||
const res = await apiGetActivityResource('DAILY_RECHARGE_TASK2')
|
const res = await apiGetActivityResource('DAILY_RECHARGE_TASK2')
|
||||||
if (res.status && res.body) {
|
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('amountHiddenBt'),
|
||||||
imageUrl('done'),
|
imageUrl('done'),
|
||||||
imageUrl('LvActive'),
|
imageUrl('LvActive'),
|
||||||
|
imageUrl('reward_gift'),
|
||||||
|
imageUrl('reward_frame'),
|
||||||
|
imageUrl('reward_ride'),
|
||||||
|
imageUrl('reward_banner'),
|
||||||
...chestImages,
|
...chestImages,
|
||||||
imageUrl(getImgName('LvRewardTitle')),
|
imageUrl(getImgName('LvRewardTitle')),
|
||||||
imageUrl(getImgName('receiveBt')),
|
imageUrl(getImgName('receiveBt')),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user