feat(新年活动-->弹幕组件): 样式调整

This commit is contained in:
hzj 2026-01-06 19:27:32 +08:00
parent f43fd31229
commit b7ecc6f0f5

View File

@ -1,57 +1,32 @@
<!-- Barrage.vue 优化版 --> <!-- Barrage.vue 优化版 -->
<template> <template>
<div <div style="position: relative; width: 100%; height: 32vw; overflow: hidden; pointer-events: none">
style="position: relative; width: 100%; height: 32vw; overflow: hidden; pointer-events: none"
>
<!-- 双行弹幕轨道 --> <!-- 双行弹幕轨道 -->
<div <div v-for="(track, index) in visibleTracks" :key="index" style="position: absolute; width: 100%; height: 50px"
v-for="(track, index) in visibleTracks" :style="{ top: `calc(${index} * 16vw)` }">
:key="index" <div v-for="item in track" :key="item.id" class="barrage-item" style="
style="position: absolute; width: 100%; height: 50px"
:style="{ top: `calc(${index} * 16vw)` }"
>
<div
v-for="item in track"
:key="item.id"
class="barrage-item"
style="
position: absolute; position: absolute;
border-radius: 48px; border-radius: 26px;
padding: 4px; padding: 4px;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 4px; gap: 4px;
" backdrop-filter: blur(1px);
:style="getBarrageStyle(item)" " :style="getBarrageStyle(item)" @animationend="handleAnimationEnd(item.id)">
@animationend="handleAnimationEnd(item.id)" <img v-smart-img :src="item.avatar || ''" alt="" style="
>
<img
v-smart-img
:src="item.avatar || ''"
alt=""
style="
width: 10vw; width: 10vw;
border-radius: 50%; border-radius: 50%;
display: block; display: block;
aspect-ratio: 1/1; aspect-ratio: 1/1;
object-fit: cover; object-fit: cover;
" " @error="handleAvatarImageError" />
@error="handleAvatarImageError" <div style="
/>
<div
style="
font-weight: 700; font-weight: 700;
background-clip: text; background-clip: text;
-webkit-background-clip: text; -webkit-background-clip: text;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;
" background-image: linear-gradient(180deg, #FFF9A9 26.92%, #ED7D0A 52.08%, #FFFAB5 73.08%)
:style="{ ">
backgroundImage:
item.type != ''
? '-webkit-linear-gradient(180deg, #FFF9A9 26.92%, #ED7D0A 52.08%, #FFFAB5 73.08%)'
: '-webkit-linear-gradient(180deg, #A9FFA9 26.92%, #0AED47 52.08%, #B5FFC5 73.08%)',
}"
>
{{ barrageText(item) }} {{ barrageText(item) }}
</div> </div>
</div> </div>
@ -112,11 +87,11 @@ const getBarrageStyle = (item) => {
animationDuration: `${item.duration}s`, animationDuration: `${item.duration}s`,
animationDelay: `${item.delay}s`, animationDelay: `${item.delay}s`,
'--start-pos': `${item.startPos}px`, '--start-pos': `${item.startPos}px`,
border: item.prizeType == 'MONEY' ? '0.667px solid #77FF87' : '0.667px solid #FFF677', border: item.prizeType == 'MONEY' ? '1px solid #FFF1B2' : '1px solid #BAD0FF',
background: background:
item.prizeType == 'MONEY' item.prizeType == 'MONEY'
? 'linear-gradient(270deg, rgba(2, 218, 60, 0.60) -16.85%, rgba(0, 124, 54, 0.60) 82.7%)' ? 'linear-gradient(270deg, rgba(255, 222, 77, 0.65) 0%, rgba(117, 95, 0, 0.20) 93.75%)'
: 'linear-gradient(270deg, rgba(218, 103, 2, 0.60) -16.85%, rgba(124, 41, 0, 0.60) 82.7%)', : 'linear-gradient(270deg, rgba(103, 152, 255, 0.65) 0%, rgba(32, 77, 173, 0.20) 93.75%)',
// RTL // RTL
...(isRTL ...(isRTL
? { ? {
@ -228,6 +203,7 @@ watch(
</script> </script>
<style scoped> <style scoped>
/* 样式保持不变(同之前版本) */ /* 样式保持不变(同之前版本) */
.barrage-item { .barrage-item {
will-change: transform; will-change: transform;
@ -238,6 +214,7 @@ watch(
0% { 0% {
transform: translateX(100vw); transform: translateX(100vw);
} }
100% { 100% {
transform: translateX(-100%); transform: translateX(-100%);
} }
@ -252,6 +229,7 @@ watch(
0% { 0% {
transform: translateX(-100vw); transform: translateX(-100vw);
} }
100% { 100% {
transform: translateX(100%); transform: translateX(100%);
} }