diff --git a/src/views/dataBoard/dataBoard.vue b/src/views/dataBoard/dataBoard.vue index 0395b91..18fc42e 100644 --- a/src/views/dataBoard/dataBoard.vue +++ b/src/views/dataBoard/dataBoard.vue @@ -55,10 +55,12 @@ 实时播报: -
@@ -301,7 +303,8 @@
});
_this.swiperList = res.data.fileList || [];
if (_this.swiperInstance) {
- _this.swiperInstance.destroy();
+ _this.swiperInstance.destroy(true, true);
+ _this.swiperInstance = null;
}
if (_this.swiperTimer) {
clearTimeout(_this.swiperTimer);
@@ -352,7 +355,7 @@
},
// 初始化 Swiper
initSwiper() {
- if (!this.swiperList || this.swiperList.length === 0) return;
+ if (this.swiperList.length === 0) return;
this.swiperInstance = new Swiper('.swiper-container', {
loop: true,
grabCursor: true,
@@ -382,7 +385,7 @@
const currentIndex = realIndex === 0 ? 0 : realIndex > this.swiperList.length ? 0 : realIndex - 1;
// 获取当前幻灯片数据
const currentItem = this.swiperList[currentIndex];
- if (this.swiperList[currentIndex !== 0 ? currentIndex - 1 : this.swiperList.length - 1].type === 'video') {
+ 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]) {
refD[0].currentTime = 0;
@@ -394,7 +397,7 @@
refD1[0].pause();
}
}
-
+ console.log('currentItem', JSON.stringify(currentItem));
if (currentItem.type === '1') {
// 图片:按设定时长自动切换
this.swiperTimer = setTimeout(() => {
@@ -415,8 +418,9 @@
if (currentItem.type === '2') {
const refD = this.$refs[`videRef${currentIndex}`]
if (refD && refD.length > 0) {
- refD[0].muted = true;
- refD[0].play().catch(() => {
+ refD[0].muted = false;
+ refD[0].play().catch((e) => {
+ console.error(e)
refD[0].muted = true;
refD[0].play();
})
@@ -875,4 +879,39 @@
::-webkit-scrollbar-corner {
background: #f1f1f1;
}
+
+ .scroll-container {
+ flex: 1;
+ overflow: hidden;
+ white-space: nowrap;
+ }
+
+ .scroll-content {
+ display: inline-block;
+
+ div {
+ display: flex;
+ align-items: center;
+ margin-right: 20px;
+
+ }
+ }
+
+ .animal-css {
+ animation: scroll 20s linear infinite;
+ }
+
+ @keyframes scroll {
+ 0% {
+ transform: translateX(0);
+ }
+ 100% {
+ transform: translateX(-50%); /* 移动一半距离,因为复制了一份 */
+ }
+ }
+
+ /* 鼠标悬停暂停 */
+ .scroll-container:hover .scroll-content {
+ animation-play-state: paused;
+ }
\ No newline at end of file
diff --git a/src/views/led/led.vue b/src/views/led/led.vue
index 11ce20f..4b4dd26 100644
--- a/src/views/led/led.vue
+++ b/src/views/led/led.vue
@@ -235,13 +235,16 @@ export default {
.then((res) => {
if (res.code === '00000') {
let data = JSON.parse(JSON.stringify(_this.deviceDataList));
- for (let i = 0; i < data; i++) {
+ let count = -1;
+ for (let i = 0; i < data.length; i++) {
if (data[i].deviceId === deviceIdInfo.deviceId) {
- data[i].data = res.data;
+ count = i;
break;
}
}
- _this.deviceDataList = data;
+ if (count !== -1) {
+ _this.deviceDataList.splice(count, 1, {deviceId: deviceIdInfo.deviceId, data: res.data});
+ }
}
})
.catch((err) => {