图片展示优化

master
fanluyan 2 years ago
parent 24eae02e78
commit b5cbbbf694

@ -1,13 +1,20 @@
<template> <template>
<div class="thumb-example"> <div class="thumb-example">
<div class="picTop"> <div class="picTop">
<viewer class="bigimg"> <viewer
<img :src="bigPicPath + '!1280x720'" /> class="bigimg"
<p class="mark"> :style="{ backgroundImage: 'url(' + bigPicPath + '!180x160)' }"
v-if="bigPicPath.indexOf('nopic') == -1"
>
<img class="animImg" :src="bigPicPath + '!1280x720'" />
<!-- <p class="mark">
{{ bigPicPath }} {{ bigPicPath }}
<span>{{ this.activeSmall }}</span> <span>{{ this.activeSmall }}</span>
</p> </p> -->
</viewer> </viewer>
<div class="bigimg" v-else>
<img class="animImg" :src="bigPicPath" />
</div>
<div class="arrow leftArrow" v-if="this.bigNum != 0" @click="leftClick"> <div class="arrow leftArrow" v-if="this.bigNum != 0" @click="leftClick">
<i class="el-icon-arrow-left"></i> <i class="el-icon-arrow-left"></i>
</div> </div>
@ -26,9 +33,9 @@
@click="handleBigpic(item, index)" @click="handleBigpic(item, index)"
:class="activeSmall === index ? 'borderActive' : ''" :class="activeSmall === index ? 'borderActive' : ''"
> >
<!-- <img src="../../assets/img/nopic.jpg" /> --> <div class="smallhavePic" v-if="item.path.indexOf('nopic') == -1">
<img :src="item.path + '!260x160'" /> <img :src="item.path + '!260x160'" />
<p class="timeInfo" v-if="item.path.indexOf('nopic') == -1"> <p class="timeInfo">
<el-tooltip <el-tooltip
class="item" class="item"
effect="dark" effect="dark"
@ -50,6 +57,10 @@
) )
<span>--通道{{ item.channelId }}</span> <span>--通道{{ item.channelId }}</span>
</p> </p>
</div>
<div class="smallnoPic" v-else>
<img :src="item.path" />
</div>
</li> </li>
</ul> </ul>
<div <div
@ -125,7 +136,6 @@ export default {
this.bigPicPath = this.terminalPhoto[this.bigNum].path; this.bigPicPath = this.terminalPhoto[this.bigNum].path;
this.activeSmall++; this.activeSmall++;
console.log("activeSmall", this.activeSmall, "bigNum", this.bigNum); console.log("activeSmall", this.activeSmall, "bigNum", this.bigNum);
if (this.activeSmall > 4) { if (this.activeSmall > 4) {
this.activeSmall = 0; this.activeSmall = 0;
console.log(this.activeSmall); console.log(this.activeSmall);
@ -141,6 +151,7 @@ export default {
}, },
// //
smallLeftClick() { smallLeftClick() {
this.activeSmall = 0;
console.log("点击了左侧"); console.log("点击了左侧");
this.page--; this.page--;
@ -154,6 +165,7 @@ export default {
}, },
// //
smallRightClick() { smallRightClick() {
this.activeSmall = 0;
console.log("点击了右侧"); console.log("点击了右侧");
console.log(this.page); console.log(this.page);
this.page++; this.page++;
@ -189,23 +201,17 @@ export default {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: relative; position: relative;
background-size: 100% 100%;
.mark { .mark {
position: absolute; position: absolute;
bottom: 16px; bottom: 12px;
color: #fff; color: #fff;
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
left: 16px; left: 16px;
font-size: 14px; font-size: 14px;
line-height: 24px; line-height: 24px;
animation: move 1s; //opacity: 0;
} transition: bottom 2s ease 0s;
@keyframes move {
0% {
bottom: -10px;
}
100% {
transform: 16px;
}
} }
} }
img { img {
@ -250,10 +256,11 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
justify-content: center;
li { li {
width: 20%; width: 20%;
border: 3px solid transparent; border: 3px solid transparent;
overflow: hidden; // overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
align-items: center; align-items: center;
@ -265,9 +272,29 @@ export default {
object-fit: fill; object-fit: fill;
cursor: pointer; cursor: pointer;
} }
.smallhavePic {
width: 100%;
height: 100%;
}
.smallnoPic {
width: 100%;
height: 100%;
}
} }
.borderActive { .borderActive {
border: 3px solid #409eff; border: 3px solid #409eff;
&::after {
content: "";
position: absolute;
width: 0;
height: 0;
left: 50%;
top: -16px;
margin-left: -8px;
border-bottom: 13px solid #409eff;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
}
} }
.timeInfo { .timeInfo {
position: absolute; position: absolute;

Loading…
Cancel
Save