<template>
  <div>
    <h-nav />
    <div class="inner my-1">
      <bread-crumb :arr="arr" />
    </div>
    <div class="search-background">
      <div class="d-flex">
        <div class="flex-3 flex-wrap">
          <span class="ins-title">技术领域：</span>
          <span
            :class="item.isActive ? 'act-color' : ''"
            :key="index"
            @click="choose(index)"
            class="ins-name"
            v-for="(item, index) in list"
          >{{ item.name }}</span>
        </div>
      </div>
    </div>
    <div class="inner d-flex flex-wrap">
      <div
        :class="(index + 1) % 4 === 0 ? 'margin-0' : ''"
        :key="index"
        class="pro-box"
        v-for="(item, index) in lists"
      >
        <p class="pro-title">{{ item.title }}</p>
        <p class="pro-content">{{ item.content }}</p>
        <p class="pro-time">时间：{{ item.time }}</p>
      </div>
    </div>
    <div class="inner">
      <a-pagination
        :current="current"
        :page-size="pageSize"
        :total="total"
        @change="onShowSizeChange"
        class="pagination"
        show-less-items
        show-quick-jumper
        v-show="total > 8"
      />
    </div>
  </div>
</template>

<script>
import HNav from './../components/HNav.vue';
import BreadCrumb from 'components/BreadCrumb/BreadCrumb.vue';
export default {
  name: 'Release',
  components: { HNav, BreadCrumb },
  data() {
    return {
      str: '发布界面',
      title: '结果公告',
      typeOfPlatform: '创新挑战',
      arr: [
        { name: '创新挑战', url: '/Challenge/Solicitation' },
        { name: '结果公告', url: '' },
      ],
      current: 1,
      pageSize: 8,
      total: 10,
      list: [
        {
          id: 1,
          name: '功能食品',
          isActive: false,
        },
        {
          id: 2,
          name: '生物医药',
          isActive: false,
        },
        {
          id: 3,
          name: '大健康',
          isActive: false,
        },
      ],
      lists: [
        {
          title: '需求标题',
          content: 'XXX挑战成功',
          time: '2020-11-20',
        },
        {
          title: '需求标题',
          content: 'XXX挑战成功',
          time: '2020-11-20',
        },
        {
          title: '需求标题',
          content: 'XXX挑战成功',
          time: '2020-11-20',
        },
        {
          title: '需求标题',
          content: 'XXX挑战成功',
          time: '2020-11-20',
        },
        {
          title: '需求标题',
          content: 'XXX挑战成功',
          time: '2020-11-20',
        },
        {
          title: '需求标题',
          content: 'XXX挑战成功',
          time: '2020-11-20',
        },
        {
          title: '需求标题',
          content: 'XXX挑战成功',
          time: '2020-11-20',
        },
        {
          title: '需求标题',
          content: 'XXX挑战成功',
          time: '2020-11-20',
        },
      ],
    };
  },
  methods: {
    choose(index) {
      const that = this;
      // that.achList = [];
      const { list } = this;
      list[index].isActive = !list[index].isActive;
      this.list = [...list];
      // for (let i = 0; i < list.length; i++) {
      //   if (list[i].isActive) {
      //     this.achList.push(list[i].id);
      //   }
      // }
      // this.setAchList(this.achList);
    },
    // 改变单当前页数
    onShowSizeChange(current, size) {
      this.current = current;
    },
  },
};
</script>

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

.search-background {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.06);
  height: auto;
  padding: 0 20px;
  width: 82%;
  margin: 40px auto;
  line-height: 44px;
}

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

.ins-title {
  font-size: 16px;
  font-weight: bold;
  color: rgba(0, 0, 0, 0.65);
}

.ins-name {
  font-size: 16px;
  color: rgba(0, 0, 0, 0.65);
  padding: 0 10px;
  cursor: pointer;
}

.act-color {
  color: #13ACC4 !important;
}

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

.pro-box {
  width: 20.5%;
  margin-right: 6%;
  height: auto;
  background: #FFFFFF;
  padding: 24px 20px;
  box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
  position: relative;
  margin-bottom: 20px;
  opacity: 1;
}

.pro-title {
  font-size: 24px;
  font-family: Microsoft YaHei;
  font-weight: bold;
  line-height: 31px;
  color: rgba(0, 0, 0, 0.85);
  opacity: 1;
}

.pro-content {
  font-size: 30px;
  overflow: hidden;
  font-family: Microsoft YaHei;
  font-weight: bold;
  color: #13ACC4;
  margin-bottom: 60px;
  opacity: 1;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

.pro-time {
  position: absolute;
  font-size: 14px;
  font-family: Microsoft YaHei;
  font-weight: 400;
  line-height: 22px;
  color: rgba(0, 0, 0, 0.45);
  opacity: 1;
  bottom: 0;
}

.pro-btn {
  position: absolute;
  bottom: 24px;
  width: 100px;
}
</style>
