<template>
  <div id="index">
    <el-row>
      <el-col :span="1"><i class="el-icon-s-home"></i></el-col>
      <el-col :span="23" style="margin-top:0.3rem">
        <el-breadcrumb separator=">">
          <el-breadcrumb-item :to="{ path: '/' }"><span style="color:#666666">网站首页</span></el-breadcrumb-item>
          <el-breadcrumb-item>
            <a href="/"><span style="color:#666666">招聘信息</span></a>
          </el-breadcrumb-item>
          <el-breadcrumb-item><span style="color:#999999">双选会</span></el-breadcrumb-item>
        </el-breadcrumb>
      </el-col>
    </el-row>
    <!-- 查询条件 -->
    <!-- <el-row>
      <el-col :span="24" style="margin-top: 1rem; width:50%">
        <el-input size="mini" placeholder="请输入双选会名称" v-model="input3" @keyup.enter.native="search()">
          <el-button slot="append" icon="el-icon-search" @click="search()"></el-button>
        </el-input>
      </el-col>
    </el-row> -->
    <el-row class="rowstyle" v-for="(item, index) in list" :key="index">
      <!-- <el-col :span="3">
        <div class="demo-basic--circle">
          <div class="block"><el-avatar shape="square" :size="75" :src="squareUrl"></el-avatar></div>
        </div>
      </el-col> -->
      <el-col :span="21">
        <el-row>
          <el-col :span="18">
            <el-link style="color:#850000 " @click="$router.push({ path: '/jobfair/detail', query: { id: item.id } })">
              {{ item.title }}
            </el-link>
          </el-col>
          <el-col :span="6" style="text-align:center">
            <span style="color:red;">{{ item.time }}</span>
          </el-col>
        </el-row>
        <el-row>
          <span style="color:#606266">{{ item.organizer }}</span>
        </el-row>
        <el-row>
          <span style="color:#606266">{{ item.address }}</span>
        </el-row>
        <!-- <el-row style="color:#606266">
          <el-col :span="20"><span>参与企业25家</span> </el-col>
          <el-col :span="4"><i class="el-icon-view">2980 </i></el-col>
        </el-row> -->
      </el-col>
    </el-row>
    <el-row style="margin-top:1rem;" type="flex" justify="end">
      <el-pagination @current-change="search" :current-page="currentPage" :page-size="$limit" layout="total, prev, pager, next, jumper" :total="totalRow">
      </el-pagination>
    </el-row>
  </div>
</template>

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

export default {
  name: 'JobfairIndex',
  props: {},
  components: {},
  data: () => ({
    searchInfo: {},
    squareUrl: '',
    currentPage: 1,
    list: [],
    totalRow: 0,
  }),
  created() {
    this.search();
  },
  mounted() {},
  computed: {
    type() {
      return this.$route.params.type;
    },
  },
  watch: {
    type: 'search',
  },
  methods: {
    ...mapActions(['jobfairOperation']),
    async search(page) {
      let skip = 0;
      if (page) {
        skip = (page - 1) * this.$limit;
      }
      let newData = { skip: skip, limit: this.$limit, ...this.searchInfo };
      this.type === 'in' ? (newData['schid'] = this.$site) : '';
      let result = await this.jobfairOperation({ type: 'list', data: newData });
      if (`${result.errcode}` === '0') {
        //给this=>vue的实例下在中的list属性，赋予result。data的值
        this.$set(this, 'list', result.data);
        this.$set(this, `totalRow`, result.total);
      } else {
        this.$message.error(result.errmsg ? result.errmsg : 'error');
      }
    },
  },
};
</script>

<style lang="less" scoped>
.rowstyle {
  border-bottom-style: solid;
  border-width: 1px;
  border-color: #ebeef5;
  font-size: small;
  padding: 1rem 0;
}
</style>
