<template>
	<view class="activity">
		<zs-list mt="0" @load="loadMore" :status="status">
			<view class="item" v-for="item in list" :key="item.id" @click="goDetail(item.id)">
				<zs-img :src="item.activityCover" width="710rpx" height="320rpx"></zs-img>
				<view class="info">
					<view class="title">
						{{item.activityName}}
					</view>
					<view class="desc">
					活动时间: {{ item.activityStartTime }} 至 {{ item.activityEndTime }}
					</view>
				</view>
			</view>
			
		</zs-list>
	</view>
</template>

<script>
	import {activityList} from '@/api/activity'
	export default {
		data() {
			return {
				status: 'more',
				list:[],
				query:{
					currentPage:1,
					pageSize:10,
					shopId:0,
					state:2
				}
				
			}
		},
		methods: {
			loadMore(){
				this.activityList()
			},
			goDetail(id){
				uni.navigateTo({
					url:'/signUp/index?scene='+id
				})
			},
			activityList(){
				this.status = 'loading'
				activityList(this.query).then(res=>{
					if(res.state == 'Success'){
						this.list = this.list.concat(res.content.records)
						if (this.list.length >= res.content.total) {
							this.status = 'noMore'
						} else {
							this.status = 'more'
							this.query.pageCurrent++
						}
					}
				})
			}
		},
		onLoad() {
			// this.activityList()
		},
		onShareTimeline() {
		  return {
		    title: "慧研学惠生活",
		    query: "id=1",
		  };
		},
		onShareAppMessage() {
		  return {
		    title: "慧研学惠生活",
		    path: "/pages/activity/index",
		  };
		},
	}
</script>

<style lang="scss" scoped>
	.activity {
		padding: 20rpx;
		background: #F9F9F9;
		min-height: 100vh;
		.zs-list {
			.item{
				margin-bottom: 20rpx;
				border-radius: 16rpx 16rpx 16rpx 16rpx;
				.info{
					background: #fff;
					padding: 20rpx 24rpx;
					.title{
						font-size: 28rpx;
						color: #222222;
						width: 640rpx;
						white-space: nowrap;
						overflow: hidden;
						text-overflow: ellipsis;
					}
					.desc{
						font-size: 24rpx;
						color: #AAAAAA;
						overflow: hidden;
						text-overflow: ellipsis;
						/* 弹性伸缩盒子模型显示 */
						display: -webkit-box;
						/* 限制在一个块元素显示的文本的行数 */
						-webkit-line-clamp: 2;
						/* 设置或检索伸缩盒对象的子元素的排列方式 */
						-webkit-box-orient: vertical;
						margin-top: 20rpx;
					}
				}
			}
		}
	}
</style>