<template>
  <div class='Construct'>
    <!-- 模型的嵌套盒子 -->
    <div class="ifrBox">
      <!-- <iframe src="http://4dscene.4dage.com/culturalrelics/YFYCModel/index.html#/" frameborder="0"></iframe> -->
    </div>
    <!-- 左上的场景选择 -->
    <div class="vrChange" @click="vrShow = true">
      <img src="../../assets/img/construct/vrChange.png" alt="">
      <p>场景选择</p>
    </div>
    <!-- 右下角的搜索按钮 -->
    <img class="search" @click="searchShow=!searchShow" src="../../assets/img/construct/search.png" alt="">

    <!-- 点击左上角出来的轮播图 -->
    <div class="vrBox" :class="{ vrBoxAc: vrShow }">
      <!-- 关闭按钮 -->
      <div class="close" @click="vrShow = false">
        <van-icon name="cross" />
      </div>
      <div class="vrBoxSwi">
        <div class="swiper-container">
          <div class="swiper-wrapper">
            <div class="swiper-slide" v-for="i in 5" :key="i">
              <img src="../../assets/img/construct/sw1.png" alt="">
              <p>芜湖老海关{{ i }}</p>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 点击右下角的搜索出来的页面 -->
    <div class="searcBox" :class="{ searcBoxAc: searchShow }">
      <Search />
    </div>


  </div>
</template>

<script>
import Search from './components/search.vue'
import Swiper from "../../assets/libs/swiper.js";
export default {
  components: { Search },
  data() {
    return {
      vrShow: false,
      searchShow: true
    };
  },
  computed: {},
  watch: {},
  methods: {

  },
  created() {

  },
  mounted() {
    new Swiper(".Construct .swiper-container", {
      slidesPerView: 1.4,
      spaceBetween: 30,
      centeredSlides: true,
      initialSlide: 4,
    });
  },
  beforeCreate() { }, //生命周期 - 创建之前
  beforeMount() { }, //生命周期 - 挂载之前
  beforeUpdate() { }, //生命周期 - 更新之前
  updated() { }, //生命周期 - 更新之后
  beforeDestroy() { }, //生命周期 - 销毁之前
  destroyed() { }, //生命周期 - 销毁完成
  activated() { }, //如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style lang='less' scoped>
@import "../../assets/libs/swiper.css";

.Construct {
  font-size: 16px;
  color: #fff;
  width: 100%;
  height: calc(100% - 80px);
  position: relative;

  .ifrBox {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    iframe {
      width: 100%;
      height: 100%;
    }
  }

  .vrChange {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 2;
    width: 60px;
    text-align: center;

    &>img {
      width: 40px;
    }

    &>p {
      font-size: 14px;
    }
  }

  .search {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    z-index: 2;
  }

  .vrBox {
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
    position: absolute;
    z-index: 3;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, .6);

    .close {
      position: absolute;
      z-index: 3;
      top: 20px;
      right: 20px;
      font-size: 24px;
      color: #fff;
    }

    .vrBoxSwi {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      width: 100%;
      height: 55vh;

      .swiper-container {
        width: 100%;
        height: 100%;

        .swiper-slide {
          &>img {
            border-radius: 8px 8px 0 0;
            width: 100%;
            height: calc(100% - 40px);
            object-fit: cover;
          }

          &>p {
            height: 40px;
            line-height: 40px;
            font-size: 18px;
            text-align: center;
          }
        }
      }

    }
  }

  .vrBoxAc {
    opacity: 1;
    pointer-events: auto;
  }

  .searcBox {
    transform: translateX(-300px);
    opacity: 0;
    pointer-events: none;
    transition: all .3s;
    position: absolute;
    z-index: 3;
    left: 0;
    width: 75%;
    height: 100%;
  }

  .searcBoxAc {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
}
</style>