<template>
  <div>
    <rotation />
    <h-nav />
    <div class="inner">
      <bread-crumb :arr="arr" />
    </div>
    <div class="flow-path">
      <div class="flow-title">服务流程</div>
      <div class="flow-content">
        您 <span class="login-color">注册、登录</span> 后通过直接申请或加入购物车进行申请服务， 直接申请后在个人中心查看， 加入
        <span class="login-color">购物车</span> 后可通过顶部菜单栏的购物车查看。
      </div>
    </div>
    <div class="inner d-flex flex-wrap" style="margin: 60px auto">
      <div v-for="(item, index) in list" :key="index" class="item-box" :class="(index + 1) % 3 === 0 ? 'margin-0' : ''">
        <img :src="item.picUrl" style="height: 220px; width: 100%; border: 1px solid #ccc" />
        <p class="font-24 item-title">{{ item.name }}</p>
        <p class="font-24 my-4 item-content">{{ item.intro }}</p>
        <p class="font-16 baseColor" style="text-align: right; cursor: pointer" @click="jump(item.id)">了解更多→</p>
      </div>
    </div>
  </div>
</template>

<script>
import { selService } from 'config/api';
import BreadCrumb from 'components/BreadCrumb/BreadCrumb.vue';
import Rotation from 'components/Rotation/Rotation.vue';
import HNav from './components/HNav.vue';
export default {
  name: 'Serve',
  components: { HNav, Rotation, BreadCrumb },
  data() {
    return {
      title: '产业服务',
      typeOfPlatform: '产业平台',
      arr: [
        { name: '产业平台', url: '/Challenge/Union' },
        { name: '产业服务', url: '' },
      ],
      list: [],
      current: 1,
      pageSize: 8,
      total: 0,
    };
  },
  created() {
    this.getService();
  },
  methods: {
    // 获取服务列表
    async getService() {
      try {
        const params = { param: {} };
        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.$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-title {
  position: absolute;
  top: 100px;
  width: 100%;
  text-align: center;
}

.item-content {
  font-size: 16px;
  color: rgba(0, 0, 0, 0.65);
}
</style>
