木邻有你前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

199 lines
3.8 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="page">
  3. <!-- 导航栏 -->
  4. <!-- 签到列表 -->
  5. <view class="content">
  6. <view v-if="checkinList.length > 0" class="list">
  7. <view v-for="item in checkinList" :key="item.id" class="activity-item" @click="checkinActivity(item)">
  8. <image class="activity-image" :src="item.image" mode="aspectFill"></image>
  9. <view class="activity-info">
  10. <view class="title-row">
  11. <view class="activity-badge">
  12. <text class="badge-text">{{ item.score }}</text>
  13. </view>
  14. <text class="activity-title">{{ item.title }}</text>
  15. </view>
  16. <view class="activity-location">
  17. <uv-icon name="map-fill" size="14" color="#999"></uv-icon>
  18. <text class="location-text">{{ item.address }}</text>
  19. </view>
  20. <view class="activity-time">
  21. <uv-icon name="calendar" size="14" color="#999"></uv-icon>
  22. <text class="time-text">{{ item.activityTime }}</text>
  23. </view>
  24. <view class="activity-participants">
  25. <uv-icon name="account-fill" size="14" color="#999"></uv-icon>
  26. <text class="participants-text">{{ item.numActivity }}人已报名</text>
  27. </view>
  28. </view>
  29. <view class="activity-action">
  30. <uv-button
  31. type="primary"
  32. size="mini"
  33. text="签到码"
  34. ></uv-button>
  35. </view>
  36. </view>
  37. </view>
  38. <view v-else class="empty">
  39. <uv-empty mode="data" text="暂无可签到活动"></uv-empty>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. checkinList: [
  49. ],
  50. pageNo: 1,
  51. pageSize: 10
  52. }
  53. },
  54. methods: {
  55. // 跳转到签到码界面
  56. checkinActivity(item) {
  57. uni.navigateTo({
  58. url: `/subPages/my/checkinCode?id=${item.id}`
  59. })
  60. },
  61. initData() {
  62. this.checkinList = []
  63. this.pageNo = 1
  64. },
  65. // 获取活动
  66. async getCheckinList() {
  67. const res = await this.$api.activity.queryActivityList({
  68. status: 0,
  69. pageNo: this.pageNo,
  70. pageSize: this.pageSize
  71. })
  72. if (res.result.records.length) {
  73. // this.checkinList = [...this.checkinList, ...res.result.records]
  74. this.checkinList.push(...res.result.records)
  75. this.pageNo++
  76. }else {
  77. uni.showToast({
  78. title: '暂无签到活动',
  79. icon: 'none'
  80. })
  81. }
  82. }
  83. },
  84. onShow() {
  85. this.initData()
  86. this.getCheckinList()
  87. },
  88. onReachBottom() {
  89. // this.initData()
  90. this.getCheckinList()
  91. },
  92. async onPullDownRefresh() {
  93. this.initData()
  94. await this.getCheckinList()
  95. uni.stopPullDownRefresh()
  96. }
  97. }
  98. </script>
  99. <style lang="scss" scoped>
  100. .page {
  101. background-color: #f5f5f5;
  102. min-height: 100vh;
  103. }
  104. .content {
  105. padding: 20rpx;
  106. }
  107. .list {
  108. display: flex;
  109. flex-direction: column;
  110. gap: 20rpx;
  111. }
  112. .activity-item {
  113. display: flex;
  114. margin-bottom: 30rpx;
  115. background: #fff;
  116. border-radius: 12rpx;
  117. padding: 20rpx;
  118. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
  119. }
  120. .activity-image {
  121. width: 180rpx;
  122. height: 180rpx;
  123. border-radius: 8rpx;
  124. margin-right: 20rpx;
  125. }
  126. .activity-info {
  127. flex: 1;
  128. display: flex;
  129. flex-direction: column;
  130. justify-content: space-between;
  131. }
  132. .title-row {
  133. display: flex;
  134. align-items: center;
  135. margin-bottom: 10rpx;
  136. }
  137. .activity-badge {
  138. width: 62rpx;
  139. height: 40rpx;
  140. background: #218cdd;
  141. border-radius: 7rpx;
  142. margin-right: 14rpx;
  143. display: flex;
  144. align-items: center;
  145. justify-content: center;
  146. }
  147. .badge-text {
  148. font-size: 18rpx;
  149. color: #fff;
  150. }
  151. .activity-title {
  152. font-size: 28rpx;
  153. font-weight: bold;
  154. color: #333;
  155. line-height: 1.4;
  156. display: -webkit-box;
  157. -webkit-box-orient: vertical;
  158. -webkit-line-clamp: 2;
  159. overflow: hidden;
  160. }
  161. .activity-location, .activity-time, .activity-participants {
  162. display: flex;
  163. align-items: center;
  164. margin-bottom: 6rpx;
  165. }
  166. .location-text, .time-text, .participants-text {
  167. font-size: 24rpx;
  168. color: #999;
  169. margin-left: 6rpx;
  170. }
  171. .activity-action {
  172. display: flex;
  173. align-items: flex-end;
  174. padding-bottom: 10rpx;
  175. }
  176. .empty {
  177. margin-top: 200rpx;
  178. }
  179. </style>