index.html 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. {extend name="public/base"/}
  2. {block name="css"}
  3. <style>
  4. </style>
  5. {/block}
  6. {block name="body"}
  7. <van-nav-bar
  8. class="bg-blue"
  9. fixed="true"
  10. >
  11. <template #title>
  12. <span class="text-white">招聘</span>
  13. </template>
  14. </van-nav-bar>
  15. <div style="position: fixed;top: 46px;width: 100%;z-index: 100;background:white;box-sizing:border-box;">
  16. <van-search v-model="form.searchval" @search="onSearch" placeholder="请输入岗位名称"></van-search>
  17. </div>
  18. <!--筛选-->
  19. <van-dropdown-menu style="position: fixed;top: 102px;width: 100%;z-index: 100;">
  20. <van-dropdown-item v-model="form.type" :options="type_option" @change="onTypeChange"></van-dropdown-item>
  21. <van-dropdown-item v-model="form.cateid" :options="cate_option" @change="onCateChange"></van-dropdown-item>
  22. </van-dropdown-menu>
  23. <div style="width:100%;height:150px;"></div>
  24. <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
  25. <van-list
  26. v-model="loading"
  27. :finished="finished"
  28. finished-text="没有更多了"
  29. @load="onLoad"
  30. >
  31. <div class="job-box">
  32. <div class="job-item" v-for="item in list" @click="goDetail(item.id)">
  33. <div class="job-flex">
  34. <div class="job-flex-left job-title">{{item.title}}</div>
  35. <div class="job-flex-right salary">{{item.zwagall}}({{item.wtype_text}})</div>
  36. </div>
  37. <div class="job-flex margin-top-10">
  38. <div class="job-flex-left">
  39. <van-tag type="primary" color="#FF589B" size="medium" v-for="tag in item.tags">{{tag}}</van-tag>
  40. </div>
  41. <div class="job-flex-right num">{{item.recruit_num}}名</div>
  42. </div>
  43. <div class="job-flex margin-top-10">
  44. <div class="job-flex-left">
  45. {{item.worker.title}}
  46. </div>
  47. <div class="job-flex-right">
  48. 浏览量:{{item.volume}}
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </van-list>
  54. </van-pull-refresh>
  55. <div style="width:100%;height:50px;"></div>
  56. <van-tabbar v-model="active" active-color="#FF589B" @change="onTabChange">
  57. <van-tabbar-item icon="wap-home-o">首页</van-tabbar-item>
  58. <van-tabbar-item icon="description">招聘</van-tabbar-item>
  59. <van-tabbar-item icon="user-circle-o">我的</van-tabbar-item>
  60. </van-tabbar>
  61. {/block}
  62. {block name="script"}
  63. <script>
  64. new Vue({
  65. el: '#app',
  66. data() {
  67. return {
  68. active: 1,
  69. value: '',
  70. list: [],
  71. type_option: [
  72. {text: '不限类型', value: 0},
  73. {text: '按月', value: 1},
  74. {text: '按时', value: 2},
  75. {text: '按件', value: 3},
  76. {text: '按项目', value: 4},
  77. {text: '其他', value: 5},
  78. ],
  79. cate_option: {$catelist},
  80. form: {
  81. searchval: '',
  82. type: {$type},
  83. cateid: 0,
  84. },
  85. page: 1,
  86. loading: false,
  87. finished: false,
  88. refreshing: false,
  89. };
  90. },
  91. created() {
  92. },
  93. methods: {
  94. onSearch(value) {
  95. this.form.searchval = value;
  96. this.onRefresh();
  97. },
  98. onTypeChange(value) {
  99. this.form.type = value;
  100. this.onRefresh();
  101. },
  102. onCateChange(value) {
  103. this.form.cateid = value;
  104. this.onRefresh();
  105. },
  106. onTabChange(index) {
  107. const url = ["{:url('/')}", "{:url('/jobs/index')}", "{:url('/my/index')}"];
  108. location.href = url[index];
  109. },
  110. goDetail(id) {
  111. location.href = "{:url('/jobs/detail')}?id=" + id;
  112. },
  113. //加载
  114. onLoad() {
  115. //参数
  116. let self = this;
  117. let param = this.form;
  118. param.page = this.page;
  119. this.page++;
  120. $.post("{:url('/jobs/listJobs')}", this.form, function (json) {
  121. //下拉刷新
  122. if (self.refreshing) {
  123. self.refreshing = false;
  124. }
  125. // 加载状态结束
  126. self.loading = false;
  127. if (json.data.length == 0) {
  128. // 数据全部加载完成
  129. self.finished = true;
  130. } else {
  131. // 增加数据
  132. for (let i = 0; i < json.data.length; i++) {
  133. self.list.push(json.data[i]);
  134. }
  135. }
  136. }, 'json');
  137. },
  138. onRefresh() {
  139. // 清空列表数据
  140. this.list = [];
  141. this.page = 1;
  142. this.loading = true;
  143. this.finished = false;
  144. this.onLoad();
  145. },
  146. },
  147. });
  148. </script>
  149. {/block}