<template>
	<view class="page">
		<!-- 导航栏 -->

		<!-- 签到列表 -->
		<view class="content">
			<view v-if="list.length > 0" class="list">
				<view v-for="item in list" :key="item.id" class="activity-item" 							@click="checkinActivity(item)">
					<image class="activity-image" :src="item.image" mode="aspectFill"></image>
					<view class="activity-info">
						<view class="title-row">
							<view class="activity-badge">
								<text class="badge-text">{{ item.score }}分</text>
							</view>
							<text class="activity-title">{{ item.title }}</text>
						</view>
						<view class="activity-location">
							<uv-icon name="map-fill" size="14" color="#999"></uv-icon>
							<text class="location-text">{{ item.address }}</text>
						</view>
						<view class="activity-time">
							<uv-icon name="calendar" size="14" color="#999"></uv-icon>
							<text class="time-text">{{ item.activityTime }}</text>
						</view>
						<view class="activity-participants">
							<uv-icon name="account-fill" size="14" color="#999"></uv-icon>
							<text class="participants-text">{{ item.numActivity }}人已报名</text>
						</view>
					</view>
					<view class="activity-action">
						<uv-button 
							type="primary" 
							size="mini" 
							text="签到码" 
						></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'
export default {
	mixins: [MixinList],
	data() {
		return {
			list: [],
			mixinListApi: 'activity.queryActivityList',
		}
	},
	methods: {

		// 跳转到签到码界面
		checkinActivity(item) {
			uni.navigateTo({
				url: `/subPages/my/checkinCode?id=${item.id}`
			})
		}
	}
}
</script>

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

.content {
	padding: 20rpx;
}

.list {
	display: flex;
	flex-direction: column;
	gap: 20rpx;
}

.activity-item {
	display: flex;
	margin-bottom: 30rpx;
	background: #fff;
	border-radius: 12rpx;
	padding: 20rpx;
	box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
}

.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: 62rpx;
	height: 40rpx;
	background: #218cdd;
	border-radius: 7rpx;
	margin-right: 14rpx;
	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;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
}

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