<template>
  <view class="all_box">
    <u-empty v-if="list.length==0" icon="/static/img/empty/data.png" text="没有任务"></u-empty>
    <view v-else class="task_list">
      <!-- <taskCard class="task_card" v-for="item in 10" :key="item"></taskCard> -->
      <view v-for="item in list" :key="item.id">
        <task-item :datas="item"></task-item>
      </view>
    </view>
    <!-- <u-loadmore v-else :status="loadConfig.status" :loading-text="loadConfig.loadingText"
        :loadmore-text="loadConfig.loadmoreText" :nomore-text="loadConfig.nomoreText" /> -->
  </view>
</template>

<script>
  import { getTaskListApi } from '@/api/oa'
  import { Toast } from '@/libs/uniApi.js'
  import taskItem from "@/components/task/taskItem.vue"
  import { taskLists } from "@/api/task.js"
  export default {
    components:{
      taskItem
    },
    data() {
      return {
        loadConfig:{
          page: 1,
          limit: 15,
          lastpage: '',
          loadingText: '努力加载中',
          loadmoreText: '轻轻上拉',
          nomoreText: '我也是有底线的~~',
          status: 'loadmore'
        },
        list: []
      }
    },
    onLoad() {
      this.loadList();
      uni.$on('initOaTask', this.loadList);
    },
    onShow() {
    },
    methods: {
      async loadList(){
        let res = await taskLists();
        this.list = res.data;
      }
    },
    onPullDownRefresh() {
      this.loadList();
      this.$u.sleep(500).then(()=>{uni.stopPullDownRefresh()});
    },
    onReachBottom() {
    },
  }
</script>

<style lang="scss" scoped>
 .task_list{
   padding-top: 28rpx;
 }
</style>
