<!-- -->
<template>
  <div class="home-display">
    <div class="title">展览</div>
    <transition name="el-fade-in-linear">
      <div class="wrapper" v-show="currentItem.exhibitionId">
        <div class="content">
          <div class="content-name">{{ currentItem.title }}</div>
          <div class="content-intro">
            {{ currentItem.intro ? currentItem.intro : "" }}
          </div>
        </div>
        <div class="img">
          <img :src="currentItem.faceImageUrl" />
          <div class="img-name">{{ currentItem.title }}</div>
        </div>
        <div class="pagination">
          <ul>
            <li
              v-for="(item, index) in [1, 2, 3, 4]"
              :key="index"
              :class="currentPage == item ? 'active' : ''"
              @click="handleChangePage(item)"
            >
              {{ item }}
            </li>
          </ul>
        </div>
      </div>
    </transition>
    <!-- <el-carousel indicator-position="none" :autoplay="false" arrow="never">
      <el-carousel-item v-for="item in list" :key="item.exhibitionId">
        <div class="wrapper">
          <div class="content">
            <div class="content-name">{{ item.title }}</div>
            <div class="content-intro">
              {{ item.intro ? item.intro : "" }}
            </div>
          </div>
          <div class="img">
            <img :src="item.faceImageUrl" />
            <div class="img-name">{{ item.title }}</div>
          </div>
          <div class="pagination">
            <ul>
              <li
                v-for="(item, index) in [1, 2, 3, 4]"
                :key="index"
                :class="currentPage == item ? 'active' : ''"
                @click="handleChangePage(item)"
              >
                {{ item }}
              </li>
            </ul>
          </div>
        </div>
      </el-carousel-item>
    </el-carousel> -->
  </div>
</template>

<script>
import { getRecommendDisplay } from "@/api/display";
export default {
  data() {
    return {
      list: [],
      currentPage: 1,
      currentItem: {},
    };
  },
  mounted() {
    this.loadList();
  },
  methods: {
    async loadList() {
      let res = await getRecommendDisplay();
      this.list = res.data;
      this.currentItem = this.list[0];
    },
    handleChangePage(page) {
      this.currentPage = page;
      // debugger
      this.currentItem = null;
      this.currentItem = this.list[page - 1];
    },
  },
};
</script>

<style lang="scss" scoped>
.home-display {
  background-image: url("@/assets/imgs/home/cr-bg.png");
  background-size: cover;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 0 13%;
  .title {
    color: #fff;
    margin-top: 70px;
    margin-bottom: 90px;
    font-family: "Alibaba PuHuiTi";
    flex-basis: auto;
  }

  .wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    position: relative;
    flex: 1;
    .content {
      width: 800px;
      .content-name {
        font-size: 20px;
        font-family: Microsoft YaHei;
        font-weight: bold;
        color: #ffffff;
        margin-bottom: 40px;
        font-family: "Alibaba PuHuiTi";
      }
      .content-intro {
        font-size: 14px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: #ffffff;
        line-height: 40px;
        font-family: "Alibaba PuHuiTi";
      }
    }
    .img {
      position: absolute;
      top: 20%;
      // transform: translateY(-50%);
      right: 0;
      width: 550px;
      height: 480px;
      img {
        width: 100%;
      }
      .img-name {
        display: flex;
        justify-content: center;
        font-size: 16px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: #88754d;
      }
    }

    .pagination {
      position: absolute;
      bottom: 80px;
      right: 0;
      ul {
        display: flex;
        li {
          width: 22px;
          height: 22px;
          margin-right: 25px;
          color: #999;
          display: flex;
          align-items: center;
          justify-content: center;
          cursor: pointer;
        }
        .active {
          background: #2069c4;
          color: #fff;
        }
      }
    }
  }
}
::v-deep .el-carousel {
  width: 100%;
  height: 100%;
}
::v-deep .el-carousel__container {
  height: 100%;
}
::v-deep .el-carousel-item {
  height: 100%;
  position: relative;
}
::v-deep .el-carousel--horizontal {
  overflow: hidden;
}
</style>
