<template>
  <view class="task-card" @click="handleClick">
    <view class="card-body">
      <view class="left" v-if="icon">
        <image class="todo-icon" src="/static/icon_todo@2x.png" />
      </view>
      <view class="contain">
		  <view>
			<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>
          </slot>
        </view>  
		  </view>
		 
			  <view style="display: flex;align-items: center;" v-if="arrow===true">
			  	<u-icon name="arrow-right"></u-icon>
			  </view>
		  
        
      </view>
    </view>
  </view>
</template>
<script>
  export default {
    props: {
      dataSource: {
        type: Object,
        default() {
          return {}
        }
      },
      icon: {
        type: Boolean,
        default: false
      },
	  arrow: {
	    type: Boolean,
	    default: true
	  }
    },
    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: 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;
	display:flex;
	 flex-direction: row;
	 justify-content:space-between
  }

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

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

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

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

  .task-card .card-body .content-status {
    width: 56px;
  }

  .task-card .card-body .status {
    background: rgba(255, 87, 51, 0.2);
    color: rgba(255, 87, 51, 1);
    text-align: center;
    font-size: 12px;
    width: 56px;
    height: 18px;
    line-height: 18px;
    border-radius: 2px;
  }

  .task-card .card-body .status.normal {
    background: rgba(0, 161, 64, 0.2);
    color: rgba(0, 161, 64, 1);
  }

  .task-card .card-body .status.warn {
    background: rgba(202, 158, 3, 0.2);
    color: rgba(202, 158, 3, 1);
  }

  .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: 4px;
  }

  .task-card .card-body .time .point.green {
    background: #00A140;
  }

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

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

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