<template>
  <div class="integralTask">
    <div class="img-bg">
      <img src="https://cdn.cunwuyun.cn/fengdu/img-jifenlist.png" alt="">
    </div>
    <div class="title">任务大厅</div>
    <div class="card-list">
      <div class="card" v-for="(item,index) in list" :key="index" @click="$linkTo('./taskDetail?id='+item.id)">
        <h4>{{ item.title }}</h4>
        <p>{{ item.detail }}</p>
        <div class="imgs" v-if="item.files">
          <image mode="aspectFill" v-for="(e, i) in item.files" :key="i" :src="e.url"/>
        </div>
        <div class="time">
          <div class="goin">
            <img src="https://cdn.cunwuyun.cn/fengdu/ic-jinchangshijian.png" alt="">
            <div class="label">进场时间：</div>
            <div class="value">{{ item.intoBegintime.substring(0, 16)}} 至 {{ item.intoEndtime.substring(0, 16) }}</div>
          </div>
          <div class="exit">
            <img src="https://cdn.cunwuyun.cn/fengdu/ic-lichangshijian.png" alt="">
            <div class="label">离场时间：</div>
            <div class="value">{{ item.exitBegintime.substring(0, 16) }} 至 {{ item.exitEndtime.substring(0, 16) }}</div>
          </div>
          <div class="type">
            <img src="https://cdn.cunwuyun.cn/fengdu/ic-renwuleixing.png" alt="">
            <div class="label">任务类型：</div>
            <div class="value">{{ item.type==0? '打卡得积分':'报名得积分' }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'integralTask',
  appName: '功德银行',
  data() {
    return {
      list: []
    }
  },
  methods: {
    getList() {
      this.$instance.post('/app/appintegraltask/list').then(res=> {
        if(res?.data) {
          this.list = res.data.records
        }
      })
    }
  },
  onShow() {
    uni.setNavigationBarTitle({
      title: '功德银行'
    });
    this.getList()
  },
}
</script>

<style lang="scss" scoped>
.integralTask {
  .img-bg {
    width: 100%;
    height: 216px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .title {
    font-size: 34px;
    font-weight: 500;
    color: #222222;
    padding: 0 32px;
    margin-top: 32px;
  }
  .card-list {
    padding: 24px 32px;
    box-sizing: border-box;
    .card {
      background: #FFF;
      color: #333333;
      border-radius: 16px;
      margin-bottom: 24px;
      h4 {
        padding: 24px 24px 0;
        box-sizing: border-box;
        font-size: 34px;
        font-weight: 500;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      p {
        padding: 16px 24px;
        box-sizing: border-box;
        font-size: 28px;
        font-weight: 400;
      }
      .imgs {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        padding: 16px 24px;
        box-sizing: border-box;

        image {
          height: 208px;
          width: 33.33%;
          padding-right: 12px;
          margin-bottom: 12px;
          box-sizing: border-box;

          &:nth-of-type(3n) {
            padding-right: 0;
          }
        }
      }

      .time {
        padding: 0 24px 24px;
        box-sizing: border-box;
        border-top: 2px solid #EEEEEE;
        & > div {
          margin-top: 16px;
        }
        .goin,
        .exit,
        .type {
          display: flex;
          img {
            width: 30px;
            height: 30px;
            align-self: center;
          }
          .label {
            font-size: 24px;
            font-weight: 400;
            color: #666666;
            align-self: center;
            width: 130px;
          }
          .value {
            color: #333333;
            font-size: 24px;
            font-weight: 400;
            width: calc(100% - 160px);
          }
        }
      }
    }
  }
}
</style>