search.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view>
  3. <view class="cu-bar search">
  4. <view class="search-form round text-center">
  5. <text class="cuIcon-search"></text>
  6. <input @input="bindInput" :adjust-position="false" type="text" placeholder="搜索岗位或公司" confirm-type="search"></input>
  7. </view>
  8. <view class="action" v-if="searchval!==''">
  9. <button class="cu-btn bg-white shadow-blur round" @click="btnSearch()">搜索</button>
  10. </view>
  11. </view>
  12. <scroll-view scroll-x class="bg-white nav solid-bottom solid-bottom">
  13. <view class="flex text-center">
  14. <view class="cu-item flex-sub" :class="wtype==0?'text-blue cur':''" @tap="tabSelect" data-wtype="0">全部</view>
  15. <view class="cu-item flex-sub" :class="wtype==1?'text-blue cur':''" @tap="tabSelect" data-wtype="1">按月</view>
  16. <view class="cu-item flex-sub" :class="wtype==2?'text-blue cur':''" @tap="tabSelect" data-wtype="2">按时</view>
  17. <view class="cu-item flex-sub" :class="wtype==3?'text-blue cur':''" @tap="tabSelect" data-wtype="3">按件</view>
  18. <view class="cu-item flex-sub" :class="wtype==4?'text-blue cur':''" @tap="tabSelect" data-wtype="4">按项目</view>
  19. <view class="cu-item flex-sub" :class="wtype==5?'text-blue cur':''" @tap="tabSelect" data-wtype="5">其他</view>
  20. </view>
  21. </scroll-view>
  22. <block v-for="(item,index) in plist" :key="index">
  23. <view class="cu-card dynamic no-card solid-bottom echo-comjobs-item padding-top-sm padding-lr-sm radius">
  24. <view class="cu-item shadow padding-top-sm padding-bottom" @tap="goDetail(item.id)">
  25. <view class="padding-lr flex justify-between align-center">
  26. <view class="basis-lg text-bold text-df text-cut">{{item.title}}</view>
  27. <view class="basis-sm text-cut text-right text-gray text-sm">
  28. <view v-if="item.wtype==1"><text class="text-red text-bold">{{item.zwagall}}</text></view>
  29. <view v-if="item.wtype==5"><text class="text-red text-bold">其他</text></view>
  30. <view v-else><text class="text-red text-bold">{{item.bwagall}}</text></view>
  31. </view>
  32. </view>
  33. <view class="padding-lr padding-tb-xs text-cut">
  34. <view v-for="(titem,tindex) in item.tags" :key="tindex" class="cu-tag light bg-blue lg echo-tags-item">{{titem}}</view>
  35. </view>
  36. <view class="padding-lr text-cut text-sm flex justify-between align-center">
  37. <view class="basis-lg text-df text-cut">{{item.worker.title}}</view>
  38. <view class="basis-sm text-cut text-right text-sm">
  39. 浏览量:{{item.volume}}
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </block>
  45. <uni-load-more :status="pstatus"></uni-load-more>
  46. <wxContact></wxContact>
  47. </view>
  48. </template>
  49. <script>
  50. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  51. var _this;
  52. export default {
  53. components: {
  54. uniLoadMore
  55. },
  56. data() {
  57. return {
  58. searchval: "",
  59. wtype: 0,
  60. pstatus: 'more',
  61. ppage: 1,
  62. psize: 20,
  63. plist: []
  64. };
  65. },
  66. onLoad: function(option){
  67. _this = this;
  68. _this.wtype = option.wtype || 0;
  69. _this.getMore();
  70. },
  71. onPullDownRefresh: function() {
  72. _this.pageRefresh();
  73. },
  74. onReachBottom: function() {
  75. if (_this.pstatus !== 'more') {
  76. return;
  77. }
  78. _this.getMore();
  79. },
  80. onShareAppMessage: function(res) {
  81. return {
  82. title: "企业招聘",
  83. path: "/pages/comjobs/comjobs"
  84. }
  85. },
  86. methods: {
  87. // 搜索
  88. bindInput: function(e) {
  89. _this.searchval = e.detail.value;
  90. },
  91. btnSearch: function() {
  92. if (_this.searchval == "") {
  93. uni.showModal({
  94. title: '信息提示',
  95. content: "请输入要搜索的关键字...",
  96. showCancel: false
  97. });
  98. return false;
  99. }
  100. _this.pageRefresh();
  101. },
  102. pageRefresh: function() {
  103. _this.pstatus = 'more';
  104. _this.ppage = 1;
  105. _this.plist = [];
  106. _this.getMore();
  107. },
  108. getMore: function() {
  109. _this.$req.ajax({
  110. path: "comjobs/listcomjobs",
  111. data: {
  112. ppage: _this.ppage,
  113. psize: _this.psize,
  114. searchval: _this.searchval,
  115. wtype: _this.wtype
  116. }
  117. }).then((data) => {
  118. _this.pstatus = data.pstatus;
  119. _this.plist = _this.plist.concat(data.plist);
  120. _this.ppage += 1;
  121. uni.stopPullDownRefresh();
  122. }).catch((err) => {
  123. uni.showModal({
  124. title: '信息提示',
  125. content: err,
  126. showCancel: false
  127. });
  128. });
  129. },
  130. goDetail: function(comjobsid) {
  131. uni.navigateTo({
  132. url: '/pages/comjobs/detail?comjobsid=' + comjobsid
  133. });
  134. },
  135. goShop: function(workerid) {
  136. uni.navigateTo({
  137. url: '/pages/worker/shop?workerid=' + workerid
  138. });
  139. },
  140. tabSelect: function(e) {
  141. _this.wtype = e.currentTarget.dataset.wtype;
  142. _this.pageRefresh();
  143. },
  144. }
  145. }
  146. </script>
  147. <style>
  148. </style>