<template>
  <el-dialog
    title="历史图片"
    :visible.sync="isShow"
    class="historyPic"
    width="1192px"
    @close="handleclose"
  >
    <div v-loading="loadingpic">
      <el-carousel
        :loop="false"
        :autoplay="false"
        height="650px"
        indicator-position="none"
      >
        <el-carousel-item v-for="(item, index) in imglist" :key="index">
          <el-image :src="item.path" fit="contain"></el-image>
        </el-carousel-item>
      </el-carousel>
    </div>
  </el-dialog>
</template>
<script>
import { getHistoryList } from "@/utils/api/index";
export default {
  data() {
    return {
      isShow: false,
      imglist: [],
      page: 1, // 当前页数
      pageSize: 10, // 每页数量
      total: 0, //总条数
      selectnr: "", //获取当前数据内容
      loadingpic: false,
    };
  },
  mounted() {},
  methods: {
    //获取图片数据
    getdataform(val) {
      this.selectnr = val;
      this.loadingpic = true;
      getHistoryList({
        channelId: this.selectnr.channelId,
        termId: this.selectnr.termId,
        pageindex: this.page,
        pagesize: this.pageSize,
      }).then((res) => {
        this.loadingpic = false;
        this.imglist = res.data.list;
        this.total = res.data.total;
      });
    },
    //下一页
    changebtn(e) {
      console.log(e);
      if (Math.floor(e / 9) == 1) {
        this.page++;
        getHistoryList({
          channelId: this.selectnr.channelId,
          termId: this.selectnr.termId,
          pageindex: this.page,
          pagesize: this.pageSize,
        }).then((res) => {
          this.imglist.push(res.data.list);
          this.total = res.data.total;
        });
      }
    },
    display() {
      this.isShow = true;
    },
    hide() {
      this.isShow = false;
      this.imglist = [];
    },
    handleclose() {
      this.isShow = false;
      this.imglist = [];
    },
  },
};
</script>
<style lang="less">
.historyPic {
  .el-image {
    width: 1152px;
    height: 648px;
    img {
      width: 1152px;
      height: 648px;
    }
  }
}
</style>
