国外MOSE官网
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.

338 lines
7.6 KiB

2 days 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 currentActivityList" :key="index" @click="viewActivityDetail(item)">
  19. <image class="activity-image" :src="item.image" mode="aspectFill"></image>
  20. <view class="activity-info">
  21. <view class="title-row">
  22. <view class="activity-badge">
  23. <text class="badge-text">30</text>
  24. </view>
  25. <text class="activity-title">{{item.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.location}}</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.time}}</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.participants}}/{{item.maxParticipants}}</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="currentActivityList.length === 0" class="empty-state">
  68. <text class="empty-text">暂无相关报名记录</text>
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. name: 'MyRegistrations',
  76. data() {
  77. return {
  78. currentTab: 0,
  79. tabList: [
  80. { name: '未签到' },
  81. { name: '已签到' },
  82. { name: '系统取消' }
  83. ],
  84. // 未签到活动列表
  85. unsignedList: [
  86. {
  87. id: 1,
  88. title: '关爱自闭症儿童活动',
  89. image: '/static/bannerImage.png',
  90. location: '长沙市雨花区时代阳光大道国际大厅2145',
  91. time: '2025-06-12 14:30',
  92. participants: 30,
  93. maxParticipants: 30
  94. },
  95. {
  96. id: 2,
  97. title: '关爱自闭症儿童活动',
  98. image: '/static/bannerImage.png',
  99. location: '长沙市雨花区时代阳光大道国际大厅2145',
  100. time: '2025-06-12 14:30',
  101. participants: 30,
  102. maxParticipants: 30
  103. },
  104. {
  105. id: 3,
  106. title: '关爱自闭症儿童活动',
  107. image: '/static/bannerImage.png',
  108. location: '长沙市雨花区时代阳光大道国际大厅2145',
  109. time: '2025-06-12 14:30',
  110. participants: 30,
  111. maxParticipants: 30
  112. },
  113. {
  114. id: 4,
  115. title: '关爱自闭症儿童活动',
  116. image: '/static/bannerImage.png',
  117. location: '长沙市雨花区时代阳光大道国际大厅2145',
  118. time: '2025-06-12 14:30',
  119. participants: 30,
  120. maxParticipants: 30
  121. }
  122. ],
  123. // 已签到活动列表
  124. signedList: [
  125. {
  126. id: 5,
  127. title: '关爱自闭症儿童活动',
  128. image: '/static/bannerImage.png',
  129. location: '长沙市雨花区时代阳光大道国际大厅2145',
  130. time: '2025-06-12 14:30',
  131. participants: 30,
  132. maxParticipants: 30
  133. }
  134. ],
  135. // 系统取消活动列表
  136. cancelledList: [
  137. {
  138. id: 6,
  139. title: '关爱自闭症儿童活动',
  140. image: '/static/bannerImage.png',
  141. location: '长沙市雨花区时代阳光大道国际大厅2145',
  142. time: '2025-06-12 14:30',
  143. participants: 30,
  144. maxParticipants: 30
  145. }
  146. ]
  147. }
  148. },
  149. computed: {
  150. currentActivityList() {
  151. switch(this.currentTab) {
  152. case 0:
  153. return this.unsignedList
  154. case 1:
  155. return this.signedList
  156. case 2:
  157. return this.cancelledList
  158. default:
  159. return []
  160. }
  161. }
  162. },
  163. methods: {
  164. tabChange(index) {
  165. this.currentTab = index
  166. },
  167. viewActivityDetail(activity) {
  168. // 查看活动详情,根据当前tab状态跳转到对应页面
  169. let status = 'unsigned' // 默认未签到
  170. switch(this.currentTab) {
  171. case 0:
  172. status = 'unsigned' // 未签到
  173. break
  174. case 1:
  175. status = 'signed' // 已签到
  176. break
  177. case 2:
  178. status = 'cancelled' // 系统取消
  179. break
  180. }
  181. uni.navigateTo({
  182. url: `/subPages/my/myActivityDetail?id=${activity.id}&status=${status}`
  183. })
  184. },
  185. // scanQRCode(activity) {
  186. // // 扫码签到
  187. // uni.scanCode({
  188. // success: (res) => {
  189. // console.log('扫码结果:', res)
  190. // // 这里可以处理签到逻辑
  191. // uni.showToast({
  192. // title: '签到成功',
  193. // icon: 'success'
  194. // })
  195. // },
  196. // fail: (err) => {
  197. // console.log('扫码失败:', err)
  198. // uni.showToast({
  199. // title: '扫码失败',
  200. // icon: 'error'
  201. // })
  202. // }
  203. // })
  204. // }
  205. }
  206. }
  207. </script>
  208. <style lang="scss" scoped>
  209. .my-registrations {
  210. background-color: #f5f5f5;
  211. min-height: 100vh;
  212. .custom-tabs {
  213. display: flex;
  214. background-color: #fff;
  215. border-bottom: 1rpx solid #e5e5e5;
  216. .tab-item {
  217. flex: 1;
  218. position: relative;
  219. display: flex;
  220. flex-direction: column;
  221. align-items: center;
  222. padding: 30rpx 0;
  223. cursor: pointer;
  224. .tab-text {
  225. font-size: 28rpx;
  226. color: #666;
  227. transition: color 0.3s;
  228. &.active {
  229. color: #218cdd;
  230. font-weight: bold;
  231. }
  232. }
  233. .tab-line {
  234. position: absolute;
  235. bottom: 0;
  236. left: 50%;
  237. transform: translateX(-50%);
  238. width: 60rpx;
  239. height: 4rpx;
  240. background-color: #218cdd;
  241. border-radius: 2rpx;
  242. }
  243. }
  244. }
  245. .activity-list {
  246. padding: 20rpx;
  247. .activity-item {
  248. display: flex;
  249. margin-bottom: 30rpx;
  250. background: #fff;
  251. border-radius: 12rpx;
  252. padding: 20rpx;
  253. .activity-image {
  254. width: 180rpx;
  255. height: 180rpx;
  256. border-radius: 8rpx;
  257. margin-right: 20rpx;
  258. }
  259. .activity-info {
  260. flex: 1;
  261. display: flex;
  262. flex-direction: column;
  263. justify-content: space-between;
  264. .title-row {
  265. display: flex;
  266. align-items: center;
  267. margin-bottom: 10rpx;
  268. .activity-badge {
  269. width: 31px;
  270. height: 20px;
  271. background: #218cdd;
  272. border-radius: 3.5px;
  273. margin-right: 7rpx;
  274. display: flex;
  275. align-items: center;
  276. justify-content: center;
  277. .badge-text {
  278. font-size: 18rpx;
  279. color: #fff;
  280. }
  281. }
  282. }
  283. .activity-title {
  284. font-size: 28rpx;
  285. font-weight: bold;
  286. color: $uni-text-color;
  287. }
  288. .activity-location, .activity-time, .activity-participants {
  289. display: flex;
  290. align-items: center;
  291. margin-bottom: 6rpx;
  292. .location-text, .time-text, .participants-text {
  293. font-size: 24rpx;
  294. color: $uni-text-color-grey;
  295. margin-left: 6rpx;
  296. }
  297. }
  298. }
  299. .activity-action {
  300. display: flex;
  301. align-items: flex-end;
  302. padding-bottom: 10rpx;
  303. }
  304. }
  305. .empty-state {
  306. display: flex;
  307. justify-content: center;
  308. align-items: center;
  309. height: 400rpx;
  310. .empty-text {
  311. font-size: 28rpx;
  312. color: $uni-text-color-grey;
  313. }
  314. }
  315. }
  316. }
  317. </style>