<template>
  <div id="jobinfoInfo">
    <el-row>
      <el-col :span="24">
        <el-breadcrumb separator-class="el-icon-arrow-right">
          <el-breadcrumb-item :to="{ path: '/' }"
            ><i class="el-icon-s-home"></i>
            <span>网站首页</span>
          </el-breadcrumb-item>
          <el-breadcrumb-item><span>招聘信息详情</span></el-breadcrumb-item>
        </el-breadcrumb>
      </el-col>
      <el-col :span="24" class="title">
        <p>{{ jobinfoInfo.title }}</p>
      </el-col>
      <el-col :span="24" class="date"> 发布时间：{{ jobinfoInfo | getDate }} </el-col>
      <el-col :span="24" class="content">
        <p v-html="jobinfoInfo.content"></p>
      </el-col>
      <el-col :span="24" class="zhiwei">
        <h3 style="border-left:5px solid #0457c7;padding:0 10px;">招聘职位</h3>
        <el-col :span="24">
          <el-row class="rowStyle" v-for="(item, index) in jobslist" :key="index" :gutter="10">
            <el-col :span="16">
              <el-link class="job__name" :underline="false" @click="turnToJobs(item.id)">
                <span title="查看职位">{{ item.job_name ? item.job_name : '' }}</span>
              </el-link>
            </el-col>
            <el-col class="money" :span="4">
              {{ item.salary ? item.salary.text : '' }}
            </el-col>
            <el-col :span="4" style="text-align:center;"> 招聘人数：{{ item.job_number }} </el-col>
            <el-col :span="16"> 招聘专业 : {{ item.zy_req ? item.zy_req : '' }} </el-col>
            <el-col :span="8"> {{ item.xl_req ? item.xl_req : '' }} | {{ item.city ? item.city : '' }} </el-col>
          </el-row>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import _ from 'lodash';
export default {
  name: 'jobinfoInfo',
  props: {
    jobinfoInfo: null,
    jobslist: null,
  },
  components: {},
  data: () => ({}),
  created() {},
  computed: {},
  methods: {
    turnToJobs(id) {
      let query = {};
      if (this.origin) query.origin = this.origin;
      if (this.type) query.type = this.type;
      query.id = id;
      this.$router.push({ path: '/jobsDetail', query: query });
    },
  },
  filters: {
    getDate(data) {
      let date = _.get(data, `meta.createdAt`);
      if (date) date = new Date(date).toLocaleDateString();
      else date = '';
      return date;
    },
  },
};
</script>

<style lang="less" scoped>
p {
  padding: 0;
  margin: 0;
}
.title {
  color: #333;
  font-size: 18px;
  font-weight: 900;
  padding: 10px 5px;
}
.date {
  font-size: 16px;
  padding: 5px 0 10px 5px;
  border-bottom: 1px dashed #ccc;
}
.content {
  padding: 10px 0;
}
/deep/.content p p {
  font-size: 16px;
  text-indent: 2rem;
}
.rowStyle {
  padding: 10px;
  border-bottom: 1px dashed #ccc;
}
</style>
