myActivity.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view>
  3. <view class="card" v-for="(item,index) in plist" :key="index" @click="goDetail(item.activity_id)">
  4. <view class="card-left">
  5. <image class="card-left-image" :src="item.activity.main_image"></image>
  6. </view>
  7. <view class="card-right">
  8. <view class="right-title">{{item.activity.title}}</view>
  9. <view class="right-box">
  10. <view class="box-content">
  11. <view class="content-text">报名时间:{{item.create_time}}</view>
  12. <view class="content-text" style="margin-top: 20rpx;">{{item.status_text}}</view>
  13. </view>
  14. <view class="box-btn" v-if="item.status == 1" @click.stop="cancel(item.activity_id)">取消报名</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. userinfo: null,
  31. }
  32. },
  33. onLoad() {
  34. _this = this;
  35. _this.userinfo = uni.getStorageSync('userinfo') || false;
  36. _this.getMore();
  37. },
  38. onReachBottom: function() {
  39. if (_this.pstatus !== 'more') {
  40. return;
  41. }
  42. _this.getMore();
  43. },
  44. methods: {
  45. pageRefresh: function() {
  46. _this.pstatus = 'more';
  47. _this.ppage = 1;
  48. _this.plist = [];
  49. _this.getMore();
  50. },
  51. goDetail: function(id) {
  52. uni.navigateTo({
  53. url: '/pages/activity/activityDetail?id=' + id
  54. });
  55. },
  56. cancel(id) {
  57. _this.$req.ajax({
  58. path: "activity/cancelJoin",
  59. data: {
  60. id: id
  61. }
  62. }).then((data) => {
  63. _this.pageRefresh();
  64. console.log("取消报名", data)
  65. }).catch((err) => {
  66. uni.showModal({
  67. title: '信息提示',
  68. content: err,
  69. showCancel: false
  70. });
  71. });
  72. },
  73. getMore() {
  74. _this.$req.ajax({
  75. path: "activity/joinList",
  76. data: {
  77. ppage: _this.ppage,
  78. psize: _this.psize,
  79. userid: _this.userinfo.id,
  80. }
  81. }).then((data) => {
  82. _this.pstatus = data.pstatus;
  83. _this.plist = _this.plist.concat(data.plist);
  84. _this.ppage += 1;
  85. console.log("列表数据", data)
  86. }).catch((err) => {
  87. uni.showModal({
  88. title: '信息提示',
  89. content: err,
  90. showCancel: false
  91. });
  92. });
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss">
  98. .card {
  99. margin: 10rpx 20rpx 30rpx;
  100. padding: 20rpx 20rpx;
  101. border-radius: 12rpx;
  102. background-color: #FFFFFF;
  103. box-shadow: 5rpx 5rpx 10rpx 2rpx rgba(149, 149, 149, 0.3);
  104. display: flex;
  105. align-items: center;
  106. .card-left {
  107. width: 250rpx;
  108. height: 170rpx;
  109. border-radius: 12rpx;
  110. .card-left-image {
  111. width: 250rpx;
  112. height: 170rpx;
  113. border-radius: 12rpx;
  114. }
  115. }
  116. .card-right {
  117. flex: 1;
  118. height: 170rpx;
  119. margin-left: 20rpx;
  120. display: flex;
  121. flex-direction: column;
  122. justify-content: space-between;
  123. .right-title {
  124. width: 100%;
  125. font-weight: bold;
  126. overflow: hidden;
  127. text-overflow: ellipsis;
  128. -webkit-line-clamp: 1;
  129. display: -webkit-box;
  130. -webkit-box-orient: vertical;
  131. }
  132. .right-box {
  133. display: flex;
  134. align-items: center;
  135. justify-content: space-between;
  136. .box-content {
  137. flex: 1;
  138. .content-text {
  139. width: 100%;
  140. font-size: 23rpx;
  141. color: #afafaf;
  142. overflow: hidden;
  143. text-overflow: ellipsis;
  144. -webkit-line-clamp: 1;
  145. display: -webkit-box;
  146. -webkit-box-orient: vertical;
  147. }
  148. }
  149. .box-btn {
  150. margin-left: 15rpx;
  151. width: 130rpx;
  152. height: 50rpx;
  153. font-size: 25rpx;
  154. color: #FFFFFF;
  155. display: flex;
  156. align-items: center;
  157. justify-content: center;
  158. border-radius: 12rpx;
  159. background-color: #CA151C;
  160. }
  161. }
  162. }
  163. }
  164. </style>