feat(弹幕组件): 补充前三名奖励,并添加翻译

This commit is contained in:
hzj 2026-01-20 18:25:14 +08:00
parent 3c7c84edb8
commit 2b21a3282b
5 changed files with 99 additions and 30 deletions

View File

@ -464,5 +464,8 @@
"check_in_successful": "تم تسجيل الدخول بنجاح.",
"you_get": "لقد حصلت على",
"not_enough_pieces": "ليس لديك قطع كافية",
"confirm_item_exchange": "هل أنت متأكد أنك تريد تبديل العنصر الحالي؟"
"confirm_item_exchange": "هل أنت متأكد أنك تريد تبديل العنصر الحالي؟",
"heartbeat_value_points_4_percent": "العملات الذهبية: {amount} (4% من نقاط قيمة نبض القلب) × 2؛",
"heartbeat_value_points_3_percent": "العملات الذهبية: {amount} (3% من نقاط قيمة نبض القلب) × 2؛",
"heartbeat_value_points_2_percent": "العملات الذهبية: {amount} (2% من نقاط قيمة نبض القلب) × 2؛"
}

View File

@ -464,5 +464,8 @@
"check_in_successful": "Check-in successful.",
"you_get": "You Get",
"not_enough_pieces": "You don't have enough pieces",
"confirm_item_exchange": "Are you sure you want to exchange the current item?"
"confirm_item_exchange": "Are you sure you want to exchange the current item?",
"heartbeat_value_points_4_percent": "Coins: {amount} (4% of Heartbeat Value points) * 2;",
"heartbeat_value_points_3_percent": "Coins: {amount} (3% of Heartbeat Value points) * 2;",
"heartbeat_value_points_2_percent": "Coins: {amount} (2% of Heartbeat Value points) * 2;"
}

View File

@ -464,5 +464,8 @@
"check_in_successful": "签到成功。",
"you_get": "您获得了",
"not_enough_pieces": "您没有足够的碎片",
"confirm_item_exchange": "您确定要兑换当前物品吗?"
"confirm_item_exchange": "您确定要兑换当前物品吗?",
"heartbeat_value_points_4_percent": "金币: {amount} (心跳值点数的4%) * 2;",
"heartbeat_value_points_3_percent": "金币: {amount} (心跳值点数的3%) * 2;",
"heartbeat_value_points_2_percent": "金币: {amount} (心跳值点数的2%) * 2;"
}

View File

@ -96,7 +96,7 @@
v-for="(value, index) in 3"
:ranking="index + 1 + ''"
:rankingItem="RankingHasTop3[index] || {}"
:rewards="rewardsTop3[index] || {}"
:rewards="showRewardsTop3[index] || {}"
/>
</div>
@ -464,7 +464,68 @@ const changeTag = (module) => {
}
}
const rewardsTop3 = ref([]) //
const rewardsTop3 = ref([]) //
//
const showRewardsTop3 = computed(() => {
let newRewardsTop3 = rewardsTop3.value
//
if (seasonShow.value) {
newRewardsTop3[0].activityRewardProps.push(
{
cover: '',
content: 'Banner*30Days',
quantity: 0,
type: 'GIFT',
},
{
cover: '',
content: 'ID: 7 digits * 1',
quantity: 0,
type: 'GIFT',
},
)
}
//
else {
//
newRewardsTop3[0]?.activityRewardProps.push(
{
cover: '',
content: t('heartbeat_value_points_4_percent', {
amount: formatLargeNumber(Number(RankingHasTop3.value[0]?.totalNumber) * 0.04),
}),
quantity: 0,
type: 'GIFT',
},
{
cover: '',
content: 'Homepage Ad* 7 days',
quantity: 0,
type: 'GIFT',
},
)
//
newRewardsTop3[1]?.activityRewardProps.push({
cover: '',
content: t('heartbeat_value_points_3_percent', {
amount: formatLargeNumber(Number(RankingHasTop3.value[1]?.totalNumber) * 0.03),
}),
quantity: 0,
type: 'GIFT',
})
//
newRewardsTop3[2]?.activityRewardProps.push({
cover: '',
content: t('heartbeat_value_points_2_percent', {
amount: formatLargeNumber(Number(RankingHasTop3.value[2]?.totalNumber) * 0.02),
}),
quantity: 0,
type: 'GIFT',
})
}
return newRewardsTop3
})
const RankingLoadmore = ref(null) //
const rankingPageNo = ref(1) //
@ -519,6 +580,23 @@ const getDigitImageUrl = (digit) => {
return ''
}
// script
const formatLargeNumber = (num) => {
if (typeof num !== 'number' || isNaN(num)) {
return '0'
}
const absNum = Math.abs(num)
if (absNum >= 1000000) {
return (num / 1000000).toFixed(2) + 'M'
} else if (absNum >= 1000) {
return (num / 1000).toFixed(2) + 'K'
} else {
return num.toString()
}
}
//
const apiGetRanking = async () => {
let type = weeklyShow.value ? 'WEEK' : 'SEASON'
@ -540,29 +618,6 @@ const apiGetTop3Rewards = async () => {
const response = await apiGetCpRewardPool(type)
if (response.status && response.body) {
let rewards = response.body
if (seasonShow.value) {
rewards[0].activityRewardProps.push(
{
cover: '',
content: 'Banner*30Days',
quantity: 0,
type: 'GIFT',
},
{
cover: '',
content: 'ID: 7 digits * 1',
quantity: 0,
type: 'GIFT',
},
)
} else {
rewards[0].activityRewardProps.push({
cover: '',
content: 'Homepage Ad* 7 days',
quantity: 0,
type: 'GIFT',
})
}
rewardsTop3.value = response.body || [] //
}

View File

@ -251,12 +251,17 @@
<div style="height: 100%; display: flex; align-items: center; overflow: hidden">
<!-- 滚动容器 -->
<div class="scroll-wrapper">
<!-- 第一套内容 -->
<!-- 2套内容 -->
<div class="scroll-content" v-for="value in 2">
<div
v-for="(item, index) in rewards.activityRewardProps"
:key="index"
style="display: flex; align-items: center; gap: 1vw"
style="
display: flex;
align-items: center;
padding: 0 1vw;
border-right: 0.5px solid #fff;
"
@click="clickReward(item)"
>
<!-- 预览图 -->