<!--
 * @Description: 我的投递
 * @Author: 空白格
 * @Date: 2022-08-24 09:40:33
 * @LastEditors: 空白格
 * @LastEditTime: 2022-08-29 17:29:40
 * @FilePath: \veterans_client_web\src\views\PersonalCenter\Deliver\DeliverIndex.vue
 * @Copyright: Copyright (c) 2016~2022 by 空白格, All Rights Reserved.
-->
<template>
  <div>
    <banner title="我的投递" :breadcrumb="true" :isRouter="true"></banner>
    <div class="deliverBox">
      <div class="_container">
        <div class="box-list">
          <h1>全部投递</h1>
          <div style="display: table" v-if="deliverList.length">
            <div
              class="deliver"
              v-for="(item, index) in deliverList"
              :key="index"
              @click="detail(item)"
            >
              <div class="log">
                <img :src="item.companyLogoUrl" alt />
              </div>
              <div class="center">
                <h3>{{ item.postName }}</h3>
                <p>
                  <span class="meta_cell">{{ item.provinceName }}</span>
                  <span class="meta_cell" v-if="item.workYear == 0"
                    >经验不限</span
                  >
                  <span class="meta_cell" v-if="item.workYear == 1">1~3年</span>
                  <span class="meta_cell" v-if="item.workYear == 2"
                    >3年以上</span
                  >
                  <span class="meta_cell" v-if="item.workYear == 3"
                    >5年以上</span
                  >
                  <span class="meta_cell" v-if="item.educationBg == 1"
                    >小学</span
                  >
                  <span class="meta_cell" v-if="item.educationBg == 2"
                    >初中</span
                  >
                  <span class="meta_cell" v-if="item.educationBg == 3"
                    >中专</span
                  >
                  <span class="meta_cell" v-if="item.educationBg == 4"
                    >高中</span
                  >
                  <span class="meta_cell" v-if="item.educationBg == 5"
                    >大专</span
                  >
                  <span class="meta_cell" v-if="item.educationBg == 6"
                    >本科</span
                  >
                  <span class="meta_cell" v-if="item.educationBg == 7"
                    >硕士</span
                  >
                  <span class="meta_cell" v-if="item.educationBg == 8"
                    >博士</span
                  >
                </p>
                <p>{{ item.companyName }}</p>
              </div>
              <div class="right-box">
                <span class="pir" v-if="item.postStatus == 1"
                  >{{ item.lowestSalary }}K-{{ item.highestSalary }}K</span
                >
                <span class="postStatus" v-if="item.postStatus == 0"
                  >职位已下架</span
                >
                <span class="time">{{ item.createTime.slice(0, 10) }}</span>
              </div>
            </div>
          </div>
          <el-empty description="列表数据为空" v-else></el-empty>
          <div class="pagination" v-if="total && deliverList.length">
            <el-pagination
              background
              layout="prev, pager, next"
              :page-size="queryParams.pageSize"
              :total="total"
              @current-change="currentChange"
            />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import banner from "@/components/BannerBreadcrumb/index.vue";
import { myDeliveredList } from "@/api/PersonalCenter/index";
export default {
  name: "DeliverIndex",
  components: { banner },
  data() {
    return {
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        schoolName: undefined,
      },
      total: 0,
      loading: false,
      deliverList: [],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /**
     * 分页切换触发
     * @date 2022-08-16
     * @param {any} page
     * @returns {any}
     */
    currentChange(page) {
      this.queryParams.pageNum = page;
      this.getList();
    },
    /**
     * 获取列表
     * @date 2022-08-11
     * @returns {any}
     */
    getList() {
      this.loading = true;
      myDeliveredList(this.queryParams).then((res) => {
        this.deliverList = res.rows;
        this.total = Number(res.total);
        this.loading = false;
      });
    },
    detail(item) {
      this.$router.push({
        name: "EnterprisePositionIndex",
        query: { positionId: item.id },
      });
    },
  },
};
</script>

<style lang="scss" scoped>
._container {
  width: 70%;
  min-width: 600px;
  margin: 0 auto;
  padding: 0 15px;
}
._container:after,
._container:before {
  display: table;
  content: " ";
  clear: both;
}
.breadcrumb {
  background-color: #f5f7fa;
  height: 70px;
  display: flex;
  align-items: center;
}
.banner-breadcrumb-breadcrumb {
  .el-breadcrumb {
    font-size: 18px;
  }
  :deep(.el-breadcrumb__inner.is-link) {
    color: #7e7e7e;
    font-weight: normal;
  }
  :deep(.el-breadcrumb__item:last-child .el-breadcrumb__inner) {
    color: #ff0000;
  }
}
.box-list {
  background-color: #fff;
  padding: 10px 0 80px 0;
  display: table;
  width: 100%;
  h1 {
    color: #222222;
    font-size: 18px;
    margin: 19px 20px;
  }
  .deliver:hover {
    box-shadow: 0 1px 10px 0 rgba(0, 0, 0, 0.11);
  }
  .deliver {
    cursor: pointer;
    width: 532px;
    height: 93px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.11);
    transition: 0.5s;
    border-radius: 3px;
    margin: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    float: left;
    .log {
      width: 60px;
      height: 60px;
      background: #ffffff;
      border: 1px solid #e2e2e2;
      border-radius: 4px;
      overflow: hidden;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .center {
      width: 340px;
      h3 {
        color: #1a1a1a;
        margin-bottom: 10px;
        font-size: 20px;
        font-family: "SourceHanSansCN";
      }
      p {
        color: #666666;
        font-size: 14px;
        line-height: 20px;
        .meta_cell {
          display: inline-block;
          margin-right: 5px;
        }
        .meta_cell:after {
          padding: 0 1px 0 4px;
          display: inline-block;
          color: #919090;
          content: "|";
        }
        .meta_cell:last-child:after {
          content: "";
        }
      }
    }
    .right-box {
      display: flex;
      flex-direction: column;
      justify-content: right;
      span {
        text-align: right;
      }
      .pir {
        color: #ef651f;
        font-size: 20px;
      }
      .time {
        color: #999999;
        font-size: 14px;
      }
      .postStatus {
        line-height: 40px;
        color: #0f0f0f;
      }
    }
  }
}
.pagination {
  text-align: center;
  margin-top: 20px;
  :deep(.el-pager .active) {
    background-color: #ff3939;
  }
  :deep(.el-pagination.is-background .el-pager li:not(.disabled).active) {
    background-color: #ff3939;
  }
}
</style>
