forked from nsjcy/frontEnd/nsjcy

liuwh
2020-06-09 5a887acf1924950715086633d329db045223b5c4
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// pages/fzxkt/fzxkt.js
var app = getApp()
Page({
 
  /**
   * 页面的初始数据
   */
  data: {
    TabCur: 0,
    scrollLeft: 0,
    tabList: ['未成年人', '公益诉讼', '其他'],
    dataSet: [],
    isHideLoadMore: true, //loading样式
    isHideMorebtn: true, //更多按钮样式
    isHideEnd: true, //有底线样式  (三者默认隐藏)
    size: 10
  },
 
  tabSelect(e) {
    this.setData({
      TabCur: e.currentTarget.dataset.id,
      scrollLeft: (e.currentTarget.dataset.id - 1) * 60
    })
  },
 
  // 跳转详情
  link: function (e) {
    var id = e.currentTarget.dataset.id;
    console.log(e.currentTarget.dataset.id);
    wx.navigateTo({
      url: '../fzxktDetail/fzxktDetail?id=' + id
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    wx.showLoading();
    wx.request({
      url: app.globalData.url + '/api/article/publicMsgQuery',
      data: {
        page: 1,
        size: 1000,
        flag:'法制小课堂',
      },
      success: function (res) {
        wx.hideLoading();
        console.log('res', res);
        if (res.data.code == 0) {
          let content = res.data.data.result.content.map(({
            createTime,
            ...i
          }) => ({
            ...i,
            createTime: app.formatDate(createTime),
          }));
          console.log(content)
          that.setData({
            dataSet: content
          })
        } else {
          wx.showToast({
            title: res.data.msg,
          })
        }
      }
    })
  },
 
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
 
  },
 
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
 
  },
 
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
 
  },
 
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
 
  }
})