<template>
  <div class="wrap">
    <div class="actions">
      <p class="page-name">页面设置/{{ columnName }}</p>
      <div>
        <el-button type="primary" @click="preview">预览</el-button>
        <el-button @click="save(0)">保存为草稿</el-button>
        <el-button type="primary" @click="save(1)">发布</el-button>
        <el-button @click="back">放弃编辑</el-button>
      </div>
    </div>

    <div class="modules">
      <div class="relative">
        <el-carousel height="480px"
          :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">
              <img width="100%" height="100%" :src="item.pic" alt="">
            </el-carousel-item>
          </template>
        </el-carousel>
        <div class="cover" @click="toSet(0)">点击更换banner与链接</div>
      </div>

      <div class="block">
        <div class="c-wrap">
          <h2 class="b-title">{{ modules[1].form.title }}</h2>
          <p class="intro">{{ modules[1].form.des }}</p>
          <div class="cover" @click="toSet(1)">点击更换标题与描述</div>
        </div>
        <ul class="area">
          <template v-for="(item, i) in modules[2].list">
            <li :key="i">
              <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>
              <div class="cover" @click="toSet(2, i)">点击更改图片、标题概述与链接</div>
            </li>
          </template>
        </ul>
      </div>

      <div class="block">
        <div class="inner" style="width: 1400px;">
          <div class="c-wrap">
            <h2 class="b-title">{{ modules[3].form.title }}</h2>
            <p class="intro">{{ modules[3].form.des }}</p>
            <div class="cover" @click="toSet(3)">点击更换标题与描述</div>
          </div>
          <ul class="group">
            <li v-for="(item, i) in modules[4].list" :key="i">
              <img :src="item.pic" alt="">
              <p class="text">{{ item.title }}</p>
              <div class="cover" @click="toSet(4, i)">点击更改图片、标题与链接</div>
            </li>
          </ul>
        </div>
      </div>

      <div class="block">
        <div class="inner" style="width: 1558px">
          <div class="c-wrap">
            <h2 class="b-title">{{ modules[5].form.title }}</h2>
            <p class="intro">{{ modules[5].form.des }}</p>
            <div class="cover" @click="toSet(5)">点击更换标题与描述</div>
          </div>
          <ul class="news">
            <li v-for="(item, i) in modules[6].list" :key="i">
              <img :src="item.pic" alt="">
              <div class="texts">
                <h6>{{ item.title }}</h6>
                <div class="des">{{ item.des }}</div>
              </div>
              <div class="cover" @click="toSet(6, i)">点击更改图片、标题概述与链接</div>
            </li>
          </ul>
        </div>
      </div>
    </div>

    <Module ref="module" :data.sync="curData" :visible.sync="diaVisible" @moduleSubmit="moduleSubmit" />
  </div>
</template>

<script>
import mixins from '@/mixins/page'
import Modules from '@/const/modules'
export default {
  mixins: [mixins],
  data () {
    return {
      modules: Modules.research
    }
  },
  mounted () { },
  methods: {

  }
};
</script>

<style lang="scss" scoped>
@import "../../../styles/page/page.scss";

.area {
  display: flex;

  li {
    position: relative;
    width: 19%;
    height: 653px;
    color: #fff;
    background: url(../../../assets/images/research/res1.png) 0 0/100% 100% no-repeat;

    &: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: 443px;
  }

  .texts {
    width: 100%;
    height: 210px;
    padding: 20px 40px;
    background: #08577B;
  }

  h6 {
    font-size: 30px;
    white-space: nowrap;
  }

  .des {
    font-size: 22px;
    color: rgba(255, 255, 255, 0.55);
  }
}

.group {
  display: flex;
  flex-wrap: wrap;

  li {
    position: relative;
    width: 448px;
    margin: 0 28px 39px 0;

    &:nth-child(3n) {
      margin-right: 0;
    }
  }

  img {
    width: 100%;
    height: 353px;
  }

  .text {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 143px;
    padding: 0 30px;
    font-size: 30px;
    font-family: SFProDisplay-Bold, SFProDisplay;
    font-weight: bold;
    line-height: 40px;
    text-align: center;
    color: #272727;
    background-color: #F5F5F5;
  }
}

.news {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;

  li {
    position: relative;
    width: 448px;
    padding: 11px;
    margin-right: 28px;
    color: #333;
    background-color: #fff;
    box-shadow: 0px 5px 20px 0px rgba(98, 117, 163, 0.08);
    border-radius: 10px;

    &:nth-child(3n) {
      margin-right: 0;
    }

    &:hover {
      color: #fff;
      background-color: #0252D9;
    }
  }

  img {
    width: 427px;
    height: 481px;
  }

  .texts {
    padding: 0 18px 50px;
  }

  h6 {
    margin: 35px 0 12px;
    font-size: 24px;
    line-height: 33px;
  }

  .des {
    font-size: 18px;
    line-height: 26px;
  }
}
</style>