<template>
  <div class="wrap">
    <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 share">
      <div class="inner">
        <h6 v-html="modules[1].form.title"></h6>
        <p class="en"
           v-html="modules[1].form.des"></p>
        <div class="sum">{{ modules[2].form.title }}</div>
        <div class="flex beamBox">
          <div class="left">
            <div class="des"
                 v-html="modules[2].form.des"></div>
          </div>
          <img class="pic"
               :src="modules[2].form.pic"
               alt="">
        </div>
      </div>
    </div>

    <div class="intro">
      <div class="inner intro-inner">
        <img class="pic"
             :src="modules[3].form.pic"
             alt="">
        <div class="des"
             v-html="modules[3].form.des"></div>
      </div>
    </div>

    <div class="unit">
      <div class="title"
           v-html="modules[4].form.title"></div>
      <img class="pic"
           :src="modules[4].form.pic"
           alt="">
    </div>
  </div>
</template>

<script>
import mixins from '@/mixins/page'
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'], Util.rsa(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';
$banner-height: 21.6rem;
.wrap {
    background: url(http://10.10.11.7/images/device/4.png) bottom right/auto no-repeat;
    /deep/ .el-carousel {
        height: $banner-height;
        .el-carousel__container {
            height: $banner-height;
        }
        img {
            height: $banner-height;
        }
    }
}
.banner-item {
    .banner-name {
        font-size: 2.16rem;
        left: 17%;
        bottom: 20%;
    }
}
.block {
    padding: 3.85rem 0;
    .inner {
        h6 {
            font-size: 1.76rem;
        }
        .en {
            font-size: 1.76rem;
            margin: 0px 0 2rem;
        }
        .sum {
            margin-top: 3rem;
            font-size: 0.96rem;
        }
    }
}
.beamBox {
    position: relative;
    .imgText {
        position: absolute;
        right: 2rem;
        bottom: 2.25rem;
        display: flex;
        font-size: 0.9rem;
        font-weight: 400;
        .readio {
            width: 7px;
            height: 7px;
            background-color: #2a2a2a;
            border-radius: 50%;
            margin-right: 10px;
            margin-top: 8px;
        }
    }
}
.share {
    position: relative;
    .beamBox {
        align-items: center;
    }
    .left {
        width: 50%;
        padding-right: 66px;
    }
    h6 {
        position: relative;
        font-size: 1.92rem;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: bold;
        color: #333333;
    }
    .en {
        margin-top: -25px;
        font-size: 2.4rem;
        font-family: PingFangSC-Light, PingFang SC;
        font-weight: 300;
        color: #e3e3e3;
    }
    .sum {
        margin-top: 60px;
        font-size: 1.2rem;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #333333;
        line-height: 44px;
    }
    .des {
        margin-top: 1.25rem;
        font-size: 0.88rem;
        color: #333;
        line-height: 1.85rem;
        -webkit-line-clamp: inherit;
        overflow: visible;
    }
    .pic {
        width: 50%;
        margin-top: 10px;
        border-top-left-radius: 20px;
    }
}
.intro {
    height: 19.65rem;
    margin-bottom: 67px;
    .intro-inner {
        display: flex;
        align-items: center;
        height: 100%;
        background-color: #2e4984;
    }
    .pic {
        width: 50%;
        height: 100%;
    }
    .des {
        width: 50%;
        height: 19.65rem;
        padding: 2.85rem 3rem 1rem 3rem;
        font-size: 0.96rem;
        color: #fff;
        line-height: 2rem;
        -webkit-line-clamp: 7; //设定一共3行，超出的部分隐藏，并用省略号来表示
    }
}
.unit {
    width: 986px;
    padding-bottom: 60px;
    margin: 0 auto;
    .title {
        padding-left: 0.93rem;
        margin-bottom: 0.93rem;
        font-size: 0.88rem;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #2a2a2a;
        border-left: 4px solid #1583ff;
    }
}

@media (max-width: 1200px) {
    .banner {
        height: 12rem;
        padding: 6rem 0 0 2rem;
    }
    .beamBox {
        .imgText {
            bottom: 4rem;
            right: 4rem;
        }
    }
    .share {
        width: 90%;
        padding-left: 0;
        margin: 0 auto;
    }
    .beamBox {
        display: flex;
        flex-direction: column;
        position: relative;

        .left {
            width: 100%;
        }
        .des {
            -webkit-line-clamp: 100;
        }
        .pic {
            margin-top: 10px;
            width: 100%;
            height: auto;
        }
    }
    .intro {
        width: 90%;
        padding: 1rem 0;
        height: auto;
        .intro-inner {
            flex-direction: column;
        }
        .pic {
            width: 80%;
        }
        .des {
            width: 80%;
            height: auto;
            padding: 2rem 0 0;
            -webkit-line-clamp: 100;
        }
    }
    .unit {
        width: 95%;
        img {
            width: 100%;
        }
    }
}
</style>