activityList.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view>
  3. <view class="card" v-for="(item,index) in plist" :key="index" @click="goDetail(item.id)">
  4. <view class="card-left">
  5. <image class="card-left-image" :src="item.main_image"></image>
  6. </view>
  7. <view class="card-right">
  8. <view class="right-title">{{item.title}}</view>
  9. <view class="right-box">
  10. <view class="box-content">
  11. <view class="content-text">{{item.address}}</view>
  12. <view class="content-text" style="margin-top: 20rpx;">{{item.start_time}}</view>
  13. </view>
  14. <view class="box-btn">正在进行中</view>
  15. </view>
  16. </view>
  17. </view>
  18. <uni-load-more :status="pstatus"></uni-load-more>
  19. </view>
  20. </template>
  21. <script>
  22. var _this;
  23. export default {
  24. data() {
  25. return {
  26. ppage: 1,
  27. psize: 20,
  28. pstatus: 'more',
  29. plist: [],
  30. }
  31. },
  32. onLoad() {
  33. _this = this;
  34. _this.getMore();
  35. },
  36. onReachBottom: function() {
  37. if (_this.pstatus !== 'more') {
  38. return;
  39. }
  40. _this.getMore();
  41. },
  42. methods: {
  43. goDetail: function(id) {
  44. uni.navigateTo({
  45. url: '/pages/activity/activityDetail?id=' + id
  46. });
  47. },
  48. getMore() {
  49. _this.$req.ajax({
  50. path: "activity/listActivity",
  51. data: {
  52. ppage: _this.ppage,
  53. psize: _this.psize,
  54. }
  55. }).then((data) => {
  56. _this.pstatus = data.pstatus;
  57. _this.plist = _this.plist.concat(data.plist);
  58. _this.ppage += 1;
  59. console.log("列表数据", data)
  60. }).catch((err) => {
  61. uni.showModal({
  62. title: '信息提示',
  63. content: err,
  64. showCancel: false
  65. });
  66. });
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss">
  72. .card {
  73. margin: 10rpx 20rpx 30rpx;
  74. padding: 20rpx 20rpx;
  75. border-radius: 12rpx;
  76. background-color: #FFFFFF;
  77. box-shadow: 5rpx 5rpx 10rpx 2rpx rgba(149, 149, 149, 0.3);
  78. display: flex;
  79. align-items: center;
  80. .card-left {
  81. width: 250rpx;
  82. height: 170rpx;
  83. border-radius: 12rpx;
  84. .card-left-image {
  85. width: 250rpx;
  86. height: 170rpx;
  87. border-radius: 12rpx;
  88. }
  89. }
  90. .card-right {
  91. flex: 1;
  92. height: 170rpx;
  93. margin-left: 20rpx;
  94. display: flex;
  95. flex-direction: column;
  96. justify-content: space-between;
  97. .right-title {
  98. width: 100%;
  99. font-weight: bold;
  100. overflow: hidden;
  101. text-overflow: ellipsis;
  102. -webkit-line-clamp: 1;
  103. display: -webkit-box;
  104. -webkit-box-orient: vertical;
  105. }
  106. .right-box {
  107. display: flex;
  108. align-items: center;
  109. justify-content: space-between;
  110. .box-content {
  111. flex: 1;
  112. .content-text {
  113. width: 100%;
  114. font-size: 23rpx;
  115. color: #afafaf;
  116. overflow: hidden;
  117. text-overflow: ellipsis;
  118. -webkit-line-clamp: 1;
  119. display: -webkit-box;
  120. -webkit-box-orient: vertical;
  121. }
  122. }
  123. .box-btn {
  124. margin-left: 15rpx;
  125. width: 140rpx;
  126. height: 50rpx;
  127. font-size: 24rpx;
  128. color: #CA151C;
  129. display: flex;
  130. align-items: center;
  131. justify-content: center;
  132. border-radius: 12rpx;
  133. border: 1rpx solid #CA151C;
  134. }
  135. }
  136. }
  137. }
  138. </style>