<template>
	<view class="bg">
		<image :src="topImg" mode="aspectFill" class="topImg"></image>
		
		<view class="box">
			<view v-for="(item,index) in list" :key="index" class="item" @click="gotoWebUrl(item)">
				<image :src="showImg(item.image)" mode="aspectFill" class="img"></image>
				<view class="content flex-column">
					<view class="title text-overflow">{{item.title}}</view>
					<view class="subtitle text-overflow">活动时间：{{ item.start_time }}—{{ item.end_time }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				topImg: '',
				list: [],
				pageNo: 1,
				limit: 10,
				isLoading: false
			}
		},
		onReady() {
			this.pageNo = 1
			this.getList()
			this.getTopImg()
		},
		onReachBottom() {
			setTimeout(() => {
				if (!this.isLoading) this.getList();
			}, 500);
		},
		methods: {
			async getTopImg() {
				this.topImg = await this.getHeadImg('peripheralActivity')
			},
			getList() {
				this.Post({
					date: '',
					offset: this.list.length,
					limit: this.limit,
					type_id: 6
				},'/api/activity/getActivityCalendar').then(res => {
					this.calendarItem = res.data[0]
					if(res.data.length < this.limit) this.isLoading = true
					this.list = this.list.concat(res.data)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.bg {
		width: 750rpx;
		min-height: 100vh;
		background: #F7F7F7;
	}
	
	.topImg {
		width: 100%;
		height: 533.33rpx;
	}
	
	.box {
		position: relative;
		top: -217rpx;
		
		.item {
			width: 697rpx;
			height: 417rpx;
			background: rgba(255,255,255,0.6);
			box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(89,166,160,0.32);
			border-radius: 13rpx;
			margin: 0 auto 30rpx;
			
			.img {
				width: 697rpx;
				height: 300rpx;
				border-radius: 13rpx 13rpx 0rpx 0rpx;
				display: block;
			}
			
			.content {
				height: 117rpx;
				padding: 0 22rpx;
				justify-content: space-around;
				
				.title {
					font-weight: bold;
					font-size: 31rpx;
					color: #111111;
				}
				
				.subtitle {
					font-weight: 500;
					font-size: 24rpx;
					color: #111111;
				}
			}
		}
	}
</style>