riku
2025-04-22 45be153eaef9e1c1a3fe21515e9cbd785fba8e1f
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
import { useLoading } from '../../../behaviors/loading';
import { useOptions } from './options-proxy.js';
import { useStatistic } from './statistic-proxy.js';
import { useTasks } from './tasks-proxy.js';
 
import clueApi from '../../../services/clue/fetchClue';
 
const app = getApp();
 
Page({
  behaviors: [useLoading, useOptions, useStatistic, useTasks],
 
  data: {
    userInfo: app.globalData.userInfo,
    clueTaskList: [],
  },
 
  onLoad(options) {},
 
  onShow() {
    this.getTabBar().init();
  },
 
  onPullDownRefresh() {
    this._startLoad();
  },
 
  onReachBottom() {
    this._loadMore();
  },
 
  /**
   * 初始加载
   * 当所有筛选条件都获取到初始值后,执行一次初始化加载
   * 包括区域、时间两个选项,全部获取初始值后,执行加载
   * @see options-proxy.js
   */
  optionsCount: 0,
  init() {
    this.optionsCount++;
    if (this.optionsCount == 2) this._startLoad();
  },
 
  _fetchData(page) {
    return clueApi.fetchClueTask({}).then(res => {
      this.setData({ clueTaskList: res.data });
      this.calClueCount();
      this.formatClueTask();
    });
  },
});