|
@@ -1,70 +1,29 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div ref="videoArea" class="video-preview" :style="[getAreaStyle(), getComponentStyle()]">
|
|
<div ref="videoArea" class="video-preview" :style="[getAreaStyle(), getComponentStyle()]">
|
|
|
<SerialNumberPosition v-if="isEnable(data.property.sn_display_mode)" :property="data.property" />
|
|
<SerialNumberPosition v-if="isEnable(data.property.sn_display_mode)" :property="data.property" />
|
|
|
- <div ref="videoAreaBox" class="main">
|
|
|
|
|
- <template v-if="isMore">
|
|
|
|
|
- <ul v-if="'independent' === data.property.view_method" class="view-independent">
|
|
|
|
|
- <li v-for="(file, i) in data.file_list" :key="i">
|
|
|
|
|
- <VideoPlay
|
|
|
|
|
- view-size="small"
|
|
|
|
|
- view-method="independent"
|
|
|
|
|
- :file-id="file.file_id"
|
|
|
|
|
- :cur-video-index="curVideoIndex"
|
|
|
|
|
- @changeFile="changeFile"
|
|
|
|
|
- />
|
|
|
|
|
- </li>
|
|
|
|
|
- </ul>
|
|
|
|
|
- <div v-else class="view-list">
|
|
|
|
|
- <el-carousel
|
|
|
|
|
- ref="video_carousel"
|
|
|
|
|
- indicator-position="none"
|
|
|
|
|
- direction="vertical"
|
|
|
|
|
- :autoplay="false"
|
|
|
|
|
- :interval="0"
|
|
|
|
|
- :style="{ width: elementWidth - 248 - 32 + 'px', height: elementHeight <= 0 ? 139 : elementHeight + 'px' }"
|
|
|
|
|
- >
|
|
|
|
|
- <el-carousel-item v-for="(file, i) in data.file_list" :key="i">
|
|
|
|
|
- <VideoPlay
|
|
|
|
|
- view-size="big"
|
|
|
|
|
- :file-id="file.file_id"
|
|
|
|
|
- :cur-video-index="curVideoIndex"
|
|
|
|
|
- @changeFile="changeFile"
|
|
|
|
|
- />
|
|
|
|
|
- </el-carousel-item>
|
|
|
|
|
- </el-carousel>
|
|
|
|
|
- <div class="container-box" :style="{ height: elementHeight <= 0 ? 139 : elementHeight + 'px' }">
|
|
|
|
|
- <ul
|
|
|
|
|
- ref="container"
|
|
|
|
|
- class="view-list-bottom"
|
|
|
|
|
- :style="{ height: elementHeight + 'px', transform: `translateY(${translateY}px)` }"
|
|
|
|
|
- >
|
|
|
|
|
- <li v-for="(file, i) in data.file_list" :key="i" @click="handleAudioClick(i)">
|
|
|
|
|
- <VideoPlay
|
|
|
|
|
- view-size="small"
|
|
|
|
|
- :file-id="file.file_id"
|
|
|
|
|
- :audio-index="i"
|
|
|
|
|
- :cur-video-index="curVideoIndex"
|
|
|
|
|
- />
|
|
|
|
|
- </li>
|
|
|
|
|
- </ul>
|
|
|
|
|
- <button v-if="viewTopBottomBtn" class="arrow top" @click="scroll(1)">
|
|
|
|
|
- <i class="el-icon-arrow-up"></i>
|
|
|
|
|
- </button>
|
|
|
|
|
- <button v-if="viewTopBottomBtn" class="arrow bottom" @click="scroll(-1)">
|
|
|
|
|
- <i class="el-icon-arrow-down"></i>
|
|
|
|
|
- </button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </template>
|
|
|
|
|
- <template v-else>
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <div v-if="'independent' === data.property.view_method" ref="videoAreaBox" class="main">
|
|
|
|
|
+ <ul class="view-independent">
|
|
|
|
|
+ <li v-for="(file, i) in data.file_list" :key="i" :style="getVideoItemStyle()">
|
|
|
|
|
+ <VideoPlay
|
|
|
|
|
+ view-size="small"
|
|
|
|
|
+ view-method="independent"
|
|
|
|
|
+ :file-id="file.file_id"
|
|
|
|
|
+ :cur-video-index="curVideoIndex"
|
|
|
|
|
+ @changeFile="changeFile"
|
|
|
|
|
+ />
|
|
|
|
|
+ </li>
|
|
|
|
|
+ </ul>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else ref="videoAreaBox">
|
|
|
|
|
+ <div class="view-list">
|
|
|
<el-carousel
|
|
<el-carousel
|
|
|
ref="video_carousel"
|
|
ref="video_carousel"
|
|
|
indicator-position="none"
|
|
indicator-position="none"
|
|
|
direction="vertical"
|
|
direction="vertical"
|
|
|
:autoplay="false"
|
|
:autoplay="false"
|
|
|
:interval="0"
|
|
:interval="0"
|
|
|
- class="alone-video-area"
|
|
|
|
|
- :style="{ height: elementHeight <= 0 ? 139 : elementHeight + 'px' }"
|
|
|
|
|
|
|
+ :style="{ width: elementWidth - 248 - 32 + 'px', height: elementHeight <= 0 ? 139 : elementHeight + 'px' }"
|
|
|
>
|
|
>
|
|
|
<el-carousel-item v-for="(file, i) in data.file_list" :key="i">
|
|
<el-carousel-item v-for="(file, i) in data.file_list" :key="i">
|
|
|
<VideoPlay
|
|
<VideoPlay
|
|
@@ -75,7 +34,24 @@
|
|
|
/>
|
|
/>
|
|
|
</el-carousel-item>
|
|
</el-carousel-item>
|
|
|
</el-carousel>
|
|
</el-carousel>
|
|
|
- </template>
|
|
|
|
|
|
|
+ <div class="container-box" :style="{ height: elementHeight <= 0 ? 139 : elementHeight + 'px' }">
|
|
|
|
|
+ <ul
|
|
|
|
|
+ ref="container"
|
|
|
|
|
+ class="view-list-bottom"
|
|
|
|
|
+ :style="{ height: elementHeight + 'px', transform: `translateY(${translateY}px)` }"
|
|
|
|
|
+ >
|
|
|
|
|
+ <li v-for="(file, i) in data.file_list" :key="i" @click="handleAudioClick(i)">
|
|
|
|
|
+ <VideoPlay view-size="small" :file-id="file.file_id" :audio-index="i" :cur-video-index="curVideoIndex" />
|
|
|
|
|
+ </li>
|
|
|
|
|
+ </ul>
|
|
|
|
|
+ <button v-if="viewTopBottomBtn" class="arrow top" @click="scroll(1)">
|
|
|
|
|
+ <i class="el-icon-arrow-up"></i>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ <button v-if="viewTopBottomBtn" class="arrow bottom" @click="scroll(-1)">
|
|
|
|
|
+ <i class="el-icon-arrow-down"></i>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -102,17 +78,15 @@ export default {
|
|
|
elementID: '',
|
|
elementID: '',
|
|
|
isResizing: false,
|
|
isResizing: false,
|
|
|
resizeObserver: null,
|
|
resizeObserver: null,
|
|
|
- isMore: false,
|
|
|
|
|
|
|
+ isFirstLoad: true,
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
data: {
|
|
data: {
|
|
|
handler(val) {
|
|
handler(val) {
|
|
|
this.fileLen = val.file_list.length;
|
|
this.fileLen = val.file_list.length;
|
|
|
- if (this.fileLen > 1) {
|
|
|
|
|
- this.isMore = true;
|
|
|
|
|
- }
|
|
|
|
|
- if ((this.fileLen > 0 && this.data.property.view_method === 'list') || this.fileLen === 1) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (this.fileLen > 0 && this.data.property.view_method === 'list') {
|
|
|
const ele = this.$refs.videoAreaBox;
|
|
const ele = this.$refs.videoAreaBox;
|
|
|
const sn_position = this.data.property.sn_position;
|
|
const sn_position = this.data.property.sn_position;
|
|
|
// 序号在左和右补齐序号高度,去掉padding(8*2)
|
|
// 序号在左和右补齐序号高度,去掉padding(8*2)
|
|
@@ -138,6 +112,22 @@ export default {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (this.fileLen > 0 && this.data.property.view_method === 'independent') {
|
|
|
|
|
+ const ele = this.$refs.videoAreaBox;
|
|
|
|
|
+ const sn_position = this.data.property.sn_position;
|
|
|
|
|
+ if (sn_position.includes('left') || sn_position.includes('right')) {
|
|
|
|
|
+ this.elementWidth = ele.clientWidth - 16;
|
|
|
|
|
+ this.elementHeight = ele.clientHeight + 30;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.elementWidth = ele.clientWidth;
|
|
|
|
|
+ this.elementHeight = ele.clientHeight;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (ele.clientHeight <= 0) {
|
|
|
|
|
+ this.elementHeight = this.data.min_height;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
deep: true,
|
|
deep: true,
|
|
|
},
|
|
},
|
|
@@ -164,38 +154,41 @@ export default {
|
|
|
this.elementHeight = this.data.min_height;
|
|
this.elementHeight = this.data.min_height;
|
|
|
}
|
|
}
|
|
|
this.fileLen = this.data.file_list.length;
|
|
this.fileLen = this.data.file_list.length;
|
|
|
- if (this.fileLen > 1) {
|
|
|
|
|
- this.isMore = true;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
this.isViewTopBottomBtn();
|
|
this.isViewTopBottomBtn();
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
|
- if (!this.getDragStatus()) return;
|
|
|
|
|
|
|
+ if (!this.getDragStatus() && !this.isFirstLoad) return;
|
|
|
this.isResizing = true; // 标记为调整中
|
|
this.isResizing = true; // 标记为调整中
|
|
|
- for (let entry of entries) {
|
|
|
|
|
- window.requestAnimationFrame(() => {
|
|
|
|
|
- const sn_position = this.data.property.sn_position;
|
|
|
|
|
- // 序号在上方和下方减去序号高度
|
|
|
|
|
- let w = entry.contentRect.width - 16;
|
|
|
|
|
- let h = entry.contentRect.height;
|
|
|
|
|
- if (sn_position.includes('top') || sn_position.includes('bottom')) {
|
|
|
|
|
- w = entry.contentRect.width;
|
|
|
|
|
- h = entry.contentRect.height - 30;
|
|
|
|
|
- }
|
|
|
|
|
- if (this.elementWidth === w) {
|
|
|
|
|
- this.elementHeight = h;
|
|
|
|
|
- } else {
|
|
|
|
|
- this.elementWidth = w;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const delay = this.isFirstLoad ? 1000 : 0;
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ for (let entry of entries) {
|
|
|
|
|
+ window.requestAnimationFrame(() => {
|
|
|
|
|
+ const sn_position = this.data.property.sn_position;
|
|
|
|
|
+ // 序号在上方和下方减去序号高度
|
|
|
|
|
+ let w = entry.contentRect.width - 16;
|
|
|
|
|
+ let h = entry.contentRect.height;
|
|
|
|
|
+ if (sn_position.includes('top') || sn_position.includes('bottom')) {
|
|
|
|
|
+ w = entry.contentRect.width;
|
|
|
|
|
+ h = entry.contentRect.height - 30;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.elementWidth === w) {
|
|
|
|
|
+ this.elementHeight = h;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.elementWidth = w;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }, delay);
|
|
|
|
|
+ this.isFirstLoad = false;
|
|
|
// 防抖:100ms 后恢复监听
|
|
// 防抖:100ms 后恢复监听
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
this.isResizing = false;
|
|
this.isResizing = false;
|
|
|
}, 500);
|
|
}, 500);
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
this.resizeObserver.observe(this.$el);
|
|
this.resizeObserver.observe(this.$el);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
@@ -205,6 +198,18 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ getVideoItemStyle() {
|
|
|
|
|
+ if (this.data.property.view_method !== 'independent') {
|
|
|
|
|
+ return {};
|
|
|
|
|
+ }
|
|
|
|
|
+ const height = this.elementHeight > 0 ? this.elementHeight : Number(this.data.min_height);
|
|
|
|
|
+ const width = (height * 16) / 9;
|
|
|
|
|
+ return {
|
|
|
|
|
+ width: `${width}px`,
|
|
|
|
|
+ height: `${height}px`,
|
|
|
|
|
+ flexShrink: 0,
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
handleAudioClick(index) {
|
|
handleAudioClick(index) {
|
|
|
// 获取 Carousel 实例
|
|
// 获取 Carousel 实例
|
|
|
const carousel = this.$refs.video_carousel;
|
|
const carousel = this.$refs.video_carousel;
|
|
@@ -288,13 +293,61 @@ export default {
|
|
|
|
|
|
|
|
.view-independent {
|
|
.view-independent {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
- flex-wrap: wrap;
|
|
|
|
|
gap: 20px;
|
|
gap: 20px;
|
|
|
- width: 100%;
|
|
|
|
|
|
|
+ width: fit-content;
|
|
|
|
|
+ padding: 0;
|
|
|
|
|
+ margin: 0;
|
|
|
|
|
|
|
|
> li {
|
|
> li {
|
|
|
- width: 248px;
|
|
|
|
|
- height: 139px;
|
|
|
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
|
+ list-style: none;
|
|
|
|
|
+
|
|
|
|
|
+ :deep(.video-play) {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .main {
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ overflow: auto hidden !important;
|
|
|
|
|
+
|
|
|
|
|
+ // Firefox 滚动条样式
|
|
|
|
|
+ scrollbar-width: none; // 默认隐藏
|
|
|
|
|
+
|
|
|
|
|
+ // 自定义滚动条样式 - 完全浮动
|
|
|
|
|
+ &::-webkit-scrollbar {
|
|
|
|
|
+ width: 0; // 默认宽度为 0
|
|
|
|
|
+ height: 0;
|
|
|
|
|
+ transition:
|
|
|
|
|
+ width 0.3s ease,
|
|
|
|
|
+ height 0.3s ease;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 鼠标悬停时显示滚动条
|
|
|
|
|
+ &:hover::-webkit-scrollbar {
|
|
|
|
|
+ width: 8px;
|
|
|
|
|
+ height: 8px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &::-webkit-scrollbar-thumb {
|
|
|
|
|
+ background-color: rgba(0, 0, 0, 50%);
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+ transition: background-color 0.3s ease;
|
|
|
|
|
+
|
|
|
|
|
+ &:hover {
|
|
|
|
|
+ background-color: rgba(0, 0, 0, 70%);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &::-webkit-scrollbar-track {
|
|
|
|
|
+ background-color: transparent;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &:hover {
|
|
|
|
|
+ scrollbar-width: thin; // 鼠标悬停时显示
|
|
|
|
|
+ scrollbar-color: rgba(0, 0, 0, 50%) transparent;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|