<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>
      </div>
    </div>

    <div class="block history gray">
      <div class="inner" :class="{'cursor-pointer': isLink(modules[1].form.link.linkName)}" @click="openLink(modules[1].form)">
        <h2 class="wow fadeInLeft" style="margin-left: 57px">{{ modules[1].form.title }}</h2>
        <div class="texts wow fadeInDown" data-wow-delay="0.5s">
          <div class="left">
            <h2>{{ modules[1].form.subTitle }}</h2>
            <div class="text" v-html="modules[1].form.des"></div>
          </div>
          <img class="bg" :src="modules[1].form.pic" alt="">
        </div>
      </div>
    </div>
    
    <div class="block land">
      <div class="inner">
        <img class="pic" :src="modules[2].form.pic" alt="">
          <div class="right">
            <h6>{{ modules[2].form.title }}</h6>
            <div class="text" v-html="modules[2].form.des"></div>
        </div>
      </div>
    </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="plan">
          <li>
            <div class="left">
              <h6>{{ modules[4].form.title }}</h6>
              <div class="text" v-html="modules[4].form.des"></div>
              <img src="@/assets/images/arrow.png" alt="" :class="{'arrow': isLink(modules[4].form.link.linkName)}" @click="openLink(modules[4].form)">
            </div>
            <img class="pic" :src="modules[4].form.pic" alt="">
          </li>
          <li>
            <div class="left">
              <h6>{{ modules[5].form.title }}</h6>
              <div class="text" v-html="modules[5].form.des"></div>
              <img src="@/assets/images/arrow.png" alt="" :class="{'arrow': isLink(modules[5].form.link.linkName)}" @click="openLink(modules[5].form)">
            </div>
            <img class="pic" :src="modules[5].form.pic" alt="">
          </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 {
      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";
.history {
  h2 {
    font-size: 1.8rem;
    color: #333;
  }
  .texts {
    display: flex;
    justify-content: space-between;
    padding: 82px 57px 30px;
    margin-top: 20px;
    background-color: #fff;
    border-radius: 100px 0px 0px 0px;
    transition: .3s;
    &:hover {
      transform: scale(1.05);
    }
  }
  .left {
    width: 500px;
    padding-right: 30px;
  }
  .text {
    margin: 20px 0;
    font-size: 1.2rem;
    color: #181818;
    line-height: 31px;
    @include mul-ellipsis(10);
  }
  .bg {
    width: 560px;
    height: 500px;
    margin: -122px 0 0 0;
  }
}
.land {
  .inner {
    display: flex;
  }
  .pic {
    width: 50%;
    height: 450px;
  }
  .right {
    width: 50%;
  }
  h6 {
    margin-left: 50px;
    font-size: 1.3rem;
    font-family: PingFangSC-Semibold, PingFang SC;
    color: #333;
    @include ellipsis();
  }
  .text {
    height: 405px;
    padding: 50px;
    margin-top: 1rem;
    background: rgba(242,246,248,0.45);
    border-radius: 0px 100px 0px 0px;
  }
}
.plan {
  li {
    display: flex;
    height: 500px;
    margin-bottom: 60px;
    color: #333;
    background-color: #fff;
    border-radius: 100px 0px 0px 0px;
    &:nth-child(even) {
      flex-direction: row-reverse;
      .pic {
        margin: -20px 0 0 -20px;
        border-radius: 0 100px 0 0;
      }
    }
    .left {
      width: 50%;
      padding: 50px;
    }
    h6 {
      font-size: 1.4rem;
      font-family: PingFangSC-Medium, PingFang SC;
    }
    .text {
      margin: 1rem 0;
      font-size: 1rem;
      line-height: 1.6;
    }
    .pic {
      width: 48%;
      height: 500px;
      margin: -20px -20px 0 0;
      border-radius: 100px 0 0 0;
    }
  }
}
@media (max-width: 1200px) {
  .history {
    .left {
      width: 50%;
    }
    .bg {
      width: 50%;
    }
  }
}
@media (max-width: 1200px) {
  .history {
    .texts {
      flex-direction: column;
    }
    .left {
      width: 100%;
    }
    .bg {
      width: 100%;
      height: auto;
      margin-top: 1rem;
    }
  }
  .land {
    .inner {
      flex-direction: column;
    }
    .pic, .right {
      width: 100%;
    }
    .right {
      margin-top: 1rem;
    }
    .text {
      height: auto;
    }
  }
  .plan {
    li {
      flex-direction: column !important;
      height: auto;
      .left, .pic {
        width: 100%;
      }
      .pic {
        margin: 1rem 0 0 !important;
      }
    }
  }
}
</style>
