国外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.

305 lines
8.5 KiB

4 days ago
  1. <template>
  2. <view class="activity-calendar">
  3. <!-- 活动列表 -->
  4. <view class="calendar-content">
  5. <view
  6. v-for="(dayData, index) in activityData"
  7. :key="index"
  8. class="day-section"
  9. >
  10. <!-- 日期和日历图标 (在容器外部) -->
  11. <view class="date-header">
  12. <image
  13. src="/subPages/static/活动日历_图标@2x.png"
  14. class="calendar-icon"
  15. ></image>
  16. <text class="date-text">{{ dayData.date }} ({{ dayData.weekday }})</text>
  17. </view>
  18. <!-- 活动列表容器 -->
  19. <view class="activities-container">
  20. <view
  21. v-for="(activity, actIndex) in dayData.activities"
  22. :key="actIndex"
  23. class="activity-item"
  24. @click="viewActivityDetail(activity)"
  25. >
  26. <!-- 活动图片 -->
  27. <image class="activity-image" :src="activity.image" mode="aspectFill"></image>
  28. <!-- 活动信息 -->
  29. <view class="activity-info">
  30. <view class="title-row">
  31. <view class="activity-badge">
  32. <text class="badge-text">{{ activity.duration }}</text>
  33. </view>
  34. <text class="activity-title">{{ activity.title }}</text>
  35. </view>
  36. <view class="activity-location">
  37. <uv-icon name="map-fill" size="14" color="#999"></uv-icon>
  38. <text class="location-text">{{ activity.location }}</text>
  39. </view>
  40. <view class="activity-time">
  41. <uv-icon name="calendar" size="14" color="#999"></uv-icon>
  42. <text class="time-text">{{ activity.time }}</text>
  43. </view>
  44. <view class="activity-participants">
  45. <uv-icon name="account-fill" size="14" color="#999"></uv-icon>
  46. <text class="participants-text">{{ activity.registeredCount }}/{{ activity.maxCount }}人已报名</text>
  47. </view>
  48. </view>
  49. <!-- 查看详情按钮 -->
  50. <view class="activity-action">
  51. <view class="detail-btn" @click.stop="viewActivityDetail(activity)">
  52. <text class="detail-btn-text">查看详情</text>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. name: 'ActivityCalendar',
  64. data() {
  65. return {
  66. activityData: [
  67. {
  68. date: '2025-06-09',
  69. weekday: '周一',
  70. activities: [
  71. {
  72. id: 1,
  73. duration: '30分',
  74. title: '关爱自闭症儿童活动',
  75. location: '长沙市雨花区时代阳光大道国际大厦2145',
  76. time: '2025-06-12 14:30',
  77. registeredCount: 30,
  78. maxCount: 30,
  79. image: '/static/bannerImage.png'
  80. },
  81. {
  82. id: 2,
  83. duration: '30分',
  84. title: '关爱自闭症儿童活动',
  85. location: '长沙市雨花区时代阳光大道国际大厦2145',
  86. time: '2025-06-12 14:30',
  87. registeredCount: 30,
  88. maxCount: 30,
  89. image: '/static/bannerImage.png'
  90. }
  91. ]
  92. },
  93. {
  94. date: '2025-06-10',
  95. weekday: '周五',
  96. activities: [
  97. {
  98. id: 3,
  99. duration: '30分',
  100. title: '关爱自闭症儿童活动',
  101. location: '长沙市雨花区时代阳光大道国际大厦2145',
  102. time: '2025-06-12 14:30',
  103. registeredCount: 30,
  104. maxCount: 30,
  105. image: '/static/bannerImage.png'
  106. }
  107. ]
  108. },
  109. {
  110. date: '2025-06-16',
  111. weekday: '周一',
  112. activities: [
  113. {
  114. id: 4,
  115. duration: '30分',
  116. title: '关爱自闭症儿童活动',
  117. location: '长沙市雨花区时代阳光大道国际大厦2145',
  118. time: '2025-06-12 14:30',
  119. registeredCount: 30,
  120. maxCount: 30,
  121. image: '/static/bannerImage.png'
  122. }
  123. ]
  124. }
  125. ]
  126. }
  127. },
  128. methods: {
  129. viewActivityDetail(activity) {
  130. // 跳转到活动详情页面
  131. uni.navigateTo({
  132. url: `/subPages/index/activityDetail?id=${activity.id}`
  133. });
  134. },
  135. getActivityData() {
  136. // 获取活动数据的方法
  137. // 实际项目中这里应该调用API获取数据
  138. console.log('获取活动日历数据');
  139. }
  140. },
  141. onLoad() {
  142. this.getActivityData();
  143. }
  144. }
  145. </script>
  146. <style lang="scss" scoped>
  147. // @import '@/uni.scss';
  148. .activity-calendar {
  149. background-color: #f5f5f5;
  150. min-height: 100vh;
  151. .calendar-content {
  152. padding: 40rpx 30rpx;
  153. .day-section {
  154. margin-bottom: 60rpx;
  155. &:last-child {
  156. margin-bottom: 0;
  157. }
  158. .date-header {
  159. display: flex;
  160. align-items: center;
  161. margin-bottom: 30rpx;
  162. .calendar-icon {
  163. width: 48rpx;
  164. height: 48rpx;
  165. margin-right: 20rpx;
  166. }
  167. .date-text {
  168. font-size: 32rpx;
  169. font-weight: bold;
  170. color: $uni-color-primary;
  171. }
  172. }
  173. .activities-container {
  174. .activity-item {
  175. background: #ffffff;
  176. // border-radius: 16rpx;
  177. padding: 24rpx;
  178. margin-bottom: 20rpx;
  179. // box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
  180. display: flex;
  181. align-items: flex-start;
  182. transition: all 0.3s ease;
  183. position: relative;
  184. &:last-child {
  185. margin-bottom: 0;
  186. }
  187. &:active {
  188. transform: scale(0.98);
  189. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.12);
  190. }
  191. .activity-image {
  192. width: 190rpx;
  193. height: 190rpx;
  194. border-radius: 8rpx;
  195. margin-right: 20rpx;
  196. }
  197. .activity-info {
  198. flex: 1;
  199. display: flex;
  200. flex-direction: column;
  201. justify-content: space-between;
  202. .title-row {
  203. display: flex;
  204. align-items: center;
  205. margin-bottom: 10rpx;
  206. .activity-badge {
  207. width: 31px;
  208. height: 20px;
  209. background: #218cdd;
  210. border-radius: 3.5px;
  211. margin-right: 7rpx;
  212. display: flex;
  213. align-items: center;
  214. justify-content: center;
  215. .badge-text {
  216. font-size: 18rpx;
  217. color: #fff;
  218. }
  219. }
  220. }
  221. .activity-title {
  222. font-size: 28rpx;
  223. font-weight: bold;
  224. color: $uni-text-color;
  225. overflow: hidden;
  226. text-overflow: ellipsis;
  227. white-space: nowrap;
  228. }
  229. .activity-location,
  230. .activity-time,
  231. .activity-participants {
  232. display: flex;
  233. align-items: center;
  234. margin-bottom: 6rpx;
  235. .location-text,
  236. .time-text,
  237. .participants-text {
  238. font-size: 24rpx;
  239. color: $uni-text-color-grey;
  240. margin-left: 6rpx;
  241. overflow: hidden;
  242. text-overflow: ellipsis;
  243. white-space: nowrap;
  244. flex: 1;
  245. }
  246. }
  247. }
  248. .activity-action {
  249. position: absolute;
  250. bottom: 20rpx;
  251. right: 20rpx;
  252. .detail-btn {
  253. background: #218CDD;
  254. border-radius: 26rpx;
  255. width: 140rpx;
  256. height: 52rpx;
  257. text-align: center;
  258. // line-height: 44rpx;
  259. .detail-btn-text {
  260. font-size: 26rpx;
  261. color: #ffffff;
  262. font-weight: 500;
  263. }
  264. }
  265. .detail-btn:active {
  266. background: #1976C7;
  267. transform: scale(0.95);
  268. }
  269. }
  270. }
  271. }
  272. }
  273. }
  274. }
  275. </style>