木邻有你前端代码仓库
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.

237 lines
5.1 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 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="my-registrations">
  3. <!-- 原生tabs组件 -->
  4. <view class="custom-tabs">
  5. <view
  6. v-for="(tab, index) in tabList"
  7. :key="index"
  8. class="tab-item"
  9. :class="{ active: currentTab === index }"
  10. @click="tabChange(index)"
  11. >
  12. <text class="tab-text" :class="{ active: currentTab === index }">{{ tab.name }}</text>
  13. <view v-if="currentTab === index" class="tab-line"></view>
  14. </view>
  15. </view>
  16. <!-- 活动列表 -->
  17. <view class="activity-list">
  18. <view class="activity-item" v-for="(item, index) in list" :key="index" @click="viewActivityDetail(item)">
  19. <image class="activity-image" :src="item.communityActivity.image" mode="aspectFill"></image>
  20. <view class="activity-info">
  21. <view class="title-row">
  22. <view class="activity-badge">
  23. <text class="badge-text">{{item.communityActivity.score}}</text>
  24. </view>
  25. <text class="activity-title">{{item.communityActivity.title}}</text>
  26. </view>
  27. <view class="activity-location">
  28. <uv-icon name="map-fill" size="14" color="#999"></uv-icon>
  29. <text class="location-text">{{item.communityActivity.address}}</text>
  30. </view>
  31. <view class="activity-time">
  32. <uv-icon name="calendar" size="14" color="#999"></uv-icon>
  33. <text class="time-text">{{item.communityActivity.activityTime}}</text>
  34. </view>
  35. <view class="activity-participants">
  36. <uv-icon name="account-fill" size="14" color="#999"></uv-icon>
  37. <text class="participants-text">报名人数{{item.communityActivity.numActivity}}/{{item.communityActivity.numLimit}}</text>
  38. </view>
  39. </view>
  40. <view class="activity-action">
  41. <uv-button
  42. v-if="currentTab === 0"
  43. type="primary"
  44. size="mini"
  45. shape="circle"
  46. text="扫码签到"
  47. @click.stop="scanQRCode(item)"
  48. ></uv-button>
  49. <uv-button
  50. v-else-if="currentTab === 1"
  51. type="success"
  52. shape="circle"
  53. size="mini"
  54. text="已签到"
  55. disabled
  56. ></uv-button>
  57. <uv-button
  58. v-else
  59. type="error"
  60. size="mini"
  61. text="已取消"
  62. disabled
  63. ></uv-button>
  64. </view>
  65. </view>
  66. <!-- 空状态 -->
  67. <view v-if="list.length === 0" class="empty-state">
  68. <text class="empty-text">暂无相关报名记录</text>
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import MixinList from '@/mixins/list.js'
  75. export default {
  76. mixins: [MixinList],
  77. name: 'MyRegistrations',
  78. data() {
  79. return {
  80. currentTab: 0,
  81. tabList: [
  82. { name: '未签到' },
  83. { name: '已签到' },
  84. { name: '系统取消' }
  85. ],
  86. mixinListApi: 'activity.queryApplyList',
  87. }
  88. },
  89. computed: {
  90. },
  91. methods: {
  92. tabChange(index) {
  93. this.currentTab = index
  94. this.initPage()
  95. this.getList(true)
  96. },
  97. mixinSetParams() {
  98. return {
  99. status: this.currentTab
  100. }
  101. },
  102. },
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .my-registrations {
  107. background-color: #f5f5f5;
  108. min-height: 100vh;
  109. .custom-tabs {
  110. display: flex;
  111. background-color: #fff;
  112. border-bottom: 1rpx solid #e5e5e5;
  113. .tab-item {
  114. flex: 1;
  115. position: relative;
  116. display: flex;
  117. flex-direction: column;
  118. align-items: center;
  119. padding: 30rpx 0;
  120. cursor: pointer;
  121. .tab-text {
  122. font-size: 28rpx;
  123. color: #666;
  124. transition: color 0.3s;
  125. &.active {
  126. color: #218cdd;
  127. font-weight: bold;
  128. }
  129. }
  130. .tab-line {
  131. position: absolute;
  132. bottom: 0;
  133. left: 50%;
  134. transform: translateX(-50%);
  135. width: 60rpx;
  136. height: 4rpx;
  137. background-color: #218cdd;
  138. border-radius: 2rpx;
  139. }
  140. }
  141. }
  142. .activity-list {
  143. padding: 20rpx;
  144. .activity-item {
  145. display: flex;
  146. margin-bottom: 30rpx;
  147. background: #fff;
  148. border-radius: 12rpx;
  149. padding: 20rpx;
  150. .activity-image {
  151. width: 180rpx;
  152. height: 180rpx;
  153. border-radius: 8rpx;
  154. margin-right: 20rpx;
  155. }
  156. .activity-info {
  157. flex: 1;
  158. display: flex;
  159. flex-direction: column;
  160. justify-content: space-between;
  161. .title-row {
  162. display: flex;
  163. align-items: center;
  164. margin-bottom: 10rpx;
  165. .activity-badge {
  166. width: 31px;
  167. height: 20px;
  168. background: #218cdd;
  169. border-radius: 3.5px;
  170. margin-right: 7rpx;
  171. display: flex;
  172. align-items: center;
  173. justify-content: center;
  174. .badge-text {
  175. font-size: 18rpx;
  176. color: #fff;
  177. }
  178. }
  179. }
  180. .activity-title {
  181. font-size: 28rpx;
  182. font-weight: bold;
  183. color: $uni-text-color;
  184. }
  185. .activity-location, .activity-time, .activity-participants {
  186. display: flex;
  187. align-items: center;
  188. margin-bottom: 6rpx;
  189. .location-text, .time-text, .participants-text {
  190. font-size: 24rpx;
  191. color: $uni-text-color-grey;
  192. margin-left: 6rpx;
  193. }
  194. }
  195. }
  196. .activity-action {
  197. display: flex;
  198. align-items: flex-end;
  199. padding-bottom: 10rpx;
  200. }
  201. }
  202. .empty-state {
  203. display: flex;
  204. justify-content: center;
  205. align-items: center;
  206. height: 400rpx;
  207. .empty-text {
  208. font-size: 28rpx;
  209. color: $uni-text-color-grey;
  210. }
  211. }
  212. }
  213. }
  214. </style>