<!-- -->
<template>
  <div class="home-display">
    <div class="title wow animate__animated animate__fadeInUp">展览</div>
    <div class="wrapper" v-show="currentItem">
      <div class="content wow animate__animated animate__fadeInLeft">
        <div class="content-name">{{ currentItem.title }}</div>
        <div class="content-intro">
          {{ currentItem.intro ? currentItem.intro : "" }}
        </div>
        <div class="entrance" @click="handleClick(currentItem)">
          <span class="entrance-text">点击进入</span>
          <img src="@/assets/imgs/home/entrance.png" alt="" />
        </div>
      </div>
      <div class="img wow animate__animated animate__fadeInRight"  @click="handleClick(currentItem)">
        <img
          v-if="$getFullUrl(currentItem.faceImagePressUrl) "
          :src="$getFullUrl(currentItem.faceImagePressUrl)"
          alt=""
        />
        <img v-else :src="$getFullUrl(currentItem.faceImageUrl)" alt="" />
        <div class="img-name">{{ currentItem.title }}</div>
      </div>
      <div class="pagination wow animate__animated animate__fadeInUp">
        <ul>
          <li
            v-for="(item, index) in list"
            :key="index"
            :class="currentItem == item ? 'active' : ''"
            @click="handleChangePage(item)"
          >
            {{ index + 1 }}
          </li>
        </ul>
      </div>
    </div>
    <!-- <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 {
  name: "Display",
  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.currentItem = page;
    },
    handleClick(item) {
      console.log(item);
      const { exhibitionId } = item;
      this.$router.push({
        path: "display/" + exhibitionId,
      });
    },
  },
};
</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: 600px;
      color: #fff;
      font-family: "Alibaba PuHuiTi";
      .content-name {
        font-size: 20px;
        font-weight: bold;
        margin-bottom: 40px;
      }
      .content-intro {
        font-size: 14px;
        font-weight: 400;
        line-height: 40px;
        margin-bottom: 40px;
      }
      .entrance {
        font-size: 16px;
        cursor: pointer;
        .entrance-text {
          margin-right: 12px;
        }
      }
    }
    .img {
      position: absolute;
      top: 20%;
      // transform: translateY(-50%);
      right: 0;
      width: 380px;
      height: 480px;
      cursor: pointer;
      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>
