You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

375 lines
9.3 KiB
Vue

2 years ago
<template>
2 years ago
<div class="picRotation">
<div class="picHead">
<div class="pageNation">
<el-pagination
@current-change="handleCurrentChange"
:current-page="page"
:page-size="pageSize"
layout=" prev, pager, next, jumper,total"
:total="total"
>
</el-pagination>
</div>
<div class="buttonGroup">
2 years ago
<span class="info">
<b> {{ isRuning ? remainingTime : "已暂停" }} </b>
</span>
2 years ago
<el-button type="primary" @click="toggleCountdown">{{
isRuning ? "暂停轮巡" : "开始轮巡"
}}</el-button>
2 years ago
<el-button type="primary" @click="setbtn"></el-button>
2 years ago
</div>
2 years ago
</div>
2 years ago
<div class="imageCenter" v-loading="loading">
2 years ago
<div class="imgList" v-for="(item, index) in picList" :key="index">
<viewer
2 years ago
:options="OptionssalseImg"
2 years ago
v-if="item.path !== null && item.path.indexOf('videos') == -1"
class="bigpic"
2 years ago
:style="
item.path ? 'backgroundImage:url(' + item.path + '!128x72)' : ''
"
>
2 years ago
<img :src="item.path + '!1280x720'" />
2 years ago
</viewer>
2 years ago
<div
class="bigpic"
v-else-if="item.path !== null && item.path.indexOf('videos') !== -1"
>
<video
width="100%"
height="100%"
:src="item.path"
controls="controls"
></video>
</div>
<div class="bigpic" v-else>
<img src="../../assets/img/nopic.jpg" />
</div>
2 years ago
<p class="infoTop">
2 years ago
{{ item.linename }}-{{ item.displayname }}-{{ item.channnelname }}
2 years ago
</p>
2 years ago
<p class="infoBottom" v-if="item.photoTime !== null">
2 years ago
{{ $moment(item.photoTime).format("yy-MM-DD HH:mm:ss") }} 
</p>
2 years ago
</div>
</div>
2 years ago
<el-dialog
title="设置"
:visible.sync="setdialog"
width="30%"
:close-on-click-modal="false"
>
<el-form label-width="100px" label-position="left">
2 years ago
<el-form-item label="轮巡速度">
<el-select v-model="selSpeed" placeholder="请选择">
2 years ago
<el-option
v-for="item in speedOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
2 years ago
</el-select>
</el-form-item>
<!-- <el-form-item label="画面布局">
<el-select v-model="selLayout" placeholder="s请选择">
<el-option v-for="item in layoutOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item> -->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="setdialog = false"> </el-button>
<el-button type="primary" @click="submitForm()"> </el-button>
</div>
</el-dialog>
2 years ago
</div>
2 years ago
</template>
<script>
2 years ago
import { getPictureList } from "@/utils/api/index";
2 years ago
import qs from "qs";
2 years ago
export default {
2 years ago
data() {
return {
2 years ago
OptionssalseImg: {
inline: false,
button: true,
navbar: false,
title: false,
toolbar: false,
tooltip: false,
zoomable: true,
url: "src",
},
2 years ago
value: "选项1",
page: 1, // 当前页数
pageSize: 4, // 每页数量
totalPage: 0, //总页数
total: 0, //总条数
picList: [], //图片列表数据
2 years ago
remainingTime: 0, //剩余时间
2 years ago
isRuning: false,
timer: null,
loading: false,
2 years ago
setdialog: false, //设置弹框
2 years ago
speedOptions: [
{
value: 5,
label: "5秒",
},
{
value: 11,
label: "11秒",
},
{
value: 12,
label: "12秒",
},
{
value: 13,
label: "13秒",
},
{
value: 14,
label: "14秒",
},
{
value: 15,
label: "15秒",
},
2 years ago
], //轮巡速度
selSpeed: 5,
2 years ago
layoutOptions: [
{
value: 1,
label: "2*2",
},
{
value: 2,
label: "3*3",
},
{
value: 3,
label: "2*3",
},
{
value: 4,
label: "3*2",
},
{
value: 5,
label: "4*2",
},
{
value: 6,
label: "4*3",
},
2 years ago
], //画面布局
selLayout: 1,
2 years ago
options: [
{
value: "选项1",
label: "顺序",
},
{
value: "选项2",
label: "倒序",
},
],
};
},
methods: {
2 years ago
setbtn() {
2 years ago
this.isRuning = false;
this.pauseCountdown();
2 years ago
this.setdialog = true;
this.selSpeed = parseInt(localStorage.getItem("totalTime"))
? parseInt(localStorage.getItem("totalTime"))
: 15;
2 years ago
},
2 years ago
submitForm() {
localStorage.setItem("totalTime", this.selSpeed);
2 years ago
this.setdialog = false;
this.$message.success("设置成功");
},
2 years ago
//点击分页
2 years ago
handleCurrentChange(val) {
this.isRuning = false;
this.pauseCountdown();
this.page = val;
this.getPicData();
},
//请求数据接口方法
getPicData() {
2 years ago
this.loading = true;
2 years ago
getPictureList({
pageindex: this.page,
2 years ago
pagesize: this.pageSize,
2 years ago
})
2 years ago
.then((res) => {
2 years ago
console.log(this.totalPage);
2 years ago
this.picList = res.data.list;
this.totalPage = res.data.totalpage;
this.total = res.data.total;
this.loading = false;
})
.catch((err) => {
console.log(err);
});
2 years ago
},
2 years ago
//开始轮询
2 years ago
startCountdown() {
2 years ago
console.log(this.remainingTime);
2 years ago
this.timer = setInterval(() => {
if (this.remainingTime <= 0) {
2 years ago
this.clearTimer();
console.log("结束");
2 years ago
this.page++;
2 years ago
console.log(this.totalPage);
if (this.page > this.totalPage) {
console.log("组后一页");
this.page = 0;
this.startCountdown();
} else {
console.log(this.page);
2 years ago
this.remainingTime = parseInt(localStorage.getItem("totalTime"))
? parseInt(localStorage.getItem("totalTime"))
: 15;
2 years ago
this.getPicData();
2 years ago
this.startCountdown();
}
} else {
this.remainingTime--;
2 years ago
}
2 years ago
}, 1000);
},
2 years ago
clearTimer() {
//清除定时器
clearInterval(this.timer);
this.timer = null;
},
2 years ago
pauseCountdown() {
2 years ago
//清除定时器
clearInterval(this.timer);
this.timer = null;
2 years ago
},
2 years ago
//根据isRuning执行开始暂停操作
toggleCountdown() {
if (this.isRuning) {
2 years ago
console.log(this.isRuning);
2 years ago
this.pauseCountdown();
} else {
2 years ago
console.log(this.isRuning);
2 years ago
this.startCountdown();
this.getPicData();
}
this.isRuning = !this.isRuning;
2 years ago
console.log(this.isRuning);
2 years ago
},
2 years ago
},
computed: {},
mounted() {
2 years ago
this.remainingTime = parseInt(localStorage.getItem("totalTime"))
? parseInt(localStorage.getItem("totalTime"))
: 15;
2 years ago
this.toggleCountdown();
2 years ago
},
created() {},
2 years ago
2 years ago
beforeDestroy() {
2 years ago
// console.log("销毁定时器");
2 years ago
clearInterval(this.timer);
this.timer = null;
},
2 years ago
};
</script>
<style lang="less">
.picRotation {
2 years ago
width: calc(100% - 32px);
height: calc(100% - 32px);
padding: 16px 16px;
background: #ffffff;
.picHead {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0px 0px 8px 0px;
.buttonGroup {
display: flex;
.el-select {
margin-left: 10px;
width: 100px;
}
.info {
width: 80px;
text-align: center;
2 years ago
margin-right: 16px;
2 years ago
line-height: 32px;
b {
font-size: 24px;
font-weight: normal;
color: @color-success;
vertical-align: middle;
2 years ago
}
2 years ago
}
2 years ago
}
2 years ago
}
2 years ago
2 years ago
.imageCenter {
display: flex;
// justify-content: space-around;
flex-wrap: wrap;
height: calc(100% - 52px);
2 years ago
justify-content: space-between;
2 years ago
.imgList {
2 years ago
width: 49.8%;
2 years ago
position: relative;
display: inline-block;
2 years ago
margin-right: 0.1%;
margin-left: 0.1%;
margin-top: 0.1%;
margin-bottom: 0.1%;
2 years ago
position: relative;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px px;
2 years ago
height: 49.8%;
2 years ago
.bigpic {
width: 100%;
height: 100%;
background-size: 100% 100%;
2 years ago
}
2 years ago
img {
2 years ago
width: 100%;
height: 100%;
2 years ago
cursor: pointer;
2 years ago
}
.infoTop {
position: absolute;
bottom: 28px;
left: 0px;
font-size: 14px;
2 years ago
background: linear-gradient(180deg, #00eaff 10%, #409eff 100%);
2 years ago
color: @color-white;
font-weight: normal;
margin-top: 2px;
padding-left: 5px;
padding-right: 5px;
}
.infoBottom {
position: absolute;
bottom: 4px;
color: @color-white;
left: 0px;
font-size: 14px;
2 years ago
background: linear-gradient(180deg, #00eaff 10%, #409eff 100%);
2 years ago
font-weight: normal;
margin-top: 2px;
padding-left: 5px;
padding-right: 5px;
}
2 years ago
}
2 years ago
}
2 years ago
}
2 years ago
</style>