<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" hover-class="none" class="" >
				<image class="bg" src="@/static/del/del.png"></image>
				<view class="content">
					<text class="text-cut-1 title">消费新势能 老品牌向新网红的跃迁之路！{{item.id}}</text>
					<block>
						<view class="cu-tag btn-bg-color round sm tag" v-for="(item,index) in 3" :key="index">
							天河区
						</view>
						<!-- <text class="text-gray margin-top-10">...</text> -->
					</block>
		
					<view class="time">
						<text>报名截至时间：2021.07.08</text>
					</view>
				</view>
				<image v-if="item.status==0" class="status" src="@/static/icon/fail.png" mode="widthFix"></image>
				<image v-if="item.status==1" class="status" src="@/static/icon/pass1.png" mode="widthFix"></image>
				<image v-if="item.status==2" class="status" src="@/static/icon/await.png" mode="widthFix"></image>
			</navigator>
		</view>
		
		<block v-if="checkAllShow & current!=2">
			<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 class="btn-bg-color center right">
					<text v-if="current==0">结束活动</text>
					<text v-if="current==1">参加活动</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
			},
			checkboxChange(e) {
				this.$emit('checkboxChange',e)
			},
			checkAllChange(e){
				this.$emit('checkAllChange',e)
			}
		}
		
	}
</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>
