188 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			188 lines
		
	
	
		
			4.1 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<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 class="content">
 | 
						||
          <text class="content-text">
 | 
						||
            {{dataSource.title}}
 | 
						||
          </text>
 | 
						||
        </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="status">{{statusToText(dataSource.status)}}</text>-->
 | 
						||
              <text :class="dataSource.textStatus === '正常' ? 'status' : 'status warn'">{{dataSource.textStatus}}</text>
 | 
						||
            </view>
 | 
						||
          </slot>
 | 
						||
        </view>
 | 
						||
      </view>
 | 
						||
    </view>
 | 
						||
  </view>
 | 
						||
</template>
 | 
						||
<script>
 | 
						||
  export default {
 | 
						||
    props: {
 | 
						||
      dataSource: {
 | 
						||
        type: Object,
 | 
						||
        default() {
 | 
						||
          return {}
 | 
						||
        }
 | 
						||
      },
 | 
						||
      icon: {
 | 
						||
        type: Boolean,
 | 
						||
        default: false
 | 
						||
      }
 | 
						||
    },
 | 
						||
    methods: {
 | 
						||
      statusToText(s) {
 | 
						||
        // TODO: 任务状态 0-待处理
 | 
						||
        switch (s) {
 | 
						||
        case 0:
 | 
						||
          return '待处理'
 | 
						||
        default:
 | 
						||
          return '已处理'
 | 
						||
        }
 | 
						||
      },
 | 
						||
      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;
 | 
						||
  }
 | 
						||
 | 
						||
  .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;
 | 
						||
  }
 | 
						||
 | 
						||
  .task-card .card-body .content-text {
 | 
						||
    color: #333333;
 | 
						||
    line-height: 24px;
 | 
						||
    font-weight: bold;
 | 
						||
    font-size: 16px;
 | 
						||
    flex: 1;
 | 
						||
  }
 | 
						||
 | 
						||
  .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>
 |