star.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <template>
  2. <view>
  3. <block v-for="(item,index) in plist" :key="index">
  4. <view class="cu-card dynamic no-card solid-bottom echo-comjobs-item padding-top-sm padding-lr-sm radius">
  5. <view class="cu-item shadow padding-top-sm padding-bottom" @tap="goDetail(item.comjobs.id)">
  6. <view class="padding-lr flex justify-between align-center">
  7. <view class="basis-lg text-bold text-df text-cut">
  8. {{item.comjobs.title}}
  9. <text class="text-red text-sm" v-if="item.comjobs.wtype==1">(按月)</text>
  10. <text class="text-red text-sm" v-if="item.comjobs.wtype==2">(按时)</text>
  11. <text class="text-red text-sm" v-if="item.comjobs.wtype==3">(按件)</text>
  12. <text class="text-red text-sm" v-if="item.comjobs.wtype==4">(按项目)</text>
  13. </view>
  14. <view class="basis-sm text-cut text-right text-gray text-sm">
  15. <view class="basis-xs text-cut text-right text-gray text-sm" @tap.stop="delStar(index, item.id)">取消关注</view>
  16. </view>
  17. </view>
  18. <view class="padding-lr flex justify-between align-bottom" @tap="goDetail(item.comjobs.id)">
  19. <view><text class="text-red text-bold">{{item.comjobs.zwagall}}</text></view>
  20. </view>
  21. <view class="padding-lr padding-tb-xs text-cut">
  22. <view v-for="(titem,tindex) in item.comjobs.tags" :key="tindex" class="cu-tag light bg-blue lg echo-tags-item">{{titem}}</view>
  23. </view>
  24. <view class="padding-lr text-cut text-sm flex justify-between align-center">
  25. <view class="basis-lg text-df text-cut">{{item.comjobs.worker.title}}</view>
  26. <view class="basis-sm text-cut text-right text-sm">
  27. 浏览量:{{item.comjobs.volume}}
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. </block>
  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 _this;
  39. export default {
  40. components: {
  41. uniLoadMore
  42. },
  43. data() {
  44. return {
  45. userinfo: {},
  46. pstatus: 'more',
  47. ppage: 1,
  48. psize: 20,
  49. plist: []
  50. };
  51. },
  52. onLoad: function(){
  53. _this = this;
  54. _this.userinfo = _this.checkLogin("/pages/comjobs/star");
  55. if (_this.userinfo===false){
  56. return false;
  57. }
  58. _this.getMore();
  59. },
  60. onPullDownRefresh: function() {
  61. _this.ppage = 1;
  62. _this.pstatus = 'more';
  63. _this.plist = [];
  64. _this.getMore();
  65. },
  66. onReachBottom: function() {
  67. if (_this.pstatus !== 'more') {
  68. return;
  69. }
  70. _this.getMore();
  71. },
  72. methods: {
  73. delStar: function(index,starid) {
  74. _this.$req.ajax({
  75. path: "comjobs/delstar",
  76. data: {
  77. starid: starid,
  78. userid: _this.userinfo.id
  79. }
  80. }).then((data) => {
  81. _this.plist.splice(index, 1);
  82. }).catch((err) => {
  83. uni.showModal({
  84. title: '信息提示',
  85. content: err,
  86. showCancel: false
  87. });
  88. });
  89. },
  90. getMore: function() {
  91. _this.$req.ajax({
  92. path: "comjobs/liststar",
  93. data: {
  94. ppage: _this.ppage,
  95. psize: _this.psize,
  96. userid: _this.userinfo.id
  97. }
  98. }).then((data) => {
  99. _this.pstatus = data.pstatus;
  100. _this.plist = _this.plist.concat(data.plist);
  101. _this.ppage += 1;
  102. uni.stopPullDownRefresh();
  103. }).catch((err) => {
  104. uni.showModal({
  105. title: '信息提示',
  106. content: err,
  107. showCancel: false
  108. });
  109. });
  110. },
  111. goDetail: function(comjobsid) {
  112. uni.navigateTo({
  113. url: '/pages/comjobs/detail?comjobsid=' + comjobsid
  114. });
  115. },
  116. goShop: function(workerid) {
  117. uni.navigateTo({
  118. url: '/pages/worker/shop?workerid=' + workerid
  119. });
  120. },
  121. }
  122. }
  123. </script>
  124. <style>
  125. </style>