<template>
  <div class="wrap">
    <div class="single-banner">
      <img class="banner-img"
           :src="modules[0].form.pic"
           alt="" />
      <div class="texts">
        <h6 class="banner-title">{{ modules[0].form.title }}</h6>
        <p class="banner-des des">{{ modules[0].form.des }}</p>
      </div>
    </div>

    <div class="block gray"
         style="padding: 2rem 0;">
      <div class="inner">
        <ul class="items">
          <li>
            <img class="pic"
                 :src="modules[1].form.pic"
                 alt="">
            <div class="texts">
              <h6 v-html="modules[1].form.title"></h6>
              <div class="text"
                   v-html="modules[1].form.des"></div>
              <img src="@/assets/images/arrow.png"
                   alt=""
                   :class="{'arrow': isLink(modules[1].form.link.linkName)}"
                   @click="openLink(modules[1].form)">
            </div>
          </li>
          <li>
            <img class="pic"
                 :src="modules[2].form.pic"
                 alt="">
            <div class="texts">
              <h6 v-html="modules[2].form.title"></h6>
              <div class="text"
                   v-html="modules[2].form.des"></div>
              <img src="@/assets/images/arrow.png"
                   alt=""
                   :class="{'arrow': isLink(modules[2].form.link.linkName)}"
                   @click="openLink(modules[2].form)">
            </div>
          </li>
        </ul>
      </div>
    </div>

    <div class="about">
      <div class="inner">
        <div class="texts">
          <div class="title wow fadeInUp"
               data-wow-delay="0.7s"
               v-html="modules[3].form.title"></div>
          <div class="des wow fadeInDown"
               data-wow-delay="1s"
               v-html="modules[3].form.des"></div>
          <img class="m-t-10"
               width="42"
               src="@/assets/images/arrow-white.png"
               alt=""
               :class="{'arrow': isLink(modules[3].form.link.linkName)}"
               @click="openLink(modules[3].form)">
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import mixins from "@/mixins/page";
import WOW from "wow.js";
import Util from '@/libs/util'
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';
.items {
    margin-top: 2rem;
    li {
        position: relative;
        height: 559px;
        margin-bottom: 60px;
        &:nth-child(even) {
            .texts {
                left: auto;
                right: 100px;
            }
        }
        .pic {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .texts {
            position: absolute;
            top: 100px;
            left: 80px;
            width: 500px;
            padding: 30px;
            color: #333;
            background-color: rgba(255, 255, 255, 0.85);
            border-radius: 0px 0px 100px 0px;
            border-top: 4px solid #0280f1;
        }
        h6 {
            font-size: 1.2rem;
            font-family: PingFangSC-Medium, PingFang SC;
        }
        .text {
            margin: 1rem 0;
            font-size: 1rem;
            line-height: 1.6;
        }
        .icon {
            width: 40px;
        }
    }
}
.program {
    background: #fff;
    .title {
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: flex-end;
        padding-bottom: 25px;
        margin-bottom: 30px;
        border-bottom: 1px solid #ddd;
        align-items: center;
        h5 {
            padding-left: 16px;
            font-size: 1.6rem;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
            color: #333333;
            line-height: 1;
            border-left: 6px solid #2b96ef;
        }
        .sub {
            font-size: 1.1rem;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
            color: #afb7bf;
        }
        .more {
            font-size: 0.8rem;
            color: #666;
            cursor: pointer;
        }
    }
    .slide {
        display: flex;
        margin-bottom: 14px;
        cursor: pointer;
    }
    .texts {
        width: 51%;
        padding: 56px;
        background: #fbfbfb;
        h6 {
            font-size: 1.3rem;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
            color: #333333;
        }
        .des {
            margin: 35px 0 25px;
            font-size: 1rem;
            color: #666;
            line-height: 32px;
        }
        .meta {
            font-size: 0.9rem;
            color: #666;
        }
    }
    .img-wrap {
        width: 49%;
        height: 430px;
        overflow: hidden;
    }
    .pic {
        width: 100%;
        height: 100%;
        transition: 0.5s;
    }
    &:hover {
        .pic {
            transform: scale(1.3);
        }
    }
    .list {
        display: flex;
        li {
            width: calc((100% - 28px) / 3);
            height: 204px;
            padding: 36px 22px;
            margin-right: 14px;
            background: url(../../assets/images/sfel/7.png) no-repeat center;
            background-size: 100% 100%;
            transition: 0.5s;
            cursor: pointer;
            &:nth-child(2) {
                background-image: url(../../assets/images/sfel/8.png);
            }
            &:nth-child(3) {
                margin-right: 0;
                background-image: url(../../assets/images/sfel/9.png);
            }
            &:hover {
                transform: translateY(20px);
            }
        }
        .des {
            height: 90px;
            margin-bottom: 30px;
            font-size: 1rem;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
            color: #ffffff;
            line-height: 30px;
        }
        .date {
            font-size: 0.9rem;
            font-family: LaoSangamMN;
            color: #ffffff;
        }
    }
}
.about {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 643px;
    text-align: center;
    background: url(../../assets/images/about-bg.png) no-repeat center center;
    .texts {
        padding: 2.375rem 3.75rem;
        color: #fff;
        background: rgba(111, 69, 36, 0.56);
        border-radius: 17px;
        transition: 0.3s;
        &:hover {
            background: rgba(239, 126, 10, 0.56);
            transform: translateY(10px);
        }
    }
    .title {
        margin-bottom: 1rem;
        font-size: 1.8rem;
    }
    .des {
        font-size: 1rem;
        line-height: 1.6;
    }
}
@media (max-width: 1200px) {
    .items {
        li {
            .texts {
                left: 0;
                width: 98%;
            }
            &:nth-child(even) {
                .texts {
                    right: auto;
                }
            }
        }
    }
    .about {
        height: 30rem;
    }
}
@media (max-width: 780px) {
    .program {
        .slide {
            flex-direction: column;
        }
        .texts {
            width: 100%;
        }
        .img-wrap {
            width: 100%;
            height: 250px;
        }
        .list {
            flex-direction: column;
            li {
                width: 100%;
                margin-bottom: 1rem;
            }
        }
    }
}
</style>
