<template>
	<view class="">
		<view class="card" style="display: flex;" v-for="(item,index) in cardList" :key="index">
			<view v-if="checkAllShow" class="center" style="width: 10%;background-color: #F1F1F1;">
				<u-checkbox shape="circle" @change="checkboxChange" v-model="item.checked" :name="index"></u-checkbox>
			</view>
			<navigator :url="`/pages/publish/detail?id=${item.id}&current=${current}`" hover-class="none" class="" >
				<image class="bg" :src="item.pic"></image>
				<view class="content">
					<text class="text-cut-1 title">{{item.title}}</text>
					<view class="cu-tag btn-bg-color round sm tag" v-for="(item1,index1) in item.labels" :key="index1">
						{{item1}}
					</view>
		
					<view class="time">
						<text>报名截至时间：{{item.endTime}}</text>
					</view>
				</view>
				<image v-if="item.auditStatus==0" class="status" src="@/static/icon/await.png" mode="widthFix"></image>
				<image v-if="item.auditStatus==1" class="status" src="@/static/icon/pass1.png" mode="widthFix"></image>
				<image v-if="item.auditStatus==2" class="status" src="@/static/icon/fail.png" mode="widthFix"></image>
			</navigator>
		</view>
		
		<block v-if="checkAllShow">
			<view class="" style="height: 110rpx;"></view>
			<view class="bottom-bar" >
				<view class="left">
					<u-checkbox @change="checkAllChange" shape="circle" v-model="checkAll" >全选</u-checkbox>
				</view>
				<view @click="operate" class="btn-bg-color center right">
					<text v-if="current==0">结束活动</text>
					<text v-if="current==1">参加活动</text>
					<text v-if="current==2">退出活动</text>
				</view>
			</view>
		</block>
	</view>
</template>

<script>
	export default{
		props:{
			cardList:Array,
			current:Number
		},
		data(){
			return {
				checkAllShow:false,
			}
		},
		computed:{
			checkAll:{
				get(){
					let tmpList= this.cardList.filter(item=>item.checked == true)
					if (tmpList.length == this.cardList.length) {
						return true
					}
					return false
				},
				set(){
					
				}
			}
		},
		methods: {
			showCheckAll(){
				this.checkAllShow=!this.checkAllShow
			},
			hideCheckAll(){
				this.checkAllShow=false
			},
			checkboxChange(e) {
				this.$emit('checkboxChange',e)
			},
			checkAllChange(e){
				this.$emit('checkAllChange',e)
			},
			operate(){
				this.$emit('operate')
			}
		}
		
	}
</script>

<style lang="scss" scoped>
	.bottom-bar {
		position: fixed;
		bottom: 0;
		z-index: 99;
		width: 100%;
		background-color: #FFFFFF;
		height: 100rpx;
		display: flex;
	
		.left {
			width: 70%;
			display: flex;
			flex-direction: column;
			justify-content: center;
			padding-left: 30rpx;
		}
	
		.right {
			width: 30%;
		}
	}
	
	.card {
		overflow: hidden;
		position: relative;
		background-color: #FFFFFF;
		margin: 20rpx;
		border-radius: 20rpx;
	
		.bg {
			border-radius: 20rpx 20rpx 0 0;
			width: 100vw;
			height: 250rpx;
		}
	
		.status {
			position: absolute;
			right: 0;
			bottom: -10rpx;
			width: 100rpx;
		}
	
		.content {
			padding: 10rpx 20rpx;
	
			.title {
				font-weight: 800;
				font-size: 30rpx;
			}
	
			.tag {
				padding: 20rpx 32rpx;
				margin: 20rpx 20rpx 20rpx 0;
			}
	
			.time {
				font-size: 24rpx;
				margin-bottom: 20rpx;
			}
	
	
		}
	}
</style>
