<template>
	<view>
		<view v-if="list.length>0">
			<view class="content" @click="xwtz('/pages/activity/activity?id='+item.id)" v-for="(item,index) in list" :key="index">
				<view class="box_item">
					<view class="box_left">
						<span class="f1">{{item.activityName}}</span>
						<span class="f2">{{item.eventStartDate?item.eventStartDate:'-'}}{{item.eventEndDate?'至'+item.eventEndDate:'-'}}</span>
					</view>
					<view class="box_right" v-if="item.activeImage">
						<view class="images">
							<image :src="BASE_URL + item.activeImage[0]" style="width: 100%;height: 100%;border-radius: 20rpx;" mode="aspectFill"></image>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view v-else style="width: 100%;text-align: center;margin-top: 100rpx;font-size: 30rpx;">
			暂无数据
		</view>
	</view>
</template>

<script>
	import BASE_URL from "@/common/config.js"
	export default {
		data() {
			return {
				BASE_URL,
				list: [],
				from:{
					activeStatus:'展示',
					activeType:''
				}
			}
		},
		onLoad(e) {
			if(e.activeType){
				this.from.activeType = e.activeType
			}
			this.getlist()
		},
		methods: {
			getlist() {
				this.API.getactivityInfoSheet(this.from).then(res => {
					console.log(res);
					for (let i = 0; i < res.rows.length; i++) {
						if(res.rows[i].activeImage) {
							res.rows[i].activeImage = res.rows[i].activeImage.split(',')
						}
						
					}
					this.list = res.rows
					
				})
			},
			xwtz(e) {
				uni.navigateTo({
					url: e
				})
			}
		}
	}
</script>

<style lang="scss">
	.content {
		padding: 20rpx;

		.box_item {
			background-color: #fff;
			display: flex;
			padding: 20rpx;
			border-radius: 20rpx;
			// height: 200rpx;

			.box_left {
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				width: 100%;
				// margin-right: 2%;

				.f1 {
					font-size: 35rpx;
					font-weight: 600;
					display: block;
					margin-bottom: 20rpx;
				}

				.f2 {
					color: #ababab;
				}
			}

			.box_right {
				width: 40%;

				.images {
					// background-color: #ababab;
					height: 160rpx;
					width: 100%;
					// background-image: url("http://antis14.sherkxuan.cn/assets/images/a1.png");
					// background-size: 100% 100%;
				}
			}
		}
	}
</style>