<template>
  <div id="infomate">
    <el-row>
      <el-col :span="24" class="info">
        <el-col :span="24" class="top">
          资讯服务
        </el-col>
        <el-col :span="24" class="list">
          <ul>
            <li class="schoolList" v-for="(item, index) in list" :key="index">
              <el-col :span="24" class="image">
                <el-image style="width:219px;height:170px;" :src="url"></el-image>
              </el-col>
              <el-col :span="24" class="title textOver">
                {{ item.name }}
              </el-col>
              <el-col :span="12" class="yen textOver"> {{ item.messattribute }}</el-col>
              <el-col :span="12" class="type"> {{ item.type == '0' ? '技术' : item.ype == '1' ? '产品' : '服务' }}</el-col>
            </li>
          </ul>
          <el-col :span="24" class="page">
            <el-pagination
              @current-change="handleCurrentChange"
              :current-page="currentPage"
              layout="total, prev, pager, next, jumper"
              :total="serveTotal"
              :page-size="pageSize"
            >
            </el-pagination>
          </el-col>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import _ from 'lodash';
export default {
  name: 'infomate',
  props: {
    serveList: null,
    serveTotal: null,
  },
  components: {},
  data: () => ({
    currentPage: 1,
    pageSize: 10,
    origin: [],
    list: [],
    url: require('@a/fabu.jpg'),
  }),
  created() {},
  computed: {},
  methods: {
    search(page = 1) {
      this.$set(this, `list`, this.origin[page - 1]);
    },
    handleCurrentChange(currentPage) {
      this.search(currentPage);
    },
  },
  watch: {
    serveList: {
      immediate: true,
      deep: true,
      handler(val) {
        if (val && val.length > 0) this.$set(this, `origin`, _.chunk(val, this.pageSize));
        this.search();
      },
    },
  },
};
</script>

<style lang="less" scoped>
ul {
  padding: 0;
  margin: 0;
}
li {
  padding: 0;
  margin: 0;
  list-style: none;
}
p {
  padding: 0;
  margin: 0;
}
.info {
  padding: 0 20px 20px 20px;
}
.top {
  height: 50px;
  line-height: 50px;
  border-bottom: 1px dashed #ccc;
  color: #215299;
  font-size: 18px;
}
.list {
  margin: 20px 0 0 0;
}
.schoolList {
  float: left;
  width: 219px;
  height: 219px;
  margin: 0 10px 10px 0;
  border: 1px solid #ccc;
  background-color: #f3f3f3;
  overflow: hidden;
}
.schoolList:nth-child(4n) {
  width: 215px;
  margin: 0 0 10px 0;
}
.schoolList .image {
  height: 170px;
}
.schoolList .title {
  padding: 3px 10px;
  font-size: 14px;
  color: #63636d;
}
.schoolList .yen {
  font-size: 14px;
  padding: 0 0 0 10px;
  color: red;
}
.schoolList .type {
  font-size: 14px;
  text-align: right;
  padding: 0 10px 0 0;
  color: #63636d;
}
.page {
  padding: 34px 0;
  text-align: center;
}
</style>
