|
|
@@ -1,62 +1,57 @@
|
|
|
<template>
|
|
|
<div ref="pictureArea" class="picture-preview" :style="getAreaStyle()">
|
|
|
<SerialNumberPosition v-if="isEnable(data.property.sn_display_mode)" :property="data.property" />
|
|
|
+
|
|
|
<div ref="pictureAreaBox" class="main">
|
|
|
<div class="view-area">
|
|
|
- <template v-if="isMore">
|
|
|
- <div class="picture-area">
|
|
|
- <!-- 播放列表 -->
|
|
|
- <template v-if="'list' === data.property.view_method">
|
|
|
- <el-carousel
|
|
|
- ref="pictureCarousel"
|
|
|
- class="view-list"
|
|
|
- indicator-position="none"
|
|
|
- :autoplay="false"
|
|
|
- :style="{ height: elementHeight - 144 - 32 + 'px' }"
|
|
|
- @change="handleChange"
|
|
|
- >
|
|
|
- <el-carousel-item v-for="(file, i) in data.file_list" :key="i">
|
|
|
- <el-image
|
|
|
- :id="file.file_id"
|
|
|
- :src="file.file_url"
|
|
|
- fit="contain"
|
|
|
- :preview-src-list="data.file_list.map((x) => x.file_url)"
|
|
|
- />
|
|
|
- </el-carousel-item>
|
|
|
- </el-carousel>
|
|
|
- <div class="container-box">
|
|
|
- <button v-if="viewLeftRightBtn" class="arrow left" @click="scroll(-1)">
|
|
|
- <i class="el-icon-arrow-left"></i>
|
|
|
- </button>
|
|
|
- <ul ref="container" class="view-list-bottom" :style="{ width: elementWidth + 'px' }">
|
|
|
- <li v-for="(file, i) in data.file_list" :key="i" @click="handleIndicatorClick(i)">
|
|
|
- <el-image :id="file.file_id" :src="file.file_url" fit="contain" />
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- <button v-if="viewLeftRightBtn" class="arrow right" @click="scroll(1)">
|
|
|
- <i class="el-icon-arrow-right"></i>
|
|
|
- </button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <ul v-else class="view-independent">
|
|
|
- <li v-for="(file, i) in data.file_list" :key="file.file_id" @click="handleIndicatorClick(i)">
|
|
|
+ <!-- 播放列表 -->
|
|
|
+ <div v-if="'list' === data.property.view_method">
|
|
|
+ <el-carousel
|
|
|
+ ref="pictureCarousel"
|
|
|
+ indicator-position="none"
|
|
|
+ :autoplay="false"
|
|
|
+ :style="{ height: elementHeight - 144 - 32 + 'px' }"
|
|
|
+ @change="handleChange"
|
|
|
+ >
|
|
|
+ <el-carousel-item v-for="(file, i) in data.file_list" :key="i">
|
|
|
+ <el-image
|
|
|
+ :id="file.file_id"
|
|
|
+ :src="file.file_url"
|
|
|
+ fit="contain"
|
|
|
+ :preview-src-list="data.file_list.map((x) => x.file_url)"
|
|
|
+ />
|
|
|
+ </el-carousel-item>
|
|
|
+ </el-carousel>
|
|
|
+ <div class="container-box">
|
|
|
+ <button v-if="viewLeftRightBtn" class="arrow left" @click="scroll(-1)">
|
|
|
+ <i class="el-icon-arrow-left"></i>
|
|
|
+ </button>
|
|
|
+ <ul ref="container" class="view-list-bottom" :style="{ width: elementWidth + 'px' }">
|
|
|
+ <li v-for="(file, i) in data.file_list" :key="i" @click="handleIndicatorClick(i)">
|
|
|
<el-image :id="file.file_id" :src="file.file_url" fit="contain" />
|
|
|
</li>
|
|
|
</ul>
|
|
|
+ <button v-if="viewLeftRightBtn" class="arrow right" @click="scroll(1)">
|
|
|
+ <i class="el-icon-arrow-right"></i>
|
|
|
+ </button>
|
|
|
</div>
|
|
|
- </template>
|
|
|
- <!-- 独立排放 -->
|
|
|
- <template v-else-if="data.property.view_method === 'independent'">
|
|
|
- <div v-for="file in data.file_list" :key="file.file_id" class="alone-pic-area">
|
|
|
- <el-image
|
|
|
- :id="file.file_id"
|
|
|
- :src="file.file_url"
|
|
|
- fit="contain"
|
|
|
- :preview-src-list="data.file_list.map((x) => x.file_url)"
|
|
|
- :style="{ height: elementHeight + 'px' }"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </template>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ v-else
|
|
|
+ v-for="file in data.file_list"
|
|
|
+ :key="file.file_id"
|
|
|
+ class="alone-pic-area"
|
|
|
+ :style="getVideoItemStyle()"
|
|
|
+ >
|
|
|
+ <el-image
|
|
|
+ :id="file.file_id"
|
|
|
+ :src="file.file_url"
|
|
|
+ fit="contain"
|
|
|
+ :preview-src-list="data.file_list.map((x) => x.file_url)"
|
|
|
+ :style="{ height: elementHeight + 'px' }"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
<div v-if="'list' === data.property.view_method && isEnable(data.property.view_memo)" class="memo-area">
|
|
|
<div v-for="(file, i) in data.file_info_list" :key="i">
|
|
|
<div v-if="curPictureMemoIndex === i" class="title-div">{{ file.title ?? file.title }}</div>
|
|
|
@@ -88,17 +83,14 @@ export default {
|
|
|
curPictureMemoIndex: 0,
|
|
|
isResizing: false,
|
|
|
resizeObserver: null,
|
|
|
- isMore: false,
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
data: {
|
|
|
handler(val) {
|
|
|
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) return;
|
|
|
+ if (this.data.property.view_method === 'list') {
|
|
|
const ele = this.$refs.pictureAreaBox;
|
|
|
const sn_position = this.data.property.sn_position;
|
|
|
const viewMemo = this.isEnable(this.data.property.view_memo);
|
|
|
@@ -111,9 +103,9 @@ export default {
|
|
|
this.elementHeight = ele.clientHeight;
|
|
|
}
|
|
|
// 统一图片播放模式位置调整和预览初始高度
|
|
|
- if (ele.clientHeight <= 0) {
|
|
|
- this.elementHeight = this.data.min_height - 60;
|
|
|
- }
|
|
|
+ // if (ele.clientHeight <= 0) {
|
|
|
+ // this.elementHeight = this.data.min_height - 60;
|
|
|
+ // }
|
|
|
|
|
|
const mainEle = this.$refs.pictureArea;
|
|
|
// 检查元素是否包含已知的类名
|
|
|
@@ -125,12 +117,35 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ if (this.data.property.view_method === 'independent') {
|
|
|
+ const ele = this.$refs.pictureAreaBox;
|
|
|
+ const sn_position = this.data.property.sn_position;
|
|
|
+ // 序号在左和右补齐序号高度,去掉padding(8*2)
|
|
|
+ if (sn_position.includes('left') || sn_position.includes('right')) {
|
|
|
+ this.elementWidth = ele.clientWidth - 16;
|
|
|
+ this.elementHeight = ele.clientHeight;
|
|
|
+ } else {
|
|
|
+ this.elementWidth = ele.clientWidth;
|
|
|
+ this.elementHeight = ele.clientHeight;
|
|
|
+ }
|
|
|
+ // 统一图片播放模式位置调整和预览初始高度
|
|
|
+ // if (ele.clientHeight <= 0) {
|
|
|
+ // this.elementHeight = this.data.min_height - 60;
|
|
|
+ // }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.elementHeight = Math.max(this.elementHeight, this.data.min_height);
|
|
|
+ this.$emit('handleHeightChange', this.id, this.elementHeight + 'px');
|
|
|
},
|
|
|
deep: true,
|
|
|
},
|
|
|
elementWidth() {
|
|
|
this.isViewLeftRightBtn();
|
|
|
},
|
|
|
+ fileLen() {
|
|
|
+ this.isViewLeftRightBtn();
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
this.$nextTick(() => {
|
|
|
@@ -146,16 +161,12 @@ export default {
|
|
|
this.elementWidth = viewMemo ? ele.clientWidth * 0.8 : ele.clientWidth;
|
|
|
this.elementHeight = ele.clientHeight;
|
|
|
}
|
|
|
-
|
|
|
this.fileLen = this.data.file_list.length;
|
|
|
- if (this.fileLen > 1) {
|
|
|
- this.isMore = true;
|
|
|
- }
|
|
|
- this.isViewLeftRightBtn();
|
|
|
|
|
|
this.resizeObserver = new ResizeObserver((entries) => {
|
|
|
if (!this.getDragStatus()) return;
|
|
|
this.isResizing = true; // 标记为调整中
|
|
|
+
|
|
|
for (let entry of entries) {
|
|
|
window.requestAnimationFrame(() => {
|
|
|
const sn_position = this.data.property.sn_position;
|
|
|
@@ -172,8 +183,10 @@ export default {
|
|
|
} else {
|
|
|
this.elementWidth = w;
|
|
|
}
|
|
|
+ this.elementHeight = Math.max(this.elementHeight, this.data.min_height);
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
// 防抖:100ms 后恢复监听
|
|
|
setTimeout(() => {
|
|
|
this.isResizing = false;
|
|
|
@@ -188,6 +201,18 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
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,
|
|
|
+ };
|
|
|
+ },
|
|
|
// 是否显示左右箭头
|
|
|
isViewLeftRightBtn() {
|
|
|
// 计算底部列表图片宽度
|
|
|
@@ -240,6 +265,48 @@ export default {
|
|
|
.picture-preview {
|
|
|
@include preview-base;
|
|
|
|
|
|
+ .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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.view-area {
|
|
|
display: flex;
|
|
|
column-gap: 7px;
|