<template>
  <div id="list">
    <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="4" style="margin-top: 1rem;">
        <el-select size="mini" v-model="searchInfo.is_practice" placeholder="选择招聘类型" @change="search()">
          <el-option label="全部类型" :value="undefined"></el-option>
          <el-option label="全职" :value="0"></el-option>
          <el-option label="实习" :value="1"></el-option>
        </el-select>
      </el-col>
      <el-col :span="10" style="margin-top: 1rem;">
        <el-input size="mini" placeholder="请输入企业名称" v-model="searchInfo.corpname" @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" type="flex" justify="start">
        <el-row>
          <el-col :span="20">
            <el-link style="color:#850000 " @click="$router.push({ path: '/jobinfo/detail', query: { id: item.id } })">
              <!-- 学大教育集团（长春分公司）招聘简章 -->{{ item.title }}
            </el-link>
          </el-col>
          <!-- <el-col :span="4" prop="">
            <span style="color:#606266;">2019-06-17 09:30</span>
          </el-col> -->
        </el-row>
        <el-row>
          <!-- <span style="color:#606266">{{ item.content }}</span> -->
        </el-row>
        <el-row prop="title">
          <span style="color:#606266">招聘类型:{{ `${item.is_practice}` === `0` ? '全职' : '实习' }}</span>
        </el-row>
        <!-- <el-row style="color:#606266">
          <el-col :span="22" prop=""><span>参与企业25家</span></el-col>
          <el-col :span="2" prop=""><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: 'list',
  props: {},
  components: {},
  data: () => ({
    searchInfo: {},
    squareUrl: '',
    currentPage: 1,
    totalRow: 0,
    list: [],
  }),
  created() {
    this.search();
  },
  computed: {},
  methods: {
    ...mapActions(['jobinfoOperation']),
    async search(page) {
      let skip = 0;
      if (page) {
        skip = (page - 1) * this.$limit;
      }
      let newData = { skip: skip, limit: this.$limit, ...this.searchInfo };
      let result = await this.jobinfoOperation({ 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>
