<!--
 * @Author: wally
 * @email: 18603454788@163.com
 * @Date: 2021-01-13 18:36:52
 * @LastEditors: wally
 * @LastEditTime: 2021-01-13 18:39:16
-->
<template>
  <div>
    <div class="partner-title-box">
      <p class="title-ch">合作伙伴</p>
      <p class="title-en">Partners</p>
    </div>
    <div v-if="partners && partners.length > 0">
      <div :key="index" v-for="(item,index) in partners">
        <div
          class="partner-content-box d-flex flex-wrap"
          v-if="item.backendSearchList && item.backendSearchList.length > 0"
        >
          <div
            :class="(i + 1) % 4 === 0 ? 'mr0' : ''"
            :key="i"
            class="item-box"
            v-for="(list,i) in item.backendSearchList"
          >
            <img :src="list.logoUrl" class="fill-height" v-if="list.logoUrl" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions } from 'vuex';

export default {
  name: 'Pter',
  props: {
    title: {
      type: String,
      default: '',
    },
    typeOfPlatform: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      lists: [],
    };
  },

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

  async created() {
    this.setPartners([]);
    const { title, typeOfPlatform } = this;
    console.log('title, typeOfPlatform : ', title, typeOfPlatform);
    const params = {
      param: {
        pageNum: 1,
        // pageSize: -1,
        type: title === '中心介绍' ? 0 : title === '合作伙伴' ? 1 : 2,
        typeOfPlatform: typeOfPlatform === '研究院' ? 0 : typeOfPlatform === '孵化平台' ? 1 : 2,
      },
    };
    console.log('params: ', params);
    await this.getFrontSearchCompany(params);
  },

  methods: {
    ...mapMutations('home', ['setPartners', 'setProfile']),
    ...mapActions('home', ['getFrontSearchCompany']),
  },
};
</script>

<style lang="stylus" scoped>
.partner-title-box {
  height: 70px;
  line-height: 34px;
  margin: 30px 0 30px 20px;
  padding-left: 6px;
  border-left: 6px solid #007CC1;
}

.item-box {
  width: 20.5%;
  margin-right: 6%;
  background: #fff;
  height: 70px;
  text-align: center;
  margin-bottom: 40px;
  border: 1px solid #eee;
}

.partner-content-box {
  margin: 20px 0 20px 20px;
}
</style>
