图片优化

master
fanluyan 2 years ago
parent 3836bbce6a
commit 1dc252e474

@ -6,25 +6,8 @@
:options="swiperOptionTop"
ref="swiperTop"
>
<swiper-slide
class="slide-1"
v-for="(item, index) in terminalPhoto"
:key="item.id"
>
<viewer class="bigimg" v-if="item.path.indexOf('nopic') == -1">
<!-- <img :src="item.path + '!1280x720'" alt="" /> -->
<img v-if="index == 0" :src="item.path + '!1280x720'" />
<img
v-else
src="../../assets/img/loading.jpg"
:data-src="item.path + '!1280x720'"
class="swiper-lazy"
/>
</viewer>
<div class="bigimg" v-else>
<img :src="item.path" alt="" />
</div>
</swiper-slide>
<!-- -->
<div
class="swiper-button-next swiper-button-white"
slot="button-next"
@ -112,46 +95,40 @@ export default {
data() {
return {
swiperOptionTop: {
spaceBetween: 10,
//loop: true,
freeMode: true,
// loopedSlides: 1,
lazy: {
loadPrevNext: true,
loadPrevNextAmount: 1,
loadOnTransitionStart: true,
},
// lazyLoading: true, //
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
observer: true, //swiperswiper
observeParents: true, //swiperswiper
onSlideChangeEnd: function (swiper) {
swiper.update();
virtual: {
slides: [],
renderSlide: function (slide, index) {
console.log(index);
if (slide.path.indexOf("nopic") != -1) {
return ` <div class="swiper-slide" ><div class="bigimg"><img src="static/img/nopic.0e9cfc7c.jpg" alt="" /></div></div>`;
} else {
return `<div class="swiper-slide"><div class="bigimg"><img src=" ${
slide.path + "!1280x720"
} " /></div></div>`;
}
},
},
},
swiperOptionThumbs: {
spaceBetween: 10,
centeredSlides: true,
slidesPerView: "auto",
touchRatio: 0.2,
lazyLoading: true, //
slideToClickedSlide: true,
lazy: {
loadPrevNext: true,
loadPrevNextAmount: 5,
loadOnTransitionStart: true,
//loadOnTransitionStart: true,
},
observer: true, //swiperswiper
observeParents: true, //swiperswiper
onSlideChangeEnd: function (swiper) {
swiper.update();
},
//loop: true,
//loopedSlides: 4,
},
};
},
@ -163,8 +140,16 @@ export default {
swiperThumbs.controller.control = swiperTop;
});
},
methods: {},
watch: {
terminalPhoto: function (newVal, oldVal) {
this.swiperOptionTop.virtual.slides = newVal;
},
},
created() {
console.log(this.swiperOptionTop.virtual.slides);
this.swiperOptionTop.virtual.slides = this.terminalPhoto;
},
};
</script>
<style lang="less">
@ -181,7 +166,7 @@ export default {
overflow: hidden;
margin-bottom: 4px;
//border: 3px solid transparent;
.slide-1 {
.swiper-slide {
width: 100%;
overflow: hidden;
.bigimg {

@ -0,0 +1,272 @@
<template>
<div class="thumb-example">
<!-- swiper1 -->
<swiper
class="swiper gallery-top"
:options="swiperOptionTop"
ref="swiperTop"
>
<swiper-slide
class="slide-1"
v-for="(item, index) in terminalPhoto"
:key="item.id"
>
<viewer class="bigimg" v-if="item.path.indexOf('nopic') == -1">
<!-- <img :src="item.path + '!1280x720'" alt="" /> -->
<img v-if="index == 0" :src="item.path + '!1280x720'" />
<img
v-else
src="../../assets/img/loading.jpg"
:data-src="item.path + '!1280x720'"
class="swiper-lazy"
/>
</viewer>
<div class="bigimg" v-else>
<img :src="item.path" alt="" />
</div>
</swiper-slide>
<div
class="swiper-button-next swiper-button-white"
slot="button-next"
></div>
<div
class="swiper-button-prev swiper-button-white"
slot="button-prev"
></div>
</swiper>
<!-- swiper2 Thumbs -->
<swiper
class="swiper gallery-thumbs"
:options="swiperOptionThumbs"
ref="swiperThumbs"
>
<swiper-slide
class="slide"
v-for="(item, index) in terminalPhoto"
:key="item.id"
>
<div class="bigimg" v-if="item.path.indexOf('nopic') == -1">
<img v-if="index == 0" :src="item.path + '!260x160'" />
<img
v-else
src="../../assets/img/loading.jpg"
:data-src="item.path + '!260x160'"
class="swiper-lazy"
/>
</div>
<div class="bigimg" v-else>
<img :src="item.path" alt="" />
</div>
<!-- <img v-if="index == 0" :src="item.path + '!1280x720'" />
<img
src="item.path + '!260x160'"
alt=""
:data-src="item.path + '!260x160'"
class="swiper-lazy"
v-else-if="item.path.indexOf('nopic') == -1"
/>
<img :src="item.path" alt="" v-else /> -->
<p class="timeInfo" v-if="item.path.indexOf('nopic') == -1">
<el-tooltip
class="item"
effect="dark"
content="拍照时间"
placement="top-start"
>
<span>{{ $moment(item.photoTime).format("HH:mm:ss") }}</span>
</el-tooltip>
(
<el-tooltip
class="item"
effect="dark"
content="图片上传时间"
placement="top-start"
>
<span> {{ $moment(item.recvTime).format("HH:mm:ss") }}</span>
</el-tooltip>
)
<span>--通道{{ item.channelId }}</span>
</p>
</swiper-slide>
</swiper>
</div>
</template>
<script>
import { Swiper, SwiperSlide } from "vue-awesome-swiper";
import "swiper/css/swiper.css";
export default {
components: {
Swiper,
SwiperSlide,
},
props: {
terminalPhoto: {
type: Array,
default: () => [],
},
},
data() {
return {
swiperOptionTop: {
spaceBetween: 10,
//loop: true,
freeMode: true,
// loopedSlides: 1,
lazy: {
loadPrevNext: true,
loadPrevNextAmount: 1,
loadOnTransitionStart: true,
},
// lazyLoading: true, //
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
observer: true, //swiperswiper
observeParents: true, //swiperswiper
onSlideChangeEnd: function (swiper) {
swiper.update();
},
},
swiperOptionThumbs: {
spaceBetween: 10,
centeredSlides: true,
slidesPerView: "auto",
touchRatio: 0.2,
lazyLoading: true, //
slideToClickedSlide: true,
lazy: {
loadPrevNext: true,
loadPrevNextAmount: 5,
loadOnTransitionStart: true,
//loadOnTransitionStart: true,
},
observer: true, //swiperswiper
observeParents: true, //swiperswiper
onSlideChangeEnd: function (swiper) {
swiper.update();
},
//loop: true,
//loopedSlides: 4,
},
};
},
mounted() {
this.$nextTick(() => {
const swiperTop = this.$refs.swiperTop.$swiper;
const swiperThumbs = this.$refs.swiperThumbs.$swiper;
swiperTop.controller.control = swiperThumbs;
swiperThumbs.controller.control = swiperTop;
});
},
methods: {},
};
</script>
<style lang="less">
.thumb-example {
width: 100%;
display: flex;
flex-direction: column;
height: calc(100% - 26px);
box-sizing: border-box;
.gallery-top {
//background: #fcc;
width: 100%;
height: 80%;
overflow: hidden;
margin-bottom: 4px;
//border: 3px solid transparent;
.slide-1 {
width: 100%;
overflow: hidden;
.bigimg {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
img {
width: 100%;
height: 100%;
object-fit: fill;
}
}
.swiper-button-prev.swiper-button-disabled,
.swiper-button-next.swiper-button-disabled {
opacity: 0.35;
cursor: auto;
pointer-events: none;
display: none !important;
}
}
.gallery-thumbs {
width: 100%;
height: 18%;
.slide {
width: 20%;
border: 3px solid transparent;
overflow: hidden;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
.bigimg {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
img {
//width: 100%;
height: 100%;
object-fit: fill;
}
}
.timeInfo {
position: absolute;
bottom: 0px;
width: 100%;
background: #f0f0f0;
padding: 8px 0px;
font-size: 12px;
text-align: center;
color: #333;
}
}
.swiper-button-next.swiper-button-white,
.swiper-container-rtl .swiper-button-prev.swiper-button-white,
.swiper-button-prev.swiper-button-white,
.swiper-container-rtl .swiper-button-next.swiper-button-white {
width: 40px;
height: 40px;
border-radius: 30px;
position: absolute;
top: 50%;
transform: translateY(-50%);
background-color: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
font-size: 30px;
color: #fff;
text-align: center;
line-height: 60px;
}
.swiper-button-next:after,
.swiper-container-rtl .swiper-button-prev:after,
.swiper-button-prev:after,
.swiper-container-rtl .swiper-button-next:after {
transform: scale(0.5);
}
}
// https://v1.github.surmon.me/vue-awesome-swiper/
</style>

@ -116,7 +116,7 @@
width="680px"
append-to-body
>
<el-form
<!-- <el-form
label-position="left"
ref="formInfo"
label-width="100px"
@ -132,10 +132,10 @@
:default-expand-all="true"
></el-tree>
</el-form-item>
</el-form>
</el-form> -->
<div class="setTimeTd">
<h3>装置信息</h3>
<div class="tdSetBox">
<!--<h3>装置信息</h3>
<el-descriptions title="" :column="3" border>
<el-descriptions-item label="电压等级"
>220kV</el-descriptions-item
@ -146,26 +146,59 @@
<el-descriptions-item label="装置名称">
XYIGQ10C230300104</el-descriptions-item
>
</el-descriptions>
</el-descriptions> -->
<h3>时间表规则</h3>
<el-descriptions title="" :column="3" border>
<el-descriptions-item label="开始时间">
12:00:07</el-descriptions-item
>
<el-descriptions-item label="结束时间">
16:00:07</el-descriptions-item
<p class="timename">时间表名称{{ timeName }}</p>
<el-descriptions
title=""
:column="3"
border
v-for="(val, index) in scheduleInfo"
:key="index"
>
<el-descriptions-item label="开始时间">{{
val.startTime
}}</el-descriptions-item>
<el-descriptions-item label="结束时间">{{
val.endTime
}}</el-descriptions-item>
<el-descriptions-item label="时间间隔(分)">
<el-tag size="small">60</el-tag>
<el-tag size="small">{{ val.span }}</el-tag>
</el-descriptions-item>
</el-descriptions>
<h3>选择通道</h3>
<div class="checkBox">
<el-checkbox-group v-model="checkList">
<!-- <el-checkbox-group v-model="checkList">
<el-checkbox label="通道1" border></el-checkbox>
<el-checkbox label="通道2" border></el-checkbox>
</el-checkbox-group>
</el-checkbox-group> -->
<!-- <el-checkbox-group v-model="checkList" @change="handleChange">
<el-checkbox
:label="val.channelid"
border
v-for="val in accesslist"
:key="val.channelid"
>{{ val.channelname }}</el-checkbox
>
</el-checkbox-group> -->
<el-form
label-position="left"
ref="formInfo"
label-width="100px"
v-loading="loading"
>
<el-form-item label="通道:">
<el-tree
:data="listnr"
show-checkbox
:props="defaultProps"
ref="tree"
node-key="id"
:default-expand-all="true"
></el-tree>
</el-form-item>
</el-form>
</div>
</div>
</div>
@ -213,6 +246,10 @@ export default {
parmsList: [], //
scheduleid: 0, //id
checkList: [],
//-
timeName: "",
scheduleInfo: [],
};
},
mounted() {},
@ -226,6 +263,7 @@ export default {
getChannelListJoggle({ termid: id })
.then((res) => {
this.accesslist = res.data.list;
console.log(this.accesslist);
this.selaccess = res.data.list[0].channelid;
})
.catch((err) => {});
@ -255,6 +293,7 @@ export default {
.then((res) => {
this.deviceTableData = res.data.list;
this.total = res.data.total;
console.log(this.deviceTableData);
this.loading = false;
})
.catch((err) => {});
@ -269,9 +308,15 @@ export default {
this.loading = true;
this.scheduleid = val.id;
this.isShowset = true;
console.log(val);
this.scheduleInfo = val.list;
this.timeName = val.name;
getScheduleRulelAccessList({ termid: this.selfacilityId })
.then((res) => {
this.listnr = res.data.list;
console.log("1111111111111111111");
console.log(this.listnr);
this.loading = false;
})
.catch((err) => {});
@ -317,6 +362,12 @@ export default {
// console.log(this.parmsList);
return this.parmsList;
},
//
handleChange() {
//console.log(this.listnr);
console.log(this.checkList);
// this.$refs.tree.setCheckedKeys(this.checkedAisle);
},
//
submitForm() {
this.getCheckedNodes();
@ -421,6 +472,9 @@ export default {
font-size: 16px;
line-height: 24px;
}
.timename {
margin: 8px 0px;
}
}
}
}

@ -36,7 +36,8 @@
<div class="swiperBox" v-loading="loading">
<carouselChart
:terminalPhoto="terminalPhoto"
v-if="terminalPhoto"
v-if="terminalPhoto.length > 0"
ref="a"
></carouselChart>
<div class="totalPic" v-if="totalPic !== 0">
图片总数{{ totalPic }}
@ -146,6 +147,7 @@ export default {
},
data() {
return {
flag: true,
onlinestatus: "", //
showBigPic: true,
defaultKey: "",
@ -226,17 +228,11 @@ export default {
this.currentNodekey = this.lineTreeData[0].list[0].list[0].id; //
this.newTermId = this.lineTreeData[0].list[0].list[0].id;
console.log(this.currentNodekey);
console.log("ssssssssssssssssss");
console.log(this.newTermId);
console.log("ssssssssssssssssss");
this.cmdid = this.lineTreeData[0].list[0].list[0].cmdid;
console.log(this.cmdid);
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.currentNodekey); //
console.log(this.currentNodekey);
this.channelId = this.currentNodekey;
console.log(this.channelId);
this.getChannelList(this.channelId); //id
});
}
@ -255,10 +251,8 @@ export default {
this.channelId = data.id; //id
this.cmdid = data.cmdid;
this.newTermId = data.id; //id
console.log(data);
console.log("1111");
console.log(this.newTermId, this.channelId);
console.log("1111");
this.channelValue = [];
this.channelOption = [];
this.getChannelList(this.channelId); //id
@ -315,8 +309,11 @@ export default {
this.totalPic = 0;
} else {
this.terminalPhoto = res.data.list;
this.totalPic = res.data.num;
}
console.log(this.terminalPhoto.length);
this.totalPic = res.data.num;
//this.$refs.a.getphotodata(this.terminalPhoto);
this.loading = false;
console.log(this.terminalPhoto);
})
@ -340,6 +337,7 @@ export default {
this.$refs.setschedule_ref.display();
this.$refs.setschedule_ref.getSingleAccess(this.channelId);
this.$refs.setschedule_ref.deviceList();
console.log();
},
handleShowErr() {
this.$message({

@ -24,22 +24,13 @@ module.exports = defineConfig({
//表示拦截以/api开头的请求路径
//target: 'http://localhost:1234', //本地nodejs服务器
target: "http://47.96.238.157:8093", //公司项目服务器环境
//target: "http://180.166.218.222:40080", //dell
//target: 'http://180.166.218.222:7200',
changOrigin: true, //是否开启跨域
pathRewrite: {
"^/api": "", //重写api把api变成空字符因为我们真正请求的路径是没有api的
},
},
// [process.env.VUE_APP_BASE_API]: {
// //表示拦截以/api开头的请求路径
// //target: 'http://localhost:1234', //本地nodejs服务器
// target: "http://47.96.238.157:8093", //公司项目服务器环境
// //target: 'http://180.166.218.222:7200',
// changOrigin: true, //是否开启跨域
// pathRewrite: {
// ["^" + process.env.VUE_APP_BASE_API]: "", //重写api把api变成空字符因为我们真正请求的路径是没有api的
// },
// },
},
},
});

Loading…
Cancel
Save