my-join.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="content">
  3. <!-- 活动列表区域 -->
  4. <view class="list">
  5. <!-- 每一个活动区域 -->
  6. <view class="list_box" v-for="item in dataList" :key="item.id" @click="clickItem(item.id)">
  7. <view class="box_top">
  8. <img v-if="item.poster" class="img" :src="item.poster" mode="aspectFill" />
  9. <img v-else class="img" src="@/static/images/3.png" mode="aspectFill" />
  10. <view class="top_msg">
  11. <view class="msg_title">{{ item.theme }}</view>
  12. <view class="msg_name">{{ item.orgName }}</view>
  13. <view class="">{{ item.startTime }} 至 {{ item.endTime }}</view>
  14. </view>
  15. </view>
  16. <view v-if="item.statuName == '报名进行中'" class="box_bottom on">报名进行中</view>
  17. <view v-if="item.statuName == '活动已结束'" class="box_bottom off">活动已结束</view>
  18. <view v-if="item.statuName == '活动未开始'" class="box_bottom nostart">活动未开始</view>
  19. </view>
  20. <noData v-if="!dataList.length"></noData>
  21. </view>
  22. </view>
  23. </template>
  24. <script setup>
  25. import { onReachBottom } from '@dcloudio/uni-app'
  26. import { ref, onMounted } from 'vue'
  27. import { getMyJoinActivityPages } from '@/api/index.js'
  28. // 当前页
  29. const currentPage = ref(1)
  30. // 每页多少条
  31. const pageCount = ref(6)
  32. // 总条数
  33. const total = ref(0)
  34. // 列表数据
  35. const dataList = ref([])
  36. onMounted(() => {
  37. // 获取我参加的活动分页数据
  38. getData()
  39. })
  40. onReachBottom(() => {
  41. if (total.value > dataList.value.length) {
  42. currentPage.value++
  43. getData()
  44. } else {
  45. uni.showToast({
  46. title: '没有更多数据了~~',
  47. icon: 'none'
  48. })
  49. }
  50. })
  51. // 获取我参加的活动分页数据
  52. const getData = async () => {
  53. let data = {
  54. currentPage: currentPage.value,
  55. pageCount: pageCount.value
  56. }
  57. const res = await getMyJoinActivityPages(data)
  58. // console.log(res)
  59. dataList.value = [...dataList.value, ...res.data.list]
  60. total.value = res.data.totalCount
  61. }
  62. // 点击每一个活动的回调
  63. const clickItem = (id) => {
  64. uni.navigateTo({
  65. url: `/pages/act_detail/act_detail?id=${id}`
  66. })
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .content {
  71. .list {
  72. margin-top: 20rpx;
  73. .list_box {
  74. display: flex;
  75. flex-direction: column;
  76. justify-content: space-between;
  77. padding: 30rpx 25rpx;
  78. margin-bottom: 20rpx;
  79. width: 714rpx;
  80. height: 344rpx;
  81. border-radius: 28rpx;
  82. box-shadow: 0 4rpx 35rpx #d3d3d3;
  83. background-color: #fff;
  84. .box_top {
  85. display: flex;
  86. justify-content: space-between;
  87. .img {
  88. margin-right: 24rpx;
  89. width: 249rpx;
  90. height: 168rpx;
  91. border-radius: 8rpx;
  92. }
  93. .top_msg {
  94. display: flex;
  95. flex-direction: column;
  96. justify-content: space-between;
  97. flex: 1;
  98. font-size: 24rpx;
  99. color: #808080;
  100. overflow: hidden;
  101. .msg_title {
  102. font-size: 28rpx;
  103. font-weight: bold;
  104. color: #000;
  105. display: -webkit-box;
  106. -webkit-box-orient: vertical;
  107. -webkit-line-clamp: 2;
  108. overflow: hidden;
  109. }
  110. .msg_name {
  111. white-space: nowrap;
  112. overflow: hidden;
  113. text-overflow: ellipsis;
  114. }
  115. }
  116. }
  117. .box_bottom {
  118. display: flex;
  119. justify-content: center;
  120. align-items: center;
  121. width: 661rpx;
  122. height: 80rpx;
  123. border-radius: 8rpx;
  124. }
  125. .on {
  126. color: #fff;
  127. background-color: #007aff;
  128. }
  129. .off {
  130. color: #a6a6a6;
  131. background-color: #e5e5e5;
  132. }
  133. .nostart {
  134. color: #fff;
  135. background-color: #007aff;
  136. opacity: 0.3;
  137. }
  138. }
  139. }
  140. }
  141. </style>