riku
2022-09-14 2206df0da6499846c78a358cf95ca33c218a5c5d
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
71
72
73
74
75
76
77
78
79
80
81
// pages/learn/learn.js
import ListPage from '../../../base/ListPage'
import b_fetch from '../behaviors/b_fetch'
import b_openFile from '../behaviors/b_openFile'
 
ListPage({
  behaviors: [b_fetch, b_openFile],
  /**
   * 页面的初始数据
   */
  data: {
    currentTab: 0,
    tabList: [{
        "name": "VOCs排放"
      },
      {
        "name": "台账"
      },
      {
        "name": "治理设施设备"
      },
      {
        "name": "在线监测设备"
      }
    ],
    banners: [
      {
        pic: '',
        url: '',
        fileType: ''
      },
    ],
    
  },
  
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getResources(1)
  },
 
  loadComplete() {
    this.getBanner()
  },
 
  getBanner() {
    let banners = []
    const results = this.data.results
    const max = results.length > 5 ? 5 : results.length
    for (let i = 0; i < max; i++) {
      const d = this.data.results[i]
      banners.push({
        pic: d.lrPicurl,
        url: d.lrBodyurl,
        fileType: d.lrResourcefiletype,
      })
    }
    this.setData({
      banners
    })
  },
 
  goto: function (e) {
    var url = ""
    var index = e.currentTarget.dataset.index
    switch (index) {
      case '0':
        url = '/pages/m_learn/learfile/learnfile'
        break;
      case '1':
        url = "/pages/m_learn/learncase/learncase"
        break;
    }
    if (url != "") {
      wx.navigateTo({
        url: url,
      })
    }
  }
})