<template>
  <div>
    <h-nav />
    <div class="inner my-1">
      <bread-crumb :arr="arr" />
    </div>
    <banner :show-page="showPage" />
    <div class="flow-path">
      <div class="flow-title">服务流程</div>
      <div class="flow-content">
        <img src="~assets/image.png" style="width:100%" />
      </div>
    </div>
    <div class="inner d-flex flex-wrap" style="margin: 60px auto">
      <div
        :class="(index + 1) % 3 === 0 ? 'margin-0' : ''"
        :key="index"
        class="item-box mb-8"
        v-for="(item, index) in list"
      >
        <img :src="item.picUrl" style="height: 220px; width: 100%; border: 1px solid #ccc" />
        <p class="font-24 my-4">{{ item.name }}</p>
        <p class="font-16 my-4 textColor line-height-30 item-content">{{ item.intro }}</p>
        <p
          @click="jump(item.id)"
          class="font-16 baseColor"
          style="text-align: right; cursor: pointer"
        >了解更多→</p>
      </div>
    </div>
  </div>
</template>

<script>
import { mapMutations } from 'vuex';
import { selService } from 'config/api';
import BreadCrumb from 'components/BreadCrumb/BreadCrumb.vue';
import Banner from 'components/Banner/Banner.vue';
import HNav from './components/HNav.vue';
export default {
  name: 'Serve',
  components: { HNav, Banner, BreadCrumb },
  data() {
    return {
      title: '产业服务',
      typeOfPlatform: '产业平台',
      arr: [
        { name: '产业平台', url: '/Challenge/Union' },
        { name: '产业服务', url: '/Industry/Serve' },
      ],
      showPage: 52,
      list: [],
      current: 1,
      pageSize: 8,
      total: 0,
    };
  },
  created() {
    this.getService();
  },
  methods: {
    ...mapMutations('home', ['setServiceArr']),
    // 获取服务列表
    async getService() {
      try {
        const params = { param: { serviceType: 3 } };
        const res = await selService(params);
        const { code, data, msg } = res.data;
        if (code === 200) {
          this.list = data;
        }
      } catch (error) {
        console.log(data);
      }
    },
    // 查看 服务 详情
    jump(id) {
      this.setServiceArr([]);
      this.setServiceArr(this.arr);
      this.$router.push({
        path: '/NewPlatform/ServiceDet',
        name: 'ServiceDet',
        params: { id },
      });
    },
  },
};
</script>

<style lang="stylus" scoped>
.inner {
  margin: 10px auto 15px;
}

.pagination {
  margin: 40px 0;
  text-align: right;
}

.item-box {
  position: relative;
  width: 26%;
  margin-right: 11%;
  border-radius: 4px;
}

.margin-0 {
  margin-right: 0 !important;
}

.item-content {
  display: -webkit-box;
  overflow: hidden;
  white-space: normal !important;
  text-overflow: ellipsis;
  word-wrap: break-word;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  height: 60px;
}
</style>
