<template>
  <div class="wrap" v-if="modules.length>=1">
    <el-carousel :interval="6000" :arrow="(modules[0] && modules[0].list.filter(e => e.isEnable).length > 1) ? 'hover' : 'never'" :indicator-position="modules[0].list.filter(e => e.isEnable).length > 1 ? '' : 'none'">
      <template v-for="(item, i) in modules[0].list">
        <el-carousel-item v-if="item.pic && item.isEnable" :key="i">
          <div :class="['banner-item', {'cursor-pointer': isLink(item.link.linkName)}]" @click="openLink(item)">
            <img :src="item.pic" alt="">
            <p class="banner-name">{{ item.title }}</p>
          </div>
        </el-carousel-item>
      </template>
    </el-carousel>

    <div class="block">
      <h2 class="b-title wow fadeInUp">{{ modules[1].form.title }}</h2>
      <p class="intro wow fadeInUp" data-wow-delay="0.5s">{{ modules[1].form.des }}</p>
      <ul class="area">
        <li v-for="(item, i) in modules[2].list" :key="i" class="wow fadeInDown" :data-wow-delay="(0.2 * i).toFixed(1) + 's'" :class="{'cursor-pointer': isLink(item.link.linkName)}" @click="openLink(item)">
          <img :src="item.pic" alt="" class="pic">
          <div class="texts">
            <img :src="require('@/assets/images/research/res' + (i + 1) + '-1.png')" alt="" class="icon">
            <h6>{{ item.title }}</h6>
            <p class="des">{{ item.des }}</p>
          </div>
        </li>
      </ul>
    </div>

    <div class="block gray">
      <div class="inner">
        <h2 class="b-title wow fadeInUp">{{ modules[3].form.title }}</h2>
        <p class="intro wow fadeInUp" data-wow-delay="0.5s">{{ modules[3].form.des }}</p>
        <ul class="group">
          <li v-for="(item, i) in modules[4].list" :key="i" class="wow fadeInDown" :data-wow-delay="(0.2 * i).toFixed(1) + 's'" :class="{'cursor-pointer': isLink(item.link.linkName)}" @click="openLink(item)">
            <img :src="item.pic" alt="">
            <p class="text">{{ item.title }}</p>
          </li>
        </ul>
      </div>
    </div>
    
    <div class="block">
      <div class="inner news-inner">
        <h2 class="b-title wow fadeInUp">{{ modules[5].form.title }}</h2>
        <p class="intro wow fadeInUp" data-wow-delay="0.5s">{{ modules[5].form.des }}</p>
        <ul class="news">
          <li v-for="(item, i) in modules[6].list" :key="i" class="wow fadeInDown" :data-wow-delay="(0.2 * i).toFixed(1) + 's'" :class="{'cursor-pointer': isLink(item.link.linkName)}" @click="openLink(item)">
            <img :src="item.pic" alt="">
            <div class="texts">
              <h6>{{ item.title }}</h6>
              <div class="des">{{ item.des }}</div>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import mixins from '@/mixins/page'
import Setting from '@/setting'
import Util from '@/libs/util'
import WOW from 'wow.js'
export default {
  mixins: [mixins],
  data() {
    return {

    }
  },
  mounted() {
    new WOW().init()
  },
  methods: {
    // 获取文章详情
    getInfo() {
      // 预览/详情
      this.$post(`${this.api[this.preview ? 'getRedisCache' : 'findPage']}?columnId=${this.id}`).then(({ data }) => {
        if (data.length) {
          // state：已发布（1）则取theEditedJson，草稿（0）则取jsonBeforeEditing
          const json = JSON.parse(this.preview ?
            data :
            data[data.length - 1][data[data.length - 1].state ? 'theEditedJson' : 'jsonBeforeEditing'])
          this.modules = json
          console.log("🚀 ~ file: index.vue ~ line 180 ~ this.$post ~ json", json)
        }
      }).catch(err => {})
    },
  }
};
</script>

<style lang="scss" scoped>
@import url(../../plugins/wow/animate.css);
@import "../../styles/page/page.scss";
.wrap{
  /deep/ .el-carousel {
    height: 24rem;
    .el-carousel__container{
      height: 24rem;
    }
    img{
      height: 24rem;
    }
  }
}
.banner-item {
  .banner-name {
    font-size: 1.6rem;
  }
}
.block  {
  padding: 3.85rem 0;
  .intro  {
    margin-bottom: 4rem;
  }
}
.area {
  display: flex;
  li {
    position: relative;
    width: 19%;
    color: #fff;
    background: url(../../assets/images/research/res1.png) 0 0/100% 100% no-repeat;
    transition: .3s;
    &:hover {
      transform: translateY(20px);
      .icon {
        transform: rotateY(360deg);
      }
    }
    &:nth-child(2) {
      width: 21%;
      margin-top: 70px;
      .texts {
        background: #2B1B1C;
      }
    }
    &:nth-child(3) {
      .texts {
        background: #009C91;
      }
    }
    &:nth-child(4) {
      margin-top: 70px;
      .texts {
        background: #005388;
      }
    }
    &:nth-child(5) {
      width: 22%;
      .texts {
        background: #9A4E10;
      }
    }
  }
  .pic {
    width: 100%;
    height: 32.65rem;
  }
  .icon {
    transition: .3s;
  }
  .texts {
    width: 100%;
    padding: 1rem 2rem;
    background: #08577B;
    overflow: hidden;
  }
  h6 {
    font-size: 1.2rem;
    white-space: nowrap;
  }
  .des {
    font-size: .96rem;
    color: rgba(255,255,255,0.55);
  }
}
.group {
  display: flex;
  flex-wrap: wrap;
  li {
    position: relative;
    width: calc((100% - 56px) / 3);
    margin: 0 1.4rem 1.95rem 0;
    transition: .3s;
    &:hover {
      transform: scale(1.05);
      .text {
        color: #fff;
        background-color: #465f85;
      }
    }
    &:nth-child(3n) {
      margin-right: 0;
    }
  }
  img {
    width: 100%;
    height: auto;
  }
  .text {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 7.15rem;
    padding: 0 1.5rem;
    font-size: 1.44rem;
    font-family: SFProDisplay-Bold, SFProDisplay;
    font-weight: bold;
    line-height: 2rem;
    text-align: center;
    color: #272727;
    background-color: #fff;
    transition: .3s;
  }
}
.news {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  li {
    position: relative;
    width: calc((100% - 56px) / 3);
    padding: 11px;
    margin-right: 1.4rem;
    color: #333;
    background-color: #fff;
    box-shadow: 0px 5px 1rem 0px rgba(98,117,163,0.08);
    border-radius: 10px;
    transition: .3s;
    &:hover {
      transform: translateY(20px);
    }
    &:nth-child(3n) {
      margin-right: 0;
    }
    &:hover {
      color: #fff;
      background-color: #0252D9;
    }
  }
  img {
    width: 100%;
    height: auto;
  }
  .texts {
    padding: 0 .9rem 2.5rem;
  }
  h6 {
    margin: 1.75rem 0 .6rem;
    font-size: 1.04rem;
    line-height: 1.65rem;
  }
  .des {
    font-size: .88rem;
    line-height: 1.3rem;
  }
}

@media (min-width: 280px) and (max-width: 1200px) {
  .wrap{
  /deep/ .el-carousel {
    height: 18rem;
    .el-carousel__container{
      height: 18rem;
    }
    img{
      height: 18rem;
    }
  }
}
 .block{ 
  padding: 50px 0;
  .intro {
    margin-bottom: 30px;
  }
  .area{
    flex-direction: column;
    li{
      width: 95%;margin: 1.25rem auto;
    }
  }
  .group,.news{
    flex-direction: column;
    li {
      width: 95%;
      margin: 20px auto;
    }
  }
 }
 .area {
  li {
    height:  auto;
    .pic{
      height: 20rem;
    }
    .texts{
      height: 10rem;
    }
  }
 }
 .group img {
  height: 20rem;
 }
 .news img{
  height: 20rem;
 }
}
@media (max-width: 320px) {
  .wrap  {
    /deep/ .el-carousel{
      height: 12rem !important;
    }
    /deep/ .el-carousel__container{
      height: 12rem !important; 
    }
    /deep/  .el-carousel__item {
      height: 12rem !important;
    }
  }
  .banner-item{
    img {
      height: 12rem !important;
    }
    .banner-name {
      font-size: 1.5rem;
      line-height: 1rem;
      left: 2rem;
      bottom: 2rem;
    }
  }
  .block {
    padding: 1.25rem 0 ;
    .b-title  {
      font-size: 1.5rem;
      margin-bottom: 1rem;
    }
    .group ,.news{
      li {
        img {
          height: auto;
        }
        .text {
          font-size: 1.5rem;
          line-height: 1.8rem;
        }
      }
    }
  }
}
@media (min-width: 320px) and (max-width: 375px) {
  .wrap  {
    /deep/ .el-carousel{
      height: 12rem !important;
    }
    /deep/ .el-carousel__container{
      height: 12rem !important; 
    }
    /deep/  .el-carousel__item {
      height: 12rem !important;
    }
  }
  .banner-item{
    img {
      height: 12rem !important;
    }
    .banner-name {
      font-size: 1.5rem;
      line-height: 1rem;
      left: 2rem;
      bottom: 2rem;
    }
  }
  .block {
    padding: 1.25rem 0 ;
    .b-title  {
      font-size: 1.5rem;
      margin-bottom: 1rem;
    }
    .group ,.news{
      li {
        img {
          height: auto;
        }
        .text {
          font-size: 1.5rem;
          line-height: 1.8rem;
        }
      }
    }
  }
}
@media (min-width: 375px) and (max-width: 480px) {
  .wrap  {
    /deep/ .el-carousel{
      height: 12rem !important;
    }
    /deep/ .el-carousel__container{
      height: 12rem !important; 
    }
    /deep/  .el-carousel__item {
      height: 12rem !important;
    }
  }
  .banner-item{
    img {
      height: 12rem !important;
    }
    .banner-name {
      font-size: 1.5rem;
      line-height: 1rem;
      left: 2rem;
      bottom: 2rem;
    }
  }
  .block {
    padding: 1.25rem 0 ;
    .b-title  {
      font-size: 1.5rem;
      margin-bottom: 1rem;
    }
    .group ,.news{
      li {
        img {
          height: auto;
        }
        .text {
          font-size: 1.5rem;
          line-height: 1.8rem;
        }
      }
    }
    .area {
      li {
        .pic {
          height: 22rem;
        }
      }
    }
  }
}
@media (min-width: 480px) and (max-width: 640px) {
  .wrap  {
    /deep/ .el-carousel{
      height: 12rem !important;
    }
    /deep/ .el-carousel__container{
      height: 12rem !important; 
    }
    /deep/  .el-carousel__item {
      height: 12rem !important;
    }
  }
  .banner-item{
    img {
      height: 12rem !important;
    }
    .banner-name {
      font-size: 1.5rem;
      line-height: 1rem;
      left: 2rem;
      bottom: 2rem;
    }
  }
  .block {
    padding: 1.25rem 0 ;
    .b-title  {
      font-size: 1.5rem;
      margin-bottom: 1rem;
    }
    .group ,.news{
      li {
        img {
          height: auto;
        }
        .text {
          font-size: 1.5rem;
          line-height: 1.8rem;
        }
      }
    }
    .area {
      li {
        .pic {
          height: auto;
        }
      }
    }
  }
}
@media (min-width: 640px) and (max-width: 768px) {
  .wrap  {
    /deep/ .el-carousel{
      height: 12rem !important;
    }
    /deep/ .el-carousel__container{
      height: 12rem !important; 
    }
    /deep/  .el-carousel__item {
      height: 12rem !important;
    }
  }
  .banner-item{
    img {
      height: 12rem !important;
    }
    .banner-name {
      font-size: 1.5rem;
      line-height: 1rem;
      left: 2rem;
      bottom: 2rem;
    }
  }
  .block {
    padding: 1.25rem 0 ;
    .b-title  {
      font-size: 1.5rem;
      margin-bottom: 1rem;
    }
    .group ,.news{
      li {
        img {
          height: auto;
        }
        .text {
          font-size: 1.5rem;
          line-height: 1.8rem;
        }
      }
    }
    .area {
      flex-direction: row;;
      li {
        width: 19%;
        .pic {
          height: auto;
        }
      }
    }
  }
}
@media (min-width: 768px) and (max-width: 980px) {
  .wrap  {
    /deep/ .el-carousel{
      height: 12rem !important;
    }
    /deep/ .el-carousel__container{
      height: 12rem !important; 
    }
    /deep/  .el-carousel__item {
      height: 12rem !important;
    }
  }
  .banner-item{
    img {
      height: 12rem !important;
    }
    .banner-name {
      font-size: 1.5rem;
      line-height: 1rem;
      left: 2rem;
      bottom: 2rem;
    }
  }
  .block {
    padding: 1.25rem 0 ;
    .b-title  {
      font-size: 1.5rem;
      margin-bottom: 1rem;
    }
    .group ,.news{
      flex-direction: row;
      li {
        width: calc((100% - 3rem) / 3);
        margin: 0 .8rem 1.95rem 0;
        -webkit-transition: .3s;
        img {
          height: auto;
        }
        .text {
          font-size: 1.5rem;
          line-height: 1.8rem;
        }
      }
    }
    .area {
      flex-direction: row;;
      li {
        width: 19%;
        .pic {
          height: auto;
        }
      }
    }
  }
}
@media (min-width: 980px) and (max-width: 1200px) {
  .wrap  {
    /deep/ .el-carousel{
      height: 12rem !important;
    }
    /deep/ .el-carousel__container{
      height: 12rem !important; 
    }
    /deep/  .el-carousel__item {
      height: 12rem !important;
    }
  }
  .banner-item{
    img {
      height: 12rem !important;
    }
    .banner-name {
      font-size: 1.5rem;
      line-height: 1rem;
      left: 2rem;
      bottom: 2rem;
    }
  }
  .block {
    padding: 1.25rem 0 ;
    .b-title  {
      font-size: 1.5rem;
      margin-bottom: 1rem;
    }
    .group ,.news{
      flex-direction: row;
      li {
        width: calc((100% - 3rem) / 3);
        margin: 0 .8rem 1.95rem 0;
        -webkit-transition: .3s;
        img {
          height: auto;
        }
        .text {
          font-size: 1.5rem;
          line-height: 1.8rem;
        }
      }
    }
    .area {
      flex-direction: row;;
      li {
        width: 19%;
        .pic {
          height: auto;
        }
      }
    }
  }
}
</style>