<template>
  <div class="home-banner">
    <el-carousel arrow="never" class="banner-swiper">
      <el-carousel-item v-for="item in bannerList" :key="item.src"><img :src="item.src"/></el-carousel-item>
    </el-carousel>
    <!-- <router-link to="profession">
      <div class="cover">
        <img src="https://webapp-pub.oss-cn-beijing.aliyuncs.com/project/new-marywood/banner_block.png" />
        <div class="cover-inner">
          <h1>玛丽伍德大学</h1>
          <h2>领航数字时代EMBA</h2>
          <p>
            赋能当今社会每位管理人，成就数字时代先锋领导者系统、实用、数字地赋能项目成长和企业转型升级
          </p>
        </div>
      </div>
    </router-link> -->
    <div class="video-box" v-show="isPlaying">
      <video
        ref="video"
        src="https://webapp-pub.oss-cn-beijing.aliyuncs.com/project/new-marywood/videoplayback.mp4"
        preload="auto"
        playsinline
      ></video>
    </div>
    <div class="intr-content">
      <div class="cover-inner">
        <h1>玛丽伍德大学</h1>
        <div class="dec" style="margin-bottom:35px;font-size: 14px;color: #fff;">
          无需出国&nbsp;&nbsp;在职学习&nbsp;&nbsp;学习时间灵活&nbsp;&nbsp;中美联合教学&nbsp;&nbsp;中文授课
        </div>
        <div class="box" style="display: flex; position: relative;">
          <div class="item" style="cursor: pointer;" @click="$router.push({ path: '/profession' })">
            <h2>数字时代领航人才EMBA</h2>
            <p>铸就领航数字商业时代的先锋领导者<br />塑造具备全球数字化视野的商企领袖</p>
          </div>
          <div class="line" style="width:1px; height: 100px;background-color: #fff;margin: 30px 30px;"></div>
          <div class="item" style="cursor: pointer;" @click="$router.push({ path: '/management' })">
            <h2>综合管理方向MBA</h2>
            <p>全面掌握商管才能<br />快速实现事业进阶</p>
          </div>
        </div>
      </div>
      <div class="button-group">
        <!-- <div class="button-item"><router-link to="profession">了解更多</router-link></div> -->
        <div class="button-item button-play" :class="{ 'is-playing': isPlaying }" @click="togglePlay">学校视频</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'HomeBanner',
  data() {
    return {
      isPlaying: false,

      bannerList: [
        {
          src: 'https://webapp-pub.oss-cn-beijing.aliyuncs.com/project/new-marywood/banner1.png'
        },
        {
          src: 'https://webapp-pub.oss-cn-beijing.aliyuncs.com/project/new-marywood/banner2.png'
        },
        {
          src: 'https://webapp-pub.oss-cn-beijing.aliyuncs.com/project/new-marywood/banner3.png'
        },
        {
          src: 'https://webapp-pub.oss-cn-beijing.aliyuncs.com/project/new-marywood/banner4.png'
        }
      ]
    }
  },
  methods: {
    togglePlay() {
      this.isPlaying = !this.isPlaying
      this.$nextTick(() => {
        this.isPlaying ? this.$refs.video.play() : this.$refs.video.pause()
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.home-banner {
  position: relative;
  height: calc(100vh - 10px);
  min-height: 600px;
}
.banner-swiper {
  height: 100%;
  ::v-deep .el-carousel__container {
    height: 100%;
  }
  img {
    height: 100%;
    width: 100%;
    object-fit: cover;
  }
}
.video-box {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 11;
  background-color: #000;
  video {
    width: 100%;
    height: 100%;
    object-fit: fill;
  }
}
.intr-content {
  position: absolute;
  top: 60%;
  left: 100px;
  transform: translateY(-50%);
  z-index: 11;
  .cover-inner {
    // position: absolute;
    // left: 0;
    // right: 0;
    // top: 0;
    // bottom: 0;
    // z-index: 11;
    // padding: 0 30px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    // padding-bottom: 33%;
  }
  h1 {
    font-size: 36px;
    color: #fff;
    font-weight: 500;
    // text-align: right;
  }
  h2 {
    margin-top: 16px;
    font-size: 26px;
    color: #faa634;
    font-weight: 400;
    // text-align: right;
  }
  p {
    margin-top: 20px;
    font-size: 16px;
    color: #fff;
    line-height: 2;
    text-align: justify;
    // width: 380px;
  }
}
.button-group {
  z-index: 21;
  position: relative;
  // left: 100px;
  // bottom: 30%;
  display: flex;
  margin-top: 20px;
  .button-item {
    width: 132px;
    border: 1px solid;
    border-radius: 5px;
    font-size: 18px;
    font-family: PingFangSC-Regular, PingFang SC;
    color: #fff;
    line-height: 54px;
    text-align: center;
    cursor: pointer;
  }
  .button-item + .button-item {
    margin-left: 20px;
  }
  .button-play {
    width: 138px;
    padding-right: 20px;
    background: #faa634 url('@/assets/images/play.png') no-repeat right 20px center;
    border-color: #faa634;
    &.is-playing {
      background: url('@/assets/images/stop.png') no-repeat right 20px center;
      border-color: #fff;
    }
  }
}
.cover {
  position: absolute;
  top: 0;
  right: 200px;
  width: 434px;
  height: 100%;
  z-index: 10;
  box-sizing: border-box;
  overflow: hidden;
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.25s ease-in-out;
  }
  &:hover {
    .cover-inner {
      background-color: rgba(0, 0, 0, 0.4);
    }
    img {
      transform: scale(1.1);
    }
  }

  .cover-inner {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 11;
    padding: 0 30px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 33%;
  }
  h1 {
    font-size: 36px;
    color: #fff;
    font-weight: 500;
    text-align: right;
  }
  h2 {
    margin-top: 16px;
    font-size: 26px;
    color: #faa634;
    font-weight: 400;
    text-align: right;
  }
  p {
    margin-top: 20px;
    font-size: 16px;
    color: #fff;
    line-height: 2;
    text-align: justify;
  }
}
</style>
