<template>
  <div class="video-w">
    <div class="container">
      <ul class="setion">
        <li class="common-title" :class="{'is-active': activeTab === i}" v-for="(item,i) in langVideoCourse" @click="activeTab=i" :key="i">{{item.name}}</li>
      </ul>
      <h-row class="i-ul" :gutter="20">
        <h-col :span="langVideoCourse[activeTab].items.length > 2 ? 6 : 12"  v-for="(sub,idx) in langVideoCourse[activeTab].items" :key="idx">
          <div class="i-li" :class="{small: langVideoCourse[activeTab].items.length > 2}" @click="itemHandle(sub)">
            <div class="img-w">
              <img class="li-img" :src="`${$cdn}course/img/${sub.code}.jpg?version=1`" alt="">
              <div class="hover-item">
                <img :src="`${$cdn}course/img/video-play.png`" alt="">
                <p>{{sub.name}}</p>
              </div>
            </div>
            <p class="li-p" >{{sub.name}}</p>
          </div>
        </h-col>
      </h-row>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'

export default {

  computed: {
    ...mapState({
      language: state => state.language.current,
      langVideoCourse: state => state.language.home.videoCourse.content
    })
  },
  data () {
    return {
      activeTab: 0
    }
  },
  methods: {
    itemHandle (item) {
      this.$bus.$emit('toggleVideo', {
        status: true,
        url: this.language === 'en' ? `en/${item.code}` : item.code
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.video-w {
  background: #F7F7F7;
}
.container{
  // width: 1200px;
  margin: 0 auto;
  padding: 0 0 124px;
  .setion{
    margin: 0 0 0;
    padding-top: 86px;
    display: flex;
    .common-title {
      margin: 0;
      padding-right: 34px;
      margin-right: 32px;
      position: relative;
      font-weight: 200;
      color: #909090;
      cursor: pointer;
      &.is-active {
        color: #202020;
        &::after {
          display: block;
        }
      }
      &::after {
        display: none;
      }
      &:last-child {
          &::before {
          display: none;
        }
      }
      &::before {
        content: '';
        display: block;
        height: 33px;
        width: 1px;
        background: #909090;
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
      }
    }
  }
  .i-ul{
      // display: flex;
      // justify-content: space-between;
      // align-items: center;
      // flex-wrap: wrap;
      width: 100%;
      margin-top: 64px;
      .i-li {
        position: relative;
        margin-bottom: 33px;
        background: #fff;
        .li-img{
          width: 100%;
          cursor: pointer;
          vertical-align: middle;
        }
        .bofang{
          width: 36px;
          height: 36px;
          position: absolute;
          right: 15px;
          bottom: 15px;
          cursor: pointer;
        }
        .li-p{
          font-size: 24px;
          color: #202020;
          line-height: 66px;
          padding: 0 15px;
          position: relative;
        }
        .img-w {
          position: relative;
          overflow: hidden;
        }
        &:hover {
          .hover-item {
            top: 0;
          }
          
        }
        .hover-item {
          background: rgba(0,0,0,0.5);
          position: absolute;
          top: -100%;
          left: 0;
          width: 100%;
          height: 100%;
          cursor: pointer;
          text-align: center;
          // padding-top: 125px;
          transition: top 0.2s linear;
          display: flex;
          flex-direction: column;
          justify-content: center;
          img {
            width: 70px;
            height: 70px;
            margin: 0 auto 9px;
          }
          p {
            font-size: 40px;
            color: #fff;
            
          }
        }
        &.small {
          .li-p{
            line-height: 50px;
            font-size: 16px;
            padding: 0 9px;
          }
          .bofang{
            width: 30px;
            height: 30px;
            position: absolute;
            right: 9px;
            bottom: 10px;
            cursor: pointer;
          }
          .hover-item {
            // padding-top: 50px;
            img {
              width: 50px;
              height: 50px;
            }
            p {
              font-size: 24px;
            }
          }
        }
      }
    }
}

</style>
