<template>
	<view class="page">

		<!-- 收藏列表 -->
		<view class="content">
			<view v-if="list.length > 0" class="activity-list">
				<view class="activity-item" v-for="item in list" :key="item.id" @click="viewActivityDetail(item)">
					<image class="activity-image" :src="item.communityActivity.image" mode="aspectFill"></image>
					<view class="activity-info">
						<view class="title-row">
							<view class="activity-badge">
								<text class="badge-text">{{ item.communityActivity.score }}分</text>
							</view>
							<text class="activity-title">{{ item.communityActivity.title }}</text>
						</view>
						<view class="activity-location">
							<uv-icon name="map-fill" size="14" color="#999"></uv-icon>
							<text class="location-text">{{ item.communityActivity.address || '线上活动' }}</text>
						</view>
						<view class="activity-time">
							<uv-icon name="calendar" size="14" color="#999"></uv-icon>
							<text class="time-text">{{ item.communityActivity.activityTime }}</text>
						</view>
						<view class="activity-participants">
							<uv-icon name="account-fill" size="14" ></uv-icon>
							<text class="participants-text">报名人数：{{ item.communityActivity.numActivity  + '/' + item.communityActivity.numLimit }}</text>
						</view>
					</view>
					<view class="activity-action">
						<uv-button type="primary" size="mini" text="查看详情" @click.stop="viewActivityDetail(item)"></uv-button>
					</view>
				</view>
			</view>
			<view v-else class="empty">
				<uv-empty mode="data" text="暂无收藏活动"></uv-empty>
			</view>
		</view>

	</view>
</template>

<script>
import MixinList from '@/mixins/list.js'
export default {
	mixins: [MixinList],
	data() {
		return {
			mixinListApi: 'activity.queryActivityCollectionList',
		}
	},
	methods: {
		// 查看活动详情
		viewActivityDetail(item) {
			uni.navigateTo({
				url: `/subPages/index/activityDetail?id=${item.activityId}`
			})
		}
	}
}
</script>

<style lang="scss" scoped>
.page {
	background-color: #f5f5f5;
	min-height: 100vh;
}

.content {
	padding: 20rpx;
}

.activity-list {
	.activity-item {
		display: flex;
		margin-bottom: 30rpx;
		background: #fff;
		border-radius: 12rpx;
		padding: 20rpx;
		
		.activity-image {
			width: 180rpx;
			height: 180rpx;
			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: #333;
			}
			
			.activity-location, .activity-time, .activity-participants {
				display: flex;
				align-items: center;
				margin-bottom: 6rpx;
				
				.location-text, .time-text, .participants-text {
					font-size: 24rpx;
					color: #999;
					margin-left: 6rpx;
				}
			}
		}
		
		.activity-action {
			display: flex;
			align-items: flex-end;
			padding-bottom: 10rpx;
		}
	}
}

.empty {
	margin-top: 200rpx;
}
</style>