1.修改排名走马灯数据来源,修改跑马灯逻辑,不需要循环滚动,结束就完结

This commit is contained in:
2026-03-19 17:36:42 +08:00
parent 29703e65b4
commit 5ade91ac67
+12 -10
View File
@@ -57,10 +57,10 @@
</div>
<div class="scroll-container">
<!-- <div class="scroll-content animal-css" :style="animationCss">-->
<div class="scroll-content" :style="animationCss" :class="[listData.length > 0 ? 'animal-css' : '']">
<div v-for="(item,index) in listData" :key="`top-list-data-${index}`">
<div class="scroll-content" :style="animationCss" :class="[orderListData.length > 0 ? 'animal-css' : '']">
<div v-for="(item,index) in orderListData" :key="`top-list-data-${index}`">
<img style="border-radius: 8px" :src="item.faceUrl || require('@/assets/images/bigScreen/user.png')" alt="" />
{{preName(item.name)}} {{item.userScore}} {{(index % listData.length)+1}}
{{preName(item.name)}} {{item.userScore}} {{item?.sort}}
</div>
</div>
</div>
@@ -215,6 +215,7 @@
perScore: 0
},
listData: [],
orderListData: [],
// 餐品热度数据:包含名称和热度值
valList: [],
// 轮播数据:支持图片和视频
@@ -239,11 +240,12 @@
},
computed: {
animationCss() {
return this.listData && this.listData.length > 0 ? {
return this.orderListData && this.orderListData.length > 0 ? {
// animationName: 'scroll',
animationDuration: (this.listData.length * 3 < 10 ? 10 : this.listData.length * 3) + 's',
animationDuration: (this.orderListData.length * 3 < 10 ? 10 : this.orderListData.length * 3) + 's',
animationTimingFunction: 'linear',
animationIterationCount: 'infinite'
// animationIterationCount: 'infinite',
animationFillMode: 'forwards'
} : {}
}
},
@@ -338,6 +340,7 @@
_this.mealTimeStart = res.data.mealTimeStart;
_this.mealTimeEnd = res.data.mealTimeEnd;
_this.listData = res.data.userScoreInfos || [];
_this.orderListData = res.data.userOrderInfos || [];
const maxWeight = res.data.foodSortInfos && res.data.foodSortInfos.length > 0 ? res.data.foodSortInfos[0].foodWeight || 0 : 0;
_this.valList = (res.data.foodSortInfos || []).map((item) => {
item['weightPoint'] = maxWeight === 0 ? 0 : parseFloat(((item?.foodWeight || 0) / maxWeight * 100).toFixed(2));
@@ -417,17 +420,16 @@
const currentItem = this.swiperList[currentIndex];
if (this.swiperList[currentIndex !== 0 ? currentIndex - 1 : this.swiperList.length - 1].type === '2') {
const refD = this.$refs[`videRef${currentIndex !== 0 ? currentIndex - 1 : this.swiperList.length - 1}`];
if (refD.length > 0 && refD[0]) {
if (refD && refD.length > 0 && refD[0]) {
refD[0].currentTime = 0;
refD[0].pause();
}
const refD1 = this.$refs[`videRef${currentIndex === this.swiperList.length ? this.swiperList.length - 1 : currentIndex + 1 }`];
if (refD1.length > 0 && refD1[0]) {
if (refD1 && refD1.length > 0 && refD1[0]) {
refD1[0].currentTime = 0;
refD1[0].pause();
}
}
console.log('currentItem', JSON.stringify(currentItem));
if (currentItem.type === '1') {
// 图片:按设定时长自动切换
this.swiperTimer = setTimeout(() => {
@@ -936,7 +938,7 @@
transform: translateX(0);
}
100% {
transform: translateX(-50%); /* 移动一半距离,因为复制了一份 */
transform: translateX(-100%); /* 移动一半距离,因为复制了一份 */
}
}