<template>
  <div class="container">
    <!-- banner -->
    <VBanner :bannerData="bannerData"></VBanner>

    <!-- 思维“芯”产品 -->
    <div class="index-thinking">
      <div class="i-t-content">
        <div class="t-top title-content">
          <!-- <div class="title-en">PRODUCT</div> -->
          <div class="title-zh">
            思维“芯”产品
          </div>
        </div>
        <div class="content-box thinking-content-box">
          <div class="cate-box thinking-cate-box">
            <ul class="cate-nav thinking-cate-nav">
              <li class="thinking-products-kind" v-for="(item, index) in productCate" :class="{active:index == clickProdIndex}" :key="index"  @click="getProdList(index)">
                <nuxt-link to="/">
                  {{ item.title }}
                </nuxt-link>
                <div class="line"></div>
              </li>
            </ul>
            <div class="cate-list thinking-cate-list">
              <div class="thinking-product-item" v-for="(item, index) in productCate" :key="index">
                <div class="thinking-product-item-img">
                  <nuxt-link to="/">
                    <img src="~/assets/images/index/tab-right-pic-dg.png" alt="" srcset="">
                  </nuxt-link>
                  <div class="product-tag">
                    基础版
                    <!-- <img src="~/assets/images/index/product_tag.png" alt="" srcset=""> -->
                  </div>
                </div>
                <div class="thinking-product-info">
                  <div class="thinking-product-title">幼小衔接课程……</div>
                  <div class="thinking-product-content">
                    <div class="thinking-product-price">
                      ￥<span class="price-num">888</span>
                    </div>
                    <div class="thinking-product-btn">
                      查看产品
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 网校课程 -->
    <div class="index-course">
      <div class="i-c-content">
        <div class="c-top title-content">
          <!-- <div class="title-en">PRODUCT</div> -->
          <div class="title-zh">
            网校课程
          </div>
        </div>
        <div class="content-box course-content-box">
          <div class="cate-box course-cate-box">
            <ul class="cate-nav course-cate-nav">
              <li class="products-kind thinking-products-kind" v-for="(item, index) in productCate" :class="{active:index == clickProdIndex}" :key="index"  @click="getProdList(index)">
                <nuxt-link to="/">
                  {{ item.title }}
                </nuxt-link>
                <div class="line"></div>
              </li>
            </ul>
            <div class="cate-list course-cate-list">
              <div class="product-item course-product-item" v-for="(item, index) in productCate" :key="index">
                <div class="product-item-img course-product-item-img">
                  <nuxt-link to="/">
                    <img src="~/assets/images/index/tab-right-pic-dg.png" alt="" srcset="">
                  </nuxt-link>
                </div>
                <div class="course-product-info">
                  <div class="course-product-title">幼小衔接课程……</div>
                  <div class="course-product-content">
                    <div class="course-product-price">
                      ￥<span class="price-num">888</span>
                    </div>
                    <div class="course-product-user">
                      <img src="~/assets/images/index/product_person.png" alt="" srcset="">
                      <img src="~/assets/images/join/business_banner.jpg" alt="" srcset="">
                      <div>158</div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import axios from 'axios';
import VBanner from '~/components/home/banner';
// import indexVideo from '~/components/home/indexVideo';
// import prodListShow from '~/components/common/prodListShow';
// import indexNewsListShow from '~/components/common/indexNewsListShow'

export default {
  data() {
    return {
      experiencePlace:['包头','成都','南京','东莞'],
      num:0,
      clickProdIndex:0,
      clickNewsIndex: 0,
      productCate: [
        {
          title: '全部',
          type: 0
        },
        {
          title: '0-3岁思维启蒙',
          type: 1
        },
        {
          title: '3-7岁能力训练',
          type: 2
        },
        {
          title: '5-7岁入学思考',
          type: 3
        },
        {
          title: '7-12岁技巧学习',
          type: 4
        }
      ]
    }
  },
  components: {
    VBanner,
    // indexVideo,
    // prodListShow,
    // indexNewsListShow
  },
  head() {
    return {
      title:'【中德智慧官网】逻辑狗 中华小熊猫',
      meta: [
        {name:'keywords',hid: 'keywords',content:`${this.metaData.navigationKeyword}`},
        {name:'description',hid:'description',content:`${this.metaData.navigationDescription}`}
      ],
    }
  },
  async asyncData({params,store}){
    //首页head信息
    let metaData = await axios(`${store.state.wordpressAPI}/NavigationMeta/get/1`);
    //banner数据动态获取
    let banner = await axios(`${store.state.wordpressAPI}/banner/selectAllByTpye/1`);
    //首页新闻信息
    // let indexFirstNewsList1 = await axios(`${store.state.wordpressAPI}/article/getRecommend/1`);
    // let indexFirstNewsList2 = await axios(`${store.state.wordpressAPI}/article/getRecommend/2`);
    // let indexFirstNewsList3 = await axios(`${store.state.wordpressAPI}/article/getRecommend/3`);
    // let indexFirstNewsList4 = await axios(`${store.state.wordpressAPI}/article/getRecommend/4`);
    // let indexFirstNewsList5 = await axios(`${store.state.wordpressAPI}/article/getRecommend/5`);

    // let indexNewsList1 = await axios(`${store.state.wordpressAPI}/article/getRecommendsByCategoryId/1/9`);
    // let indexNewsList2 = await axios(`${store.state.wordpressAPI}/article/getRecommendsByCategoryId/2/9`);
    // let indexNewsList3 = await axios(`${store.state.wordpressAPI}/article/getRecommendsByCategoryId/3/9`);
    // let indexNewsList4 = await axios(`${store.state.wordpressAPI}/article/getRecommendsByCategoryId/4/9`);
    // let indexNewsList5 = await axios(`${store.state.wordpressAPI}/article/getRecommendsByCategoryId/5/9`);
    
    //首页产品展示信息
    // let indexProdNav = await axios(`${store.state.wordpressAPI}/proCategory/showFirst`);
    
    // let indexProdList1 = await axios(`${store.state.wordpressAPI}/product/selectByPosition/1`);
    // let indexProdList2 = await axios(`${store.state.wordpressAPI}/product/selectByPosition/2`);
    // let indexProdList3 = await axios(`${store.state.wordpressAPI}/product/selectByPosition/3`);
    // let indexProdList4 = await axios(`${store.state.wordpressAPI}/product/selectByPosition/4`);
    // let indexProdList6 = await axios(`${store.state.wordpressAPI}/product/selectByPosition/97`);

    return {
      metaData: metaData.data,
      bannerData: banner.data,
      //首页新闻信息
      // indexFirstNewsList1: indexFirstNewsList1.data,
      // indexFirstNewsList2: indexFirstNewsList2.data,
      // indexFirstNewsList3: indexFirstNewsList3.data,
      // indexFirstNewsList4: indexFirstNewsList4.data,
      // indexFirstNewsList5: indexFirstNewsList5.data,
      // indexNewsList1: indexNewsList1.data,
      // indexNewsList2: indexNewsList2.data,
      // indexNewsList3: indexNewsList3.data,
      // indexNewsList4: indexNewsList4.data,
      // indexNewsList5: indexNewsList5.data,
      //首页产品信息
      // indexProdNav: indexProdNav.data,
      // indexProdList1: indexProdList1.data,
      // indexProdList2: indexProdList2.data,
      // indexProdList3: indexProdList3.data,
      // indexProdList4: indexProdList4.data,
      // indexProdList6: indexProdList6.data,
    } 
  },
  methods: {
    tab (index){
      this.num = index;
    },
    getProdList (index){
      this.clickProdIndex = index;
    },
    getNewsList (index){
      this.clickNewsIndex = index;
    }
  }
};

</script>
<style lang="scss" scoped>
@import '~static/common/style.sass';

.container {
  width: 100%;
  background: #F0F2F5;
  height: auto;
}

.title-content {
  margin-top: 164px;
}

.title-en {
  height:110px;
  line-height:110px;
  font-size:78px;
  font-family:PingFangSC-Semibold,PingFang SC;
  font-weight:600;
  color:#353956;
}

.title-zh {
  height: 81px;
  line-height: 81px;
  font-size: 58px;
  font-family: PingFangSC-Semibold,PingFang SC;
  font-weight: 600;
  color:#000000;
  letter-spacing: 1px;
  text-align: center;
}

ul.cate-nav {
  margin: 124px 0 116px;
  li.products-kind {
    display: inline-block;
    margin: 0 30px;
    cursor: pointer;
    &:first-child {
      margin-left: 0;
    }
    &.active, &:hover {
      a {
        color: $theme_color;
      }
    }
    .line {
      visibility: hidden;
      margin: 22px auto 0;
      width:60px;
      border-radius: 50px;
      height: 15px;
      background: $theme_color_fu;
      box-shadow: 0px 2px 8px 0px rgba(45,112,245,0.64);
      // -webkit-transition: all 0.5s ease;
      // -o-transition: all 0.5s ease;
      // transition: all 0.5s ease;
    }
    a {
      font-size: 32px;
      color: #747885;
    }
  }
  li.products-kind:hover, li.products-kind.active {
    .line {
      display: block;
      visibility: visible;
      transition: all 0.5s ease;
    }
  }
}

.cate-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  .product-item {
    position: relative;
    box-sizing: border-box;
    width:372px;
    margin-bottom: 42px;
    margin-right: 36px;
    &:nth-child(3n) {
      margin-right: 0px;
    }
  }
  .product-tag {
    padding: 0 6px 0 10px;
    background: $theme_color_fu;
    position: absolute;
    top: 0;
    left: 0;
    font-size: 12px;
    color: #FFFFFF;
    height: 24px;
    line-height: 24px;
    font-family: PingFangSC-Semibold,PingFang SC;
    font-weight: 600;
    border-radius:18px 0px 7px 0px;
    // img {
    //   width:52px;
    //   height:24px;
    //   object-fit: cover;
    // }
  }
}

/* index-thinking */ 
.index-thinking {
  width: 1200px;
  margin: 0 auto;
  // text-align: center;
  .i-t-content {
    position: relative;
    .title-zh {
      z-index: 666;
    }
    .title-en {
      position: absolute;
      top: 0;
      left: 50%;
      transform: translateX(-50%);
      z-index: 1;
    }
  }
  ul.thinking-cate-nav {
    margin: 124px 0 116px;
  }
  li.thinking-products-kind {
    display: inline-block;
    margin: 0 30px;
    cursor: pointer;
    -webkit-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    transition: all 0.5s ease;
    .line {
      visibility: hidden;
      margin: 22px auto 0;
      width:60px;
      border-radius: 50px;
      height: 15px;
      width:59px;
      height:15px;
      background: $theme_color_fu;
      box-shadow: 0px 2px 8px 0px rgba(94,161,241,0.87);
    }
    a {
      font-size: 32px;
      color: #747885;
    }
  }
  li.thinking-products-kind:hover, li.thinking-products-kind.active {
    .line {
      display: block;
      visibility: visible;
    }
  }

  li.thinking-products-kind:first-child {
    margin-left: 0;
  }
  li.thinking-products-kind.active a, 
  .thinking-products-kind:hover a{
    // font-size: 42px;
    color: $theme_color;
    // border-bottom: 6px solid $theme_color;
    // box-shadow:0px 2px 8px 0px rgba(240,53,94,0.61);
  }
  .thinking-cate-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    .thinking-product-item {
      position: relative;
      box-sizing: border-box;
      width:372px;
      margin-bottom: 42px;
      margin-right: 36px;
      &:nth-child(3n) {
        margin-right: 0px;
      }
      .thinking-product-item-img {
        img {
          border-radius:18px 18px 0px 0px;
        }
      }
    }
  }
  .thinking-product-info {
    box-sizing: border-box;
    background: #FFFFFF;
    height:90px;
    box-shadow:0px 5px 21px 0px rgba(232,243,243,1);
    border-radius:0px 0px 18px 18px;
    padding: 26px 22px;
    .thinking-product-title {
      width: 160px;
      height: 28px;
      font-size: 20px;
      font-family: PingFangSC-Medium,PingFang SC;
      font-weight: 500;
      color:rgba(52,62,48,1);
      line-height: 28px;
    }
    .thinking-product-content {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .thinking-product-price {
      color: #EA0B4A;
      .price-num {
        font-size: 22px;
        font-weight: bold;
      }
    }
    .thinking-product-btn {
      height:18px;
      line-height:18px;
      font-size:13px;
      font-family:PingFangSC-Regular,PingFang SC;
      font-weight:400;
      color: #3E8EFF;
    }
    // .thinking-product-user {
    //   display: flex;
    //   img {
    //     width: 18px;
    //     height: 22px;
    //   }
    // }
  }
}

/* index-thinking */ 
.index-course {
  width: 1200px;
  margin: 0 auto;
  .course-product-info {
    box-sizing: border-box;
    background: #FFFFFF;
    height:90px;
    box-shadow:0px 5px 21px 0px rgba(232,243,243,1);
    border-radius:0px 0px 18px 18px;
    padding: 26px 22px;
    .course-product-title {
      width: 160px;
      height: 28px;
      font-size: 20px;
      font-family: PingFangSC-Medium,PingFang SC;
      font-weight: 500;
      color:rgba(52,62,48,1);
      line-height: 28px;
    }
    .course-product-content {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .course-product-price {
      color: #EA0B4A;
      .price-num {
        font-size: 22px;
        font-weight: bold;
      }
    }
    .course-product-user {
      display: flex;
      align-items: flex-end;
      img {
        width: 18px;
        height: 22px;
        margin-right: 10px;
      }
    }
  }
}

/* 新闻资讯部分结束 */

</style>
