<template>
  <div class='Home'>
    <img class="logo" src="../../assets/img/home/logo.png" alt="">
    <img class="btn" @click="videoShow = true" src="../../assets/img/home/btn.png" alt="">
    <div class="ifrBox">
      <iframe src="http://zzbbh.4dage.com/SWKK/show.html?id=WK1592095910366638080" frameborder="0"></iframe>
    </div>

    <!-- 视频盒子 -->
    <div class="videoBox" :class="{ videoAc: videoShow }">
      <video muted src="../../assets/media/home.mp4"></video>
      <img v-show="videoBtnShow" class="videoBtn" src="../../assets/img/home/videoBtn.png" alt="" @click="$router.push('/layout/construct')">
    </div>
  </div>
</template>

<script>

export default {
  name: 'Home',
  components: {},
  data() {
    return {
      videoShow: false,
      videoBtnShow: false
    };
  },
  computed: {},
  watch: {
    videoShow(val) {
      if (val) {
        let dom = document.querySelector('video')
        dom.play()
        dom.addEventListener('ended', () => { //结束
          this.$router.push('/layout/construct')
        }, false);
        setTimeout(() => {
          this.videoBtnShow = true
        }, 1000);
      }
    }
  },
  methods: {

  },
  created() {

  },
  mounted() {

  },
  beforeCreate() { }, //生命周期 - 创建之前
  beforeMount() { }, //生命周期 - 挂载之前
  beforeUpdate() { }, //生命周期 - 更新之前
  updated() { }, //生命周期 - 更新之后
  beforeDestroy() { }, //生命周期 - 销毁之前
  destroyed() { }, //生命周期 - 销毁完成
  activated() { }, //如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style lang='less' scoped>
.Home {
  width: 100%;
  height: 100%;
  position: relative;

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

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

  .logo {
    position: absolute;
    z-index: 2;
    width: 300px;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
  }

  .btn {
    position: absolute;
    bottom: 40px;
    width: 200px;
    z-index: 2;
    left: 50%;
    transform: translateX(-50%);
  }

  .videoBox {
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
    width: 100%;
    height: 100%;

    video {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 100%;
      height: 100%;
    }

    .videoBtn {
      position: absolute;
      bottom: 40px;
      width: 200px;
      z-index: 2;
      left: 50%;
      transform: translateX(-50%);
    }
  }

  .videoAc {
    opacity: 1;
    pointer-events: auto;
  }
}
</style>