<template>
  <div>
    <div class="nav-box d-flex">
      <div :class="activeNum === 0 ? 'nav-box-active' : ''" @click="jump(0)"><a href="#about">关于我们</a></div>
      <div :class="activeNum === 1 ? 'nav-box-active' : ''" @click="jump(1)"><a href="#organize">组织架构</a></div>
      <div :class="activeNum === 2 ? 'nav-box-active' : ''" @click="jump(2)"><a href="#partner">合作伙伴</a></div>
      <div :class="activeNum === 3 ? 'nav-box-active' : ''" @click="jump(3)"><a href="#contact">加入我们</a></div>
    </div>

    <a name="about" id="about" class="place"></a>
    <div class="banner-box">
      <a-carousel :autoplay-speed="time" autoplay>
        <div class="img-box">
          <img src="~assets/banner/banner1.png" />
        </div>
        <div class="img-box">
          <img src="~assets/banner/banner2.png" />
        </div>
        <div class="img-box">
          <img src="~assets/banner/banner3.png" />
        </div>
      </a-carousel>

      <!-- 文字内容 -->
      <div class="banner-con">
        <h1 class="about-title">关于我们</h1>
        <div class="about-font">
          山西绿谷生物科技有限公司由山西智汇协同创新研究院有限公司、山西省生物研究院有限公司、天娇红农业科技有限公司、
          微动互联（北京）科技有限公司和山西力德福科技有限公司共同出资组建。公司立足功能食品、生物医药和数字健康产业，聚焦创新、聚力孵化、聚合产业，致力构建全链条一体化、线上线下一体化开放式创新创业平台，培育打造新型创新创业综合体，促进特色新兴产业集群化发展
        </div>
        <!-- <model /> -->
      </div>
    </div>

    <!-- 组织架构 -->
    <a name="organize" id="organize" class="place"></a>
    <div class="organize-box bg-gray text-center">
      <div class="title w-1400"><img src="~assets/about/title1.jpg" /></div>
      <!-- <div class="w-1400"><img src="~assets/about/organize.jpg" /></div> -->
      <div class="w-1400">
        <ul>
          <li v-for="list in contents" :key="list.id">
            <div class="organize-title">{{ list.title }}</div>
            <div class="organize-con">{{ list.con }}</div>
            <div class="organize-phone">
              {{ list.name }}：{{ list.phone }}
            </div>
          </li>
        </ul>
      </div>
    </div>

    <!-- 合作伙伴 -->
    <a name="partner" id="partner" class="place"></a>
    <div class="partner-box text-center">
      <div class="title w-1400"><img src="~assets/about/title2.jpg" /></div>
      <div class="w-1200">
          <div class="partner-flex">
            <div class="partner-item" v-for="(item, index) in lists" :key="index">
              <div class="partner-item-img">
                <img :src="item.logoUrl" />
              </div>
              <div class="partner-name">{{ item.name }}</div>
            </div>
          </div>
      </div>
    </div>

    <!-- 加入我们 -->
    <a name="contact" id="contact" class="place"></a>
    <div class="contact-box bg-gray text-center">
      <div class="title w-1400">
        <img src="~assets/about/title3.jpg" />
        <model class="mt-8" />
      </div>

      <div class="w-1400" style="text-align: left">
        <rich-text :title="title" />
        <contact />
      </div>
    </div>
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions } from 'vuex';
// import HNav from './components/HNav.vue';
import Contact from 'components/Introduce/ContactUs.vue';
import Model from 'components/Introduce/Model.vue';
import RichText from 'components/Introduce/RichText.vue';

export default {
  name: 'About',
  components: { Contact, Model, RichText },

  data() {
    return {
      time: 10000,
      lists: [],
      activeNum: -1,
      contents: [
        { id: 1, title: '行政事业部', name: '武晟君', phone: '19935658780', con: '统筹行政办公、人力资源、财务管理、公共关系和数字平台建设等工作；组织编制发展战略和年度计划;组织开展绩效考评;协同推进创新、孵化和产业事业部联合协作及全链条一体化融通发展。'},
        { id: 2, title: '创新事业部', name: '冯经理', phone: '19935658759', con: '负责功能食品与生物医药协同创新中心的建设和运营，集聚整合股东及外部优势创新资源，着力打造产学研用协同、多学科交叉融合、覆盖全创新链的开放式协同创新平台，搭建专业化科技资源开放共享服务平台和技术转移转化平台，面向入孵企业及外部企业需求，组织开展技术研发、技术转化、技术咨询、技术评估、技术培训、检验检测等一站式创新服务。'},
        { id: 3, title: '孵化事业部', name: '乔晓阳', phone: '18635939333', con: '负责功能食品与生物医药专业化众创空间的建设和运营，构建众创空间一孵化器一加速器-产业园专业化创新创业孵化链，打造以公共研发与检验检测平台为支撑、以创新创业增值服务为主导、以创新创业学院(大讲堂)为带动、以创新创业投融资为拓展，线上线下相结合、实体虚拟相融合的全要素专业化开放式创新创业孵化平台，促进技术转移转化和科技型中小微企业集聚发展。'},
        { id: 4, title: '产业事业部', name: '乔晓阳', phone: '19935658759', con: '负责产业发展、市场开发和产业技术创新战略联盟的建设与运营，基于协同创新中心和专业化众创空间，发挥股东场所、技术、资本、市场、渠道和产业化优势，推动政产学研金介用合作，组织举办技术创新论坛，构建专业化、集群化、园区化产业发展布局，培育发展衍生企业，拓展发展领域和空间，打造产业园区和特色产业基地，推动大中小企业融通、产业集群化园区化发展。'},
      ],
      title: '联系我们',
    };
  },

  watch:{
    $route(to){
      if(to.hash){
        this.setJump(to.hash)
      }
    }
  },

  computed: mapState('home', ['partners']),

  async created() {
    this.setPartners([]);
    const params = {
      param: {
        pageNum: 1,
        type: 1,
        typeOfPlatform: 2,
      },
    };
    await this.getFrontSearchCompany(params);

    this.lists = [];
    let arr = [];
    this.partners.forEach(item => {
      item.backendSearchList.forEach(value => {
        arr.push(value);
      });
    });

    let len = Math.ceil(arr.length / 10);

    for (let j = 0; j < len; j++) {
      let arr_len = [];

      for (let i = 0; i < arr.length; i++) {
        if (Math.floor(i / 10) === j) {
          arr_len.push(arr[i]);
        }
      }

      arr_len.forEach((list) => {
        this.lists.push(list);
      })

      // this.lists.push(arr_len);
    }
  },

  mounted() {
    this.$nextTick(() => {
      if(this.$route.hash){
        this.setJump(this.$route.hash)
      }
    })
  },

  methods: {
    ...mapMutations('home', ['setPartners']),
    ...mapActions('home', ['getFrontSearchCompany']),

    jump(i) {
      this.activeNum = i;
    },

    setJump(hash){
      if(hash === '#organize'){
        this.$nextTick(() => {
          this.jump(1)
          document.getElementById('organize').scrollIntoView(true)
        })
      }
      if(hash === '#partner'){
        this.$nextTick(() => {
          this.jump(2)
          document.getElementById('partner').scrollIntoView(true)
        })
      }
      if(hash === '#contact'){
        this.$nextTick(() => {
          this.jump(3)
          document.getElementById('contact').scrollIntoView(true)
        })
      }
    }
  },
};
</script>

<style lang="stylus" scoped>
.bg-gray {
  background-color: #F5F5F5;
}

.w-1400 {
  // display: inline-block;
  // width: 1400px;
  width: 82%;
  margin: 0 auto;
}

.w-1200{
  width: 70%;
  margin: 0 auto;
}

.text-center {
  text-align: center;
}

.nav-box {
  position: fixed;
  top: 70px;
  width: 100%;
  z-index: 99;

  a {
    color: unset;
  }
}

.img-box {
  // height: 380px;
  width: 100%;

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

.banner-box {
  position: relative;

  .banner-con {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 1200px;

    .about-title {
      color: white;
      font-size: 80px;
      font-weight: 600;
    }

    .about-font {
      color: white;
      font-size: 20px;
      line-height: 40px;
      text-align: left;
      text-indent: 2em;
    }
  }
}

.organize-box {
  padding: 30px 0;

  .title {
    margin-bottom: 50px;
    text-align: left;
  }

  ul{
    margin 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;

    li{
      list-style: none;
      background: rgba(19,172,196,0.8);
      width: 49%;
      margin-right: 2%;
      padding: 26px 26px 50px;
      margin-bottom: 30px;
      text-align: left;
      position: relative;
      color: #fff;

      .organize-title{
        font-weight: bold;
        font-size: 24px;
        margin-bottom: 12px
      }

      .organize-con{
        // line-height: 30px;
      }

      .organize-phone{
        position: absolute;
        bottom: 16px;
        right: 46px;
        text-align: right;
      }
    }

    li:nth-child(even) {
      margin-right: 0;
    }
  }

}

.partner-box {
  padding: 60px 0;

  .title {
    margin-bottom: 30px;
    text-align: left;
  }
}

.contact-box {
  padding: 60px 0;

  .title {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}

.place{
    display: inline-block;
    position: relative;
    top: -100px;
}
</style>
