list.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="main">
  3. <!--搜索-->
  4. <view class="search">
  5. <u-search placeholder="企业名称" bgColor="white" :showAction="false"></u-search>
  6. </view>
  7. <!--找工作-->
  8. <view class="tab">
  9. <u-tabs :list="tab"></u-tabs>
  10. </view>
  11. <view class="jobs">
  12. <view class="part_time" v-for="(item, index) in list" :key="index" @click="detail()">
  13. <view class="title omit">{{ item.title }}</view>
  14. <view class="price">{{ item.price }}元/天</view>
  15. <text class="date">4.16-4.17</text>
  16. <view class="address">
  17. <text @click.stop="company()">{{ item.name }}</text>
  18. <text class="add">申请</text>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. tab: [
  29. { name: '最新', value: 0 },
  30. { name: '附近', value: 1 }
  31. ],
  32. list: [],
  33. param: { pageNum: 1, pageSize: 10, type: 0 },
  34. loadMore: true
  35. };
  36. },
  37. onLoad(e) {
  38. this.getData();
  39. },
  40. methods: {
  41. getData() {
  42. this.http.request({
  43. url: '/app/position/list',
  44. data: this.param,
  45. loading: 'false',
  46. success: (res) => {
  47. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  48. this.list.push(...res.data.rows);
  49. }
  50. });
  51. },
  52. click(e, tag) {
  53. this.param[tag] = this[tag][e.index].value;
  54. if (tag == 'audit') {
  55. this.current = e.index;
  56. }
  57. this.refresh();
  58. },
  59. selectClick(e) {
  60. uni.navigateTo({ url: '/pages/job/position/manage/push?type=' + e.value });
  61. },
  62. detail(item) {
  63. uni.navigateTo({ url: '/pages/job/position/manage/push?id=' + item.id });
  64. },
  65. //刷新数据
  66. refresh() {
  67. this.loadMore = true;
  68. this.param.pageNum = 1;
  69. this.list = [];
  70. this.getData();
  71. }
  72. },
  73. //下拉刷新
  74. onPullDownRefresh() {
  75. setTimeout(() => {
  76. this.refresh();
  77. uni.stopPullDownRefresh();
  78. }, 1000);
  79. },
  80. //上拉加载
  81. onReachBottom() {
  82. if (this.loadMore) {
  83. this.param.pageNum++;
  84. this.getData();
  85. }
  86. }
  87. };
  88. </script>
  89. <style lang="scss">
  90. .jobs {
  91. margin-top: 0px;
  92. }
  93. </style>