riku
2025-04-27 f46786f11c5c08ead7501a82e5a71430ad69b782
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import dayjs from 'dayjs';
 
import { useLoading } from '../../../behaviors/loading';
import { useOptions } from './options-proxy.js';
import { useStatistic } from './statistic-proxy.js';
import { useTasks } from './tasks-proxy.js';
 
const app = getApp();
 
Page({
  behaviors: [useLoading, useOptions, useStatistic, useTasks],
 
  data: {
    userInfo: app.globalData.userInfo,
    clueTaskList: [],
  },
 
  onLoad(options) {},
 
  onShow() {
    if (this.getTabBar()) {
      this.getTabBar().init();
    }
    // this.refresh();
  },
 
  onPullDownRefresh() {
    this._startLoad();
  },
 
  onReachBottom() {
    this._loadMore();
  },
 
  /**
   * 初始加载
   * 当所有筛选条件都获取到初始值后,执行一次初始化加载
   * 包括区域、时间两个选项,全部获取初始值后,执行加载
   * @see options-proxy.js
   */
  optionsCount: 0,
  init() {
    this.optionsCount++;
    this.refresh();
  },
 
  refresh() {
    if (this.optionsCount >= 2) this._startLoad();
  },
 
  _fetchData(page) {
    const array = [];
    array.push(this.searchClueTask(page));
    if (page == 1) {
      array.push(this.fetchClueTaskSummary(page));
    }
    return Promise.all(array).then(res => {
      return res[0].head;
    });
  },
 
  _getOptions() {
    const { location, time } = this.data;
    return {
      ...location,
      startTime: dayjs(time).startOf('month').format('YYYY-MM-DD HH:mm:ss'),
      endTime: dayjs(time).endOf('month').format('YYYY-MM-DD HH:mm:ss'),
    };
  },
});