<template>
  <div class="todo">
    <div class="todoList">
      <van-list
        v-model="isUpLoading"
        :finished="upFinished"
        :immediate-check="false"
        :offset="10"
        finished-text="加载完成"
        @load="onLoadList"
      >
        <div
          class="info-item"
          v-for="item in todoList"
          :key="item.id"
          @click="goDetails(item)"
        >
          <div class="info-top">
            <!-- <div class="left"></div> -->
            <div class="right">
              <p class="tit">
                {{ item.title }}
              </p>

              <!-- <p class="txt">确认时间：{{ item.checkTime }}</p> -->
            </div>
          </div>
        </div>
      </van-list>
    </div>
  </div>
</template>
  <script>
import auth from "@/service/auth";
import { isFirstLogin } from "@/service/api_company.js";
import { handleList } from "@/service/todo.js";
import { Toast } from "vant";
export default {
  data() {
    return {
      search: {
        type: "8,12",
        pageSize: 10,
        pageNum: 1,
      },
      upFinished: false,
      todoList: [],
    };
  },
  created() {},
  mounted() {
    this.handleList();
  },
  methods: {
    goDetails(item) {
      console.log(item);
      if (item.handleType == 12) {
        this.$router.push({
          path: "/saveCallbackHandle?" + item.routeParam,
        });
      }
      if (item.handleType == 8) {
        this.$router.push({
          path: "/modifyHandleDetail?" + item.routeParam,
        });
      }
    },
    async handleList() {
      this.search.userId = auth.currUser().id;
      let data = await handleList(this.search);
      console.log(data);
      if (this.todoList.length == data.total) {
        this.upFinished = true;
        return;
      }
      this.todoList = data.rows;
    },
  },
};
</script>
  <style lang="scss">
.todo {
  .pending-btn {
    color: $fc;
    background-color: $red;
  }
  .accepted-btn {
    color: $fc;
    background-color: $color2;
  }
  .processed-btn {
    color: $fc;
    background-color: $orange;
  }
  .evaluated-btn {
    color: $fc;
    background-color: $green;
  }
  .btn-view {
    width: 100%;
    height: 100px;
    padding: 20px 10%;
    background-color: #ffffff;
    position: fixed;
    bottom: 0;
    left: 0;
  }
  .uni-select_2 {
    font-size: 22px;
    border: 2px solid #e5e5e5;
    box-sizing: border-box;
    border-radius: 8px;
    padding: 0 10px;
    padding-left: 20px;
    position: relative;
    display: flex;
    -webkit-user-select: none;
    user-select: none;
    flex-direction: row;
    align-items: center;
    border-bottom: solid 2px #e5e5e5;
    width: 100%;
    flex: 1;
    height: 70px;
    color: #6a6a6a;
  }
  .btn {
    width: 80%;
    height: 90px;
    border-radius: 50px 50px 50px 50px;
    background: #1d18bc;
    line-height: 90px;
    color: white;
  }
  .top-add {
    background-color: #fff;
    padding: 30px;
    text-align: right;
    box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.05);
    i {
      font-size: 36px;
      color: $text6;
      margin-right: 15px;
    }
    .txt {
      font-size: 32px;
      color: $text6;
    }
  }

  .todoList {
    .info-item {
      background-color: #fff;
      padding: 20px 30px;
      margin-bottom: 20px;
      .info-top {
        @include flex;
        .left {
          width: 286px;
          height: 168px;
          font-size: 0;
          border-radius: 10px;
          overflow: hidden;
          img {
            width: 100%;
            height: 100%;
          }
        }
        .right {
          align-self: flex-start;
          .tit {
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 2;
            overflow: hidden;
            text-overflow: ellipsis;
            font-size: 32px;
            line-height: 1.4;
            font-weight: bold;
            color: #333333;
            @include line-clamp;
          }
          .txt {
            font-size: 28px;
            color: #666;
          }
        }
      }

      .info-bottom {
        margin-top: 20px;
        padding-top: 20px;
        border-top: 1px dashed #dbdbdb;
        @include flex;
        .left {
          i {
            font-size: 30px;
            color: #999999;
            margin-left: 10px;
          }
          span {
            font-size: 28px;
            color: #999999;
          }
        }
        .right {
        }
      }
    }
  }
}
</style>
  