|
@@ -1,40 +1,53 @@
|
|
|
<template>
|
|
|
<div ref="pictureArea" class="picture-area" :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="'list' === data.property.view_method">
|
|
|
- <el-carousel
|
|
|
- ref="pictureCarousel"
|
|
|
- class="view-list"
|
|
|
- indicator-position="none"
|
|
|
- :autoplay="false"
|
|
|
- :style="{ height: elementHeight - 144 - 17 + 'px' }"
|
|
|
- >
|
|
|
- <el-carousel-item v-for="(file, i) in data.file_list" :key="i">
|
|
|
+ <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 - 17 + '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="i" @click="handleIndicatorClick(i)">
|
|
|
<el-image :id="file.file_id" :src="file.file_url" fit="contain" />
|
|
|
- </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>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </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 class="title-div" v-if="curPictureMemoIndex === i">{{ file.title ?? file.title }}</div>
|
|
|
+ <div class="memo-div" v-if="curPictureMemoIndex === i">{{ file.intro ?? file.intro }}</div>
|
|
|
</div>
|
|
|
- </template>
|
|
|
- <ul v-else class="view-independent">
|
|
|
- <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>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -58,6 +71,7 @@ export default {
|
|
|
fileLen: 0,
|
|
|
elementID: '',
|
|
|
pictureObserversMap: {},
|
|
|
+ curPictureMemoIndex: 0,
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -70,12 +84,13 @@ export default {
|
|
|
// this.elementHeight = ele.clientHeight;
|
|
|
|
|
|
const sn_position = this.data.property.sn_position;
|
|
|
+ const viewMemo = this.isEnable(this.data.property.view_memo);
|
|
|
// 序号在左和右补齐序号高度,去掉padding(8*2)
|
|
|
if (sn_position.includes('left') || sn_position.includes('right')) {
|
|
|
- this.elementWidth = ele.clientWidth - 16;
|
|
|
+ this.elementWidth = viewMemo ? (ele.clientWidth - 16) * 0.8 : ele.clientWidth - 16;
|
|
|
this.elementHeight = ele.clientHeight + 30;
|
|
|
} else {
|
|
|
- this.elementWidth = ele.clientWidth;
|
|
|
+ this.elementWidth = viewMemo ? ele.clientWidth * 0.8 : ele.clientWidth;
|
|
|
this.elementHeight = ele.clientHeight;
|
|
|
}
|
|
|
|
|
@@ -110,12 +125,13 @@ export default {
|
|
|
for (let entry of entries) {
|
|
|
window.requestAnimationFrame(() => {
|
|
|
const sn_position = this.data.property.sn_position;
|
|
|
+ const viewMemo = this.isEnable(this.data.property.view_memo);
|
|
|
// 序号在上方和下方减去序号高度,在左右去掉padding(8*2)
|
|
|
if (sn_position.includes('top') || sn_position.includes('bottom')) {
|
|
|
- this.elementWidth = entry.contentRect.width;
|
|
|
+ this.elementWidth = viewMemo ? entry.contentRect.width * 0.8 : entry.contentRect.width;
|
|
|
this.elementHeight = entry.contentRect.height - 30;
|
|
|
} else {
|
|
|
- this.elementWidth = entry.contentRect.width - 16;
|
|
|
+ this.elementWidth = viewMemo ? (entry.contentRect.width - 16) * 0.8 : entry.contentRect.width - 16;
|
|
|
this.elementHeight = entry.contentRect.height;
|
|
|
}
|
|
|
});
|
|
@@ -151,6 +167,10 @@ export default {
|
|
|
const carousel = this.$refs.pictureCarousel;
|
|
|
// 切换到对应索引的图片
|
|
|
carousel.setActiveItem(index);
|
|
|
+ this.curPictureMemoIndex = index;
|
|
|
+ },
|
|
|
+ handleChange(index) {
|
|
|
+ this.curPictureMemoIndex = index;
|
|
|
},
|
|
|
// 滚动图片列表
|
|
|
scroll(direction) {
|
|
@@ -167,6 +187,7 @@ export default {
|
|
|
.picture-area {
|
|
|
display: grid;
|
|
|
gap: 6px;
|
|
|
+ float: left;
|
|
|
padding: 8px;
|
|
|
|
|
|
> .main {
|
|
@@ -183,7 +204,22 @@ export default {
|
|
|
width: 100%;
|
|
|
|
|
|
.view-area {
|
|
|
- width: 100%;
|
|
|
+ .memo-area {
|
|
|
+ float: left;
|
|
|
+ width: 15%;
|
|
|
+ padding-left: 5px;
|
|
|
+ border-left: 1px solid #eee;
|
|
|
+
|
|
|
+ .title-div {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 600;
|
|
|
+ }
|
|
|
+
|
|
|
+ .memo-div {
|
|
|
+ color: #706f78;
|
|
|
+ overflow-wrap: break-word;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
:deep .el-carousel {
|
|
|
margin-bottom: 17px;
|