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
import { useLoading } from '../../../behaviors/loading';
import { useConclusion } from './conclusion-proxy.js';
import { useQuestion } from './question-proxy.js';
 
import { fetchClue, fetchClueInternal } from '../../../services/clue/fetchClue';
 
Page({
  behaviors: [useLoading, useConclusion, useQuestion],
 
  data: {
    clue: {},
  },
 
  onLoad(options) {
    this.getOpenerEventChannel().on('acceptClueTask', data => {
      this.setData({
        clueTask: data,
      });
      this._startLoad();
    });
  },
 
  onPullDownRefresh() {
    this._startLoad();
  },
 
  onReachBottom() {
    this._loadMore();
  },
 
  /*********************************************************************************** */
  _fetchData(page) {
    const array = [];
    array.push(this.fetchClueQuestion());
    if (page == 1) {
      array.push(this.fetchClueData());
      array.push(this.fetchClueConclusion());
    }
    return Promise.all(array).then(res => {
      return res[0];
    });
  },
 
  fetchClueData() {
    const { clueTask } = this.data;
    const func = clueTask.internalTask ? fetchClueInternal : fetchClue;
    func({ cid: clueTask.clueId }).then(res => {
      if (res.data.length > 0) {
        this.setData({ clue: res.data[0] });
      }
    });
  },
 
  /*********************************************************************************** */
});