<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">{{ modules[1].form.subTitle }}</p>
        <div class="card"
             v-html="modules[1].form.des"></div>
        <div class="flex textBox">
          <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">
      <img class="bg"
           src="http://10.10.11.7/images/device/7.png"
           alt="">
      <img class="pic"
           :src="modules[3].form.pic"
           alt="">
    </div>

    <div class="unit">
      <h6>{{ modules[4].form.title }}</h6>
      <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 {
      routes: []
    }
  },
  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 {
    background: url(http://10.10.11.7/images/device/4.png) bottom right/auto no-repeat;
    /deep/ .el-carousel {
        height: 12.6rem;
        .el-carousel__container {
            height: 12.6rem;
        }
        img {
            height: 12.6rem;
        }
    }
}
.banner-item {
    .banner-name {
        font-size: 2.16rem;
        left: 17%;
        bottom: 20%;
    }
}
.block {
    padding: 3.85rem 0;
    .inner {
        h6 {
            font-size: 2.16rem;
        }
        .en {
            font-size: 1.76rem;
            margin: 0px 0 2rem;
        }
    }
}
.share {
    position: relative;
    .inner {
        width: 100%;
        max-width: 1323px;
        .textBox {
            position: absolute;
            width: 85%;
            right: 0;
            top: 26rem;
            .left {
                flex-grow: 1;
            }
        }
        h6 {
            font-weight: bold;
        }
    }
    .left {
        width: 34.187rem;
        margin-right: 4.125rem;
    }
    h6 {
        position: relative;
        font-size: 1.76rem;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #333333;
    }
    .en {
        margin: -25px 0 40px;
        font-size: 2.2rem;
        font-family: PingFangSC-Light, PingFang SC;
        font-weight: 300;
        color: #e3e3e3;
    }
    .card {
        position: absolute;
        left: 0;
        max-width: 1671px;
        width: 85%;
        padding: 1.6rem 2.9rem 1.6rem 14%;
        font-size: 1.06rem;
        font-family: PingFangSC-Medium, PingFang SC;
        border-radius: 0 6rem 0 0;
        font-weight: 500;
        color: #ffffff;
        line-height: 2.375rem;
        background: url(http://10.10.11.7/images/device/5.png) 0 0 /100% 100% no-repeat;
    }
    .des {
        margin-top: 25px;
        font-size: 0.98rem;
        -webkit-line-clamp: inherit;
        color: #333;
        line-height: 37px;
        overflow: visible;
    }
    .pic {
        width: 44.375rem;
        height: auto;
        border-top-left-radius: 20px;
    }
}
.intro {
    position: relative;
    height: 42.625rem;
    margin-bottom: 2.3rem;
    margin-top: 50rem;
    width: 85%;
    .bg {
        position: absolute;
        top: 0;
        left: 0;
        width: 65%;
        height: 35.73rem;
    }
    .pic {
        position: absolute;
        top: 3.015rem;
        left: 30%;
        width: 71%;
        height: 29.74rem;
    }
}
.unit {
    width: 986px;
    padding-bottom: 60px;
    margin: 0 auto;
    h6 {
        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: 1400px) {
    .share {
        .card {
            position: relative;
            margin-left: -2.5%;
        }
        .inner {
            max-width: none;
            width: 95%;
            .textBox {
                position: static;
                display: flex;
                flex-direction: column;
                align-items: flex-end;
                margin-left: 15%;
                .left {
                    width: 100%;
                    .des {
                        -webkit-line-clamp: 100;
                    }
                }
            }
        }
        .pic {
            width: 50%;
            margin-top: 20px;
        }
    }

    .bg {
        width: 100%;
    }
    .intro {
        height: 36rem;
        margin-top: 0;
        .pic {
            width: 100%;
            left: 0;
            top: 6%;
        }
    }
    .unit {
        width: 95%;
        img {
            width: 100%;
        }
    }
}
@media (max-width: 980px) {
    .share {
        .pic {
            width: 80%;
        }
    }
}
@media (max-width: 640px) {
    .share {
        .inner {
            .textBox {
                margin: 0 auto;
            }
        }
        .left {
            margin-right: 0;
        }
    }
    .intro {
        height: auto;
        .bg,
        .pic {
            position: static;
            width: 100%;
            height: auto;
        }
    }
}
</style>