<template>
	<view class="task-card" @click="handleClick">
		<view class="content-status">
			<text :class="dataSource.status === 0 ? 'status normal' : 'status warn'">{{dataSource.statusText}}</text>
		</view>
		<view class="card-body">
			<view class="left" v-if="icon">
				<!-- <image class="todo-icon" src="/static/icon_todo@2x.png" /> -->
				<u-icon name="list-dot"></u-icon>
			</view>
			<view class="contain">
				<view class="content">
					<slot name="title">
						<text class="content-text">
							{{dataSource.title}}
						</text>
					</slot>
				</view>
				<view class="content-bottom">
					<slot>
						<view class="date-time">
							<view class="start-time time">
								<text class="green point"></text>
								<text class="label">开始时间：</text>
								<text class="value">{{dataSource.startTime}}</text>
							</view>
							<view class="end-time time">
								<text class="red point"></text>
								<text class="label">截止时间：</text>
								<text class="value">{{dataSource.endTime}}</text>
							</view>
						</view>
						<!-- <view class="content-status">
              <text :class="dataSource.status === 0 ? 'status normal' : 'status warn'">{{dataSource.statusText}}</text>
            </view> -->
						<view style="display: flex;flex-direction: row;justify-content: space-between;">
							<!-- <view style="margin-right: 30px;">
					 <text :class="dataSource.status === 0 ? 'status normal' : 'status warn'">{{dataSource.statusText}}</text>
				</view> -->
							<u-icon name="arrow-right"></u-icon>
						</view>
					</slot>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		props: {
			dataSource: {
				type: Object,
				default () {
					return {}
				}
			},
			icon: {
				type: Boolean,
				default: false
			},
		},
		methods: {
			handleClick() {
				this.$emit('click', this.dataSource)
			}
		}
	}
</script>
<style scoped>
	.task-card {
		border-radius: 8px;
		margin-bottom: 12px;
		font-size: 14px;
		overflow: hidden;
		/*display: flex;*/
		/*flex-direction: row;*/
		padding:10px 14px 14px 14px;
		/*box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1);*/
		/*box-sizing: border-box;*/
		/* #ifndef APP-NVUE */
		box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1);
		/* #endif */
		/*#ifdef APP-NVUE */
		border: 1px solid rgba(0, 0, 0, 0.1);
		/*#endif */
	}

	.task-card .card-body {
		display: flex;
		flex-direction: row;
		align-items: flex-start;
	}

	.task-card .card-body .left {
		margin-right: 4px;
		width: 20px;
		padding-top: 4px;
	}

	.task-card .card-body .left .todo-icon {
		width: 16px;
		height: 16px;
	}

	.task-card .card-body .contain {
		flex: 1;
	}

	.task-card .card-body .content {
		margin-bottom: 6px;
		display: flex;
		flex-direction: row;
		align-items: center;
		margin-right: 40px;
	}

	.task-card .card-body .content-text {
		color: #333333;
		line-height: 24px;
		font-weight: bold;
		font-size: 14px;
		flex: 1;
		/* #ifndef APP-NVUE */
		display: block;
		/* #endif */

	}

	.task-card .card-body .content-bottom {
		display: flex;
		flex-direction: row;
		align-items: flex-start;
	}

	.task-card .card-body .date-time {
		flex: 1
	}

	.content-status {
		/* width: 56px; */
		position: absolute;
		top: 0;
		right: 0;
	}

	.status {
		background: rgba(255, 87, 51, 0.2);
		color: rgba(255, 87, 51, 1);
		text-align: center;
		font-size: 12px;
		/* width: 56px;
    height: 20px; */
		/* line-height: 18px; */
		border-radius: 0px 8px 0px 8px;
	}

	.status.normal {
		background: rgba(70, 188, 170, 1.0);
		/* color: rgba(0, 161, 64, 1); */
		color: #fff;
		padding: 3px 14px;
	}

	.status.warn {
		background: rgba(243, 121, 95, 1.0);
		/* color: rgba(202, 158, 3, 1); */
		color: #fff;
		padding: 3px 14px;
	}

	.task-card .card-body .time {
		font-weight: 400;
		line-height: 18px;
		color: #333333;
		display: flex;
		flex-direction: row;
		margin-top: 4px;
		align-items: center;
	}

	.task-card .card-body .time .point {
		width: 8px;
		height: 8px;
		border-radius: 50%;
		margin-right: 8px;
	}

	.task-card .card-body .time .point.green {
		background: #3a9d8d;
	}

	.task-card .card-body .time .point.red {
		background: #f34e16;
	}

	.task-card .card-body .label {
		color: #666666;
		font-size: 12px;
	}

	.task-card .card-body .value {
		font-size: 12px;
	}
</style>