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.

369 lines
9.6 KiB
Vue

2 years ago
<template>
2 years ago
<div class="picRotation">
<div class="picHead">
<div class="pageNation">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page"
:page-size="pageSize"
layout=" prev, pager, next, jumper,total"
:total="total"
>
</el-pagination>
</div>
<div class="buttonGroup">
<el-button type="primary" @click="toggleCountdown">{{
isRuning ? "暂停轮巡" : "开始轮巡"
}}</el-button>
<el-button type="primary">设置</el-button>
<el-button type="primary">轮询条件</el-button>
<el-select v-model="value" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<span class="info">
<b> {{ isRuning ? remainingTime : "已暂停" }} </b>
</span>
</div>
2 years ago
</div>
2 years ago
<div class="imageCenter">
<div class="imgList" v-for="(item, index) in picList" :key="index">
<img :src="item.path" />
<p class="infoTop">
{{ item.channelId }}-{{ item.termId }}-{{ item.fileSize }}
</p>
<p class="infoBottom">{{ item.photoTime }}</p>
</div>
</div>
</div>
2 years ago
</template>
<script>
2 years ago
//import { picLoop } from "@/utils/api/index";
import qs from "qs";
2 years ago
export default {
2 years ago
data() {
return {
options: [
{
value: "选项1",
label: "顺序",
},
{
value: "选项2",
label: "倒序",
},
],
value: "选项1",
page: 1, // 当前页数
pageSize: 4, // 每页数量
totalPage: 0, //总页数
total: 0, //总条数
picList: [], //图片列表数据
basUrl: "",
totalTime: 15, //总共倒计时时间
remainingTime: 15, //剩余时间
isRuning: false,
timer: null,
};
},
methods: {
handleSizeChange(val) {
console.log(`每页 ${val}`);
2 years ago
},
2 years ago
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
this.isRuning = false;
this.pauseCountdown();
this.page = val;
this.getPicData();
},
//请求数据接口方法
getPicData() {
this.picList = [
{
id: 15,
termId: 10010,
channelId: 1,
presetId: 255,
width: 0,
height: 0,
fileSize: 265357,
photoTime: "2023-05-05T17:21:04.000+00:00",
recvTime: null,
path: "http://47.96.238.157/photos/2023/05/06/64/XYIGQ10C221000064_1_FF_20230506012104.jpg",
manualRequest: 0,
2 years ago
},
2 years ago
{
id: 16,
termId: 10010,
channelId: 1,
presetId: 255,
width: 0,
height: 0,
fileSize: 263597,
photoTime: "2023-05-05T17:21:49.000+00:00",
recvTime: null,
path: "http://47.96.238.157/photos/2023/05/06/64/XYIGQ10C221000064_1_FF_20230506012149.jpg",
manualRequest: 0,
2 years ago
},
2 years ago
{
id: 17,
termId: 10010,
channelId: 1,
presetId: 255,
width: 0,
height: 0,
fileSize: 265471,
photoTime: "2023-05-05T17:25:13.000+00:00",
recvTime: null,
path: "http://47.96.238.157/photos/2023/05/06/64/XYIGQ10C221000064_1_FF_20230506012513.jpg",
manualRequest: 0,
2 years ago
},
2 years ago
{
id: 18,
termId: 10010,
channelId: 1,
presetId: 255,
width: 0,
height: 0,
fileSize: 263625,
photoTime: "2023-05-05T17:36:37.000+00:00",
recvTime: null,
path: "http://47.96.238.157/photos/2023/05/06/64/XYIGQ10C221000064_1_FF_20230506013617.jpg",
manualRequest: 0,
2 years ago
},
2 years ago
{
id: 19,
termId: 10010,
channelId: 1,
presetId: 255,
width: 0,
height: 0,
fileSize: 261572,
photoTime: "2023-05-05T17:37:14.000+00:00",
recvTime: null,
path: "http://47.96.238.157/photos/2023/05/06/64/XYIGQ10C221000064_1_FF_20230506013654.jpg",
manualRequest: 0,
},
{
id: 22,
termId: 10010,
channelId: 1,
presetId: 255,
width: 0,
height: 0,
fileSize: 264348,
photoTime: "2023-05-05T17:40:06.000+00:00",
recvTime: null,
path: "http://47.96.238.157/photos/2023/05/06/64/XYIGQ10C221000064_1_FF_20230506013946.jpg",
manualRequest: 0,
},
{
id: 23,
termId: 10010,
channelId: 1,
presetId: 255,
width: 0,
height: 0,
fileSize: 262231,
photoTime: "2023-05-05T17:42:33.000+00:00",
recvTime: null,
path: "http://47.96.238.157/photos/2023/05/06/64/XYIGQ10C221000064_1_FF_20230506014213.jpg",
manualRequest: 0,
},
{
id: 24,
termId: 10010,
channelId: 1,
presetId: 255,
width: 0,
height: 0,
fileSize: 262564,
photoTime: "2023-05-05T17:43:11.000+00:00",
recvTime: null,
path: "http://47.96.238.157/photos/2023/05/06/64/XYIGQ10C221000064_1_FF_20230506014252.jpg",
manualRequest: 0,
2 years ago
},
2 years ago
{
id: 26,
termId: 10010,
channelId: 2,
presetId: 255,
width: 0,
height: 0,
fileSize: 177557,
photoTime: "2023-05-05T17:46:23.000+00:00",
recvTime: null,
path: "http://47.96.238.157/photos/2023/05/06/64/XYIGQ10C221000064_2_FF_20230506014604.jpg",
manualRequest: 0,
},
{
id: 37,
termId: 10010,
channelId: 2,
presetId: 255,
width: 0,
height: 0,
fileSize: 219467,
photoTime: "2023-05-05T17:47:31.000+00:00",
recvTime: null,
path: "http://47.96.238.157/photos/2023/05/06/64/XYIGQ10C221000064_2_FF_20230506014711.jpg",
manualRequest: 0,
},
{
id: 89,
termId: 10010,
channelId: 2,
presetId: 255,
width: 0,
height: 0,
fileSize: 257854,
photoTime: "2023-05-06T00:54:07.000+00:00",
recvTime: null,
path: "http://47.96.238.157/photos/2023/05/06/64/XYIGQ10C221000064_2_FF_20230506085401.jpg",
manualRequest: 0,
},
];
},
//开始轮巡
startCountdown() {
this.timer = setInterval(() => {
if (this.remainingTime <= 0) {
//等于0时 清除定时器,剩余时间等于总时间,从新执行当前轮巡函数
clearInterval(this.timer);
this.remainingTime = this.totalTime;
this.startCountdown();
this.page++;
this.getPicData();
console.log(this.page);
if (this.page > this.totalPage) {
clearInterval(this.timer);
//alert("最后一页了");
this.page = 1;
this.startCountdown();
this.getPicData();
}
} else {
this.remainingTime--;
2 years ago
}
2 years ago
}, 1000);
},
//暂停轮巡
pauseCountdown() {
clearInterval(this.timer); //清除定时器
2 years ago
},
2 years ago
//根据isRuning执行开始暂停操作
toggleCountdown() {
if (this.isRuning) {
this.pauseCountdown();
} else {
this.startCountdown();
this.getPicData();
}
this.isRuning = !this.isRuning;
2 years ago
},
2 years ago
},
computed: {},
mounted() {
//this.toggleCountdown();
},
created() {},
2 years ago
2 years ago
beforeDestroy() {
console.log("销毁定时器");
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;
margin-left: 16px;
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);
.imgList {
width: 49.4%;
position: relative;
display: inline-block;
margin-right: 0.25%;
margin-left: 0.25%;
margin-top: 0.3%;
position: relative;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px px;
height: 49%;
2 years ago
2 years ago
img {
width: 100%;
height: 100%;
}
.infoTop {
position: absolute;
bottom: 28px;
left: 0px;
font-size: 15px;
background-color: #3a87ad !important;
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: 15px;
background-color: #51b17c !important;
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>