mystar.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view>
  3. <scroll-view class="echo-tab-title" scroll-x="true" id="echo-tab-title" :scroll-into-view="'cateTab-'+cateIndex">
  4. <view v-for="(tab, index) in catelist" :key="index" :class="[cateIndex == index ? 'echo-tab-current' : '']" :id="'cateTab-'+index"
  5. @tap="tabChange(index)">{{tab}}</view>
  6. </scroll-view>
  7. <view class="uni-list echo-myjobs-list">
  8. <block v-for="(item,index) in list" :key="index">
  9. <view class="uni-list-cell" hover-class="uni-list-cell-hover" @click="goDetails(item.id)">
  10. <view class="uni-media-list">
  11. <image class="uni-media-list-logo" mode="aspectFill" :src="item.tilpic"></image>
  12. <view class="uni-media-list-body">
  13. <view class="uni-media-list-text-top uni-ellipsis">
  14. {{item.title}}
  15. </view>
  16. <view class="uni-media-list-text-bottom uni-ellipsis">
  17. <text>{{item.tags}}</text>
  18. </view>
  19. <view class="uni-media-list-text-bottom">
  20. <text class="echo-wagall">{{item.minwagall}}-{{item.maxwagall}}元/月</text>
  21. <text class="wagbox1" v-if="item.status==1">{{item.wagstatus==1 ? '工价' : '补贴'}}:{{item.wagstatus==1 ? item.waghourvip : item.wagsubsidyvip}}</text>
  22. <text class="wagbox2" v-if="item.status==2">已停招:{{item.wagstatus==1 ? item.waghourvip : item.wagsubsidyvip}}</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="echo-myjobs-btn">
  28. <view hover-class="uni-list-cell-hover" @click="delStar(index)">取消关注</view>
  29. <view hover-class="uni-list-cell-hover" @click="goDetails(item.id)">查看详情</view>
  30. </view>
  31. </block>
  32. </view>
  33. <uni-load-more :status="pstatus"></uni-load-more>
  34. </view>
  35. </template>
  36. <script>
  37. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  38. var that;
  39. export default {
  40. components: {
  41. uniLoadMore
  42. },
  43. data() {
  44. return {
  45. catelist: ['全部', '招工中', '已停招'],
  46. cateIndex: 0,
  47. ppage: 1,
  48. pstatus: 'more',
  49. list: []
  50. }
  51. },
  52. onLoad: function() {
  53. that = this;
  54. that.userinfo = uni.getStorageSync('userinfo') || null;
  55. if (that.userinfo == null) {
  56. uni.reLaunch({
  57. url: "/pages/login/login"
  58. });
  59. return false;
  60. }
  61. that.getMore();
  62. },
  63. onPullDownRefresh: function() {
  64. that.ppage = 1;
  65. that.pstatus = 'more';
  66. that.list = [];
  67. that.getMore();
  68. },
  69. onReachBottom: function() {
  70. if (that.pstatus !== 'more') {
  71. return;
  72. }
  73. that.getMore();
  74. },
  75. methods: {
  76. getMore: function() {
  77. that.pstatus = 'loading';
  78. that.$req.ajax({
  79. data: {
  80. do: 'my',
  81. op: 'mystar',
  82. ppage: that.ppage,
  83. userid: that.userinfo.id,
  84. status: that.cateIndex
  85. }
  86. }).then((data) => {
  87. that.pstatus = data.pstatus;
  88. that.list = that.list.concat(data.list);
  89. that.ppage += 1;
  90. uni.stopPullDownRefresh();
  91. }).catch((err) => {
  92. console.log("err: " + JSON.stringify(err));
  93. });
  94. },
  95. // 取消关注
  96. delStar: function(index) {
  97. that.$req.ajax({
  98. title: "取消关注",
  99. data: {
  100. do: 'my',
  101. op: 'delstar',
  102. comjobsid: that.list[index].id,
  103. userid: that.userinfo == null ? 0 : that.userinfo.id
  104. }
  105. }).then((data) => {
  106. that.list.splice(index, 1);
  107. }).catch((err) => {
  108. console.log("err: " + JSON.stringify(err));
  109. });
  110. },
  111. goDetails: function(comjobsid) {
  112. uni.navigateTo({
  113. url: '/pages/comjobs/details?id=' + comjobsid
  114. });
  115. },
  116. tabChange: function(index) {
  117. that.cateIndex = index;
  118. that.ppage = 1;
  119. that.pstatus = 'more';
  120. that.list = [];
  121. that.getMore();
  122. },
  123. }
  124. }
  125. </script>
  126. <style lang="scss">
  127. </style>