index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view>
  3. <view class="line"></view>
  4. <view class="list" v-if="contentList && contentList.length > 0">
  5. <!-- :url="'/topic/content/content?id=' + item.id" -->
  6. <navigator :url="'/integralshop/content/content?id=' + item.id" hover-class="none" class="li" v-for="(item, index) in contentList" :key="index">
  7. <image :src="item.pic" mode="aspectFill" class="li-img"></image>
  8. <view class="info">
  9. <view class="title">{{ item.title }}</view>
  10. <view class="time ddflex">
  11. <image src="../../static/pages/images/nearbytime.png"></image>
  12. {{ item.createDate }}
  13. </view>
  14. <view class="opt ddflex" v-if="!bindId">
  15. <view class="browse">{{item.browse}}次浏览</view>
  16. <!-- <view class="ddflex">
  17. <view class="opt-btn ddflex">
  18. <image src="../../static/images/like.png"></image>
  19. 99+
  20. </view>
  21. <view class="opt-btn ddflex">
  22. <image src="../../static/images/comment.png"></image>
  23. 99+
  24. </view>
  25. <view class="opt-btn ddflex">
  26. <image src="../../static/images/jifen.png"></image>
  27. +50
  28. </view>
  29. </view> -->
  30. </view>
  31. </view>
  32. </navigator>
  33. </view>
  34. <view class="nodata" v-else>
  35. <image :src="picUrlss + 'empty_dd.png'"></image>
  36. <text>暂无活动</text>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. // pages/sort/sort.js
  42. //获取应用实例
  43. const app = getApp();
  44. const req = require('../../utils/request.js');
  45. export default {
  46. data() {
  47. return {
  48. picUrlss: req.public.picUrls,
  49. bindId: '',
  50. form: {
  51. page: 1,
  52. limit: 10
  53. },
  54. contentList: [],
  55. isLoad: true
  56. };
  57. },
  58. onLoad: async function(options) {
  59. this.bindId = options.bindId;
  60. // if (this.bindId) {
  61. this.getContentList(true);
  62. // }
  63. },
  64. onShow() {},
  65. onReachBottom() {
  66. this.form.page++;
  67. this.getContentList(false);
  68. },
  69. methods: {
  70. getContentList(isShow) {
  71. if (!this.isLoad) return false;
  72. this.isLoad = false;
  73. let form = this.form;
  74. if (this.bindId) {
  75. form.cid = this.bindId;
  76. } else {
  77. //获取个人数据
  78. form.isMyData = 1;
  79. }
  80. req.getRequest(
  81. '/api/content/list',
  82. form,
  83. res => {
  84. if (res && res.length == 10) {
  85. this.isLoad = true;
  86. }
  87. if (this.form.page > 1) {
  88. res = this.contentList.concat(res);
  89. }
  90. this.contentList = res;
  91. },
  92. isShow
  93. );
  94. }
  95. }
  96. };
  97. </script>
  98. <style>
  99. @import './index.css';
  100. </style>