|
|
- <template>
- <view class="activity-calendar">
- <!-- 活动列表 -->
- <view class="calendar-content">
- <view
- v-for="(dayData, index) in activityData"
- :key="index"
- class="day-section"
- >
- <!-- 日期和日历图标 (在容器外部) -->
- <view class="date-header">
- <image
- src="/subPages/static/活动日历_图标@2x.png"
- class="calendar-icon"
- ></image>
- <text class="date-text">{{ dayData.date }} ({{ dayData.weekday }})</text>
- </view>
-
- <!-- 活动列表容器 -->
- <view class="activities-container">
- <view
- v-for="(activity, actIndex) in dayData.activities"
- :key="actIndex"
- class="activity-item"
- @click="viewActivityDetail(activity)"
- >
- <!-- 活动图片 -->
- <image class="activity-image" :src="activity.image" mode="aspectFill"></image>
-
- <!-- 活动信息 -->
- <view class="activity-info">
- <view class="title-row">
- <view class="activity-badge">
- <text class="badge-text">{{ activity.duration }}</text>
- </view>
- <text class="activity-title">{{ activity.title }}</text>
- </view>
-
- <view class="activity-location">
- <uv-icon name="map-fill" size="14" color="#999"></uv-icon>
- <text class="location-text">{{ activity.location }}</text>
- </view>
-
- <view class="activity-time">
- <uv-icon name="calendar" size="14" color="#999"></uv-icon>
- <text class="time-text">{{ activity.time }}</text>
- </view>
-
- <view class="activity-participants">
- <uv-icon name="account-fill" size="14" color="#999"></uv-icon>
- <text class="participants-text">{{ activity.registeredCount }}/{{ activity.maxCount }}人已报名</text>
- </view>
- </view>
-
- <!-- 查看详情按钮 -->
- <view class="activity-action">
- <view class="detail-btn" @click.stop="viewActivityDetail(activity)">
- <text class="detail-btn-text">查看详情</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
-
- <script>
- export default {
- name: 'ActivityCalendar',
- data() {
- return {
- activityData: [
- {
- date: '2025-06-09',
- weekday: '周一',
- activities: [
- {
- id: 1,
- duration: '30分',
- title: '关爱自闭症儿童活动',
- location: '长沙市雨花区时代阳光大道国际大厦2145',
- time: '2025-06-12 14:30',
- registeredCount: 30,
- maxCount: 30,
- image: '/static/bannerImage.png'
- },
- {
- id: 2,
- duration: '30分',
- title: '关爱自闭症儿童活动',
- location: '长沙市雨花区时代阳光大道国际大厦2145',
- time: '2025-06-12 14:30',
- registeredCount: 30,
- maxCount: 30,
- image: '/static/bannerImage.png'
- }
- ]
- },
- {
- date: '2025-06-10',
- weekday: '周五',
- activities: [
- {
- id: 3,
- duration: '30分',
- title: '关爱自闭症儿童活动',
- location: '长沙市雨花区时代阳光大道国际大厦2145',
- time: '2025-06-12 14:30',
- registeredCount: 30,
- maxCount: 30,
- image: '/static/bannerImage.png'
- }
- ]
- },
- {
- date: '2025-06-16',
- weekday: '周一',
- activities: [
- {
- id: 4,
- duration: '30分',
- title: '关爱自闭症儿童活动',
- location: '长沙市雨花区时代阳光大道国际大厦2145',
- time: '2025-06-12 14:30',
- registeredCount: 30,
- maxCount: 30,
- image: '/static/bannerImage.png'
- }
- ]
- }
- ]
- }
- },
- methods: {
- viewActivityDetail(activity) {
- // 跳转到活动详情页面
- uni.navigateTo({
- url: `/subPages/index/activityDetail?id=${activity.id}`
- });
- },
-
- getActivityData() {
- // 获取活动数据的方法
- // 实际项目中这里应该调用API获取数据
- console.log('获取活动日历数据');
- }
- },
-
- onLoad() {
- this.getActivityData();
- }
- }
- </script>
-
- <style lang="scss" scoped>
- // @import '@/uni.scss';
-
- .activity-calendar {
- background-color: #f5f5f5;
- min-height: 100vh;
-
- .calendar-content {
- padding: 40rpx 30rpx;
-
- .day-section {
- margin-bottom: 60rpx;
-
- &:last-child {
- margin-bottom: 0;
- }
-
- .date-header {
- display: flex;
- align-items: center;
- margin-bottom: 30rpx;
-
- .calendar-icon {
- width: 48rpx;
- height: 48rpx;
- margin-right: 20rpx;
- }
-
- .date-text {
- font-size: 32rpx;
- font-weight: bold;
- color: $uni-color-primary;
- }
- }
-
- .activities-container {
- .activity-item {
- background: #ffffff;
- // border-radius: 16rpx;
- padding: 24rpx;
- margin-bottom: 20rpx;
- // box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
- display: flex;
- align-items: flex-start;
- transition: all 0.3s ease;
- position: relative;
-
- &:last-child {
- margin-bottom: 0;
- }
-
- &:active {
- transform: scale(0.98);
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.12);
- }
-
- .activity-image {
- width: 190rpx;
- height: 190rpx;
- border-radius: 8rpx;
- margin-right: 20rpx;
- }
-
- .activity-info {
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
-
- .title-row {
- display: flex;
- align-items: center;
- margin-bottom: 10rpx;
-
- .activity-badge {
- width: 31px;
- height: 20px;
- background: #218cdd;
- border-radius: 3.5px;
- margin-right: 7rpx;
- display: flex;
- align-items: center;
- justify-content: center;
-
- .badge-text {
- font-size: 18rpx;
- color: #fff;
- }
- }
- }
-
- .activity-title {
- font-size: 28rpx;
- font-weight: bold;
- color: $uni-text-color;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- .activity-location,
- .activity-time,
- .activity-participants {
- display: flex;
- align-items: center;
- margin-bottom: 6rpx;
-
- .location-text,
- .time-text,
- .participants-text {
- font-size: 24rpx;
- color: $uni-text-color-grey;
- margin-left: 6rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- flex: 1;
- }
- }
- }
-
- .activity-action {
- position: absolute;
- bottom: 20rpx;
- right: 20rpx;
-
- .detail-btn {
- background: #218CDD;
- border-radius: 26rpx;
- width: 140rpx;
- height: 52rpx;
- text-align: center;
- // line-height: 44rpx;
- .detail-btn-text {
- font-size: 26rpx;
- color: #ffffff;
- font-weight: 500;
- }
- }
-
- .detail-btn:active {
- background: #1976C7;
- transform: scale(0.95);
- }
- }
- }
- }
- }
- }
- }
- </style>
|