<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">
				<!-- <image class="todo-icon" src="/static/icon_todo@2x.png" /> -->
				<!-- <u-icon name="list-dot"></u-icon> -->
				<u-avatar :text="dataSource.userName.slice(1)" fontSize="14" size="48" randomBgColor></u-avatar>
			</view>
			<view class="contain">
				<view class="content">
					<slot name="title">
						<text class="content-text">
							{{dataSource.userName}}
						</text>
					</slot>
				</view>
				<view class="content-bottom">
					<view class="todoCount" v-if="dataSource.todoCount!==0">
						{{dataSource.todoCount>99?'99+':dataSource.todoCount}}
					</view>
					
					<!-- <view style="display: flex;flex-direction: row;justify-content: space-between;">
						<u-icon name="arrow-right"></u-icon>
					</view> -->
				</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		props: {
			dataSource: {
				type: Object,
				default () {
					return {}
				}
			},
		},
		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: 20px;
		/*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: center;
	}

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

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

	.task-card .card-body .contain {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		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: 20px;
		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;
	}
	.todoCount {
		font-size: 12px;
		color: #fff;
		background-color: #3c9cff;  /* #f56c6c */
		border-radius: 20px;
		/* width: 25px;
		height: 25px; */
		padding: 2px 7px;
		display: flex;
		text-align: center;
		align-items: center;
		justify-content: center;
	}
</style>