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

242 lines
5.2 KiB

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