web-jobs.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div id="web-jobs">
  3. <el-row>
  4. <el-col :span="24" class="webMessage" v-if="title">
  5. {{ title }}
  6. </el-col>
  7. </el-row>
  8. <span v-if="list.length > 0">
  9. <el-row class="rowStyle" v-for="(item, index) in list" :key="index" :gutter="10">
  10. <el-col :span="16">
  11. <el-link class="job__name" :underline="false" @click="turnToJobs(item.id)">
  12. <span title="查看职位">{{ item.job_name ? item.job_name : '' }}</span>
  13. </el-link>
  14. </el-col>
  15. <el-col class="money" :span="4">
  16. {{ item.salary ? item.salary.text : '' }}
  17. </el-col>
  18. <el-col :span="4" style="text-align:center;">
  19. {{ item.job_number | jobNum }}
  20. </el-col>
  21. <el-col :span="16"> 招聘专业 : {{ item.zy_req ? item.zy_req : '' }} </el-col>
  22. <el-col :span="8"> {{ item.xl_req ? item.xl_req : '' }} | {{ item.city ? item.city : '' }} </el-col>
  23. </el-row>
  24. <el-row v-if="!type">
  25. <el-col :span="24" style="text-align:center">
  26. <el-pagination @current-change="search" :current-page="currentPage" :page-size="$limit" layout="slot, total, prev, pager, next" :total="totalRow">
  27. <span style="font-size:13px;margin-right: 10px;font-weight: 400;color: #606266;">共 {{ Math.ceil(totalRow / $limit) }} 页</span>
  28. </el-pagination>
  29. </el-col>
  30. </el-row>
  31. </span>
  32. </div>
  33. </template>
  34. <script>
  35. import _ from 'lodash';
  36. export default {
  37. name: 'web-jobs',
  38. props: {
  39. title: null,
  40. info: null,
  41. type: null,
  42. origin: null,
  43. },
  44. data: () => ({
  45. list: {},
  46. currentPage: 1,
  47. totalRow: 0,
  48. }),
  49. created() {
  50. if (!this.type) this.search();
  51. },
  52. watch: {
  53. info: {
  54. handler(val) {
  55. if (!this.type) this.dataPro();
  56. else this.$set(this, `list`, this.info);
  57. },
  58. },
  59. },
  60. methods: {
  61. turnToJobs(id) {
  62. let query = {};
  63. if (this.origin) query.origin = this.origin;
  64. if (this.type) query.type = this.type;
  65. query.id = id;
  66. this.$router.push({ path: '/jobs/detail', query: query });
  67. },
  68. search(page) {
  69. let skip = 0;
  70. if (page) {
  71. skip = (page - 1) * this.$limit;
  72. }
  73. let query = { skip: skip, limit: this.$limit };
  74. this.$emit('search', query);
  75. },
  76. dataPro() {
  77. this.$set(this, `totalRow`, this.info.total);
  78. this.$set(this, `list`, this.info.data);
  79. },
  80. },
  81. filters: {
  82. jobNum(num) {
  83. if (!num) return '';
  84. num = num.includes('人') ? num : `${num}人`;
  85. return num;
  86. },
  87. },
  88. };
  89. </script>
  90. <style lang="less" scoped>
  91. .webMessage {
  92. border-left: 3px solid #850000;
  93. font-size: 16px;
  94. line-height: 30px;
  95. height: 30px;
  96. padding: 0 15px;
  97. margin: 0 0 0 -15px;
  98. }
  99. .rowStyle {
  100. border-bottom: 1px dashed #ddd;
  101. padding: 1rem 1.5rem;
  102. .el-col {
  103. font-size: 0.9rem;
  104. line-height: 2rem;
  105. }
  106. .job__name {
  107. font-size: 1rem;
  108. color: #850000;
  109. }
  110. .money {
  111. color: #ff9900;
  112. }
  113. }
  114. </style>