forked from nsjcy/frontEnd/nsjcy

liuwh
2020-03-24 83c601c89f6231d378d70a8e48d90bab21dabe31
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
// pages/businessSchedule/businessSchedule.js
const app = getApp()
Page({
 
  /**
   * 页面的初始数据
   */
  data: {
    loading: app.globalData.imgUrl + '/image/loading.svg',
    navbar: ['全部', '未回复', '已回复'],
    currentTab: 0,
    size: 10,
    size1: 10,
    size2: 10,
    content: '------加载中------',
    hasMoreData: true,
    createTime: '',
    dataSet: []
  },
 
  navbarTap: function (e) {
    this.setData({
      currentTab: e.currentTarget.dataset.idx
    })
    this.showList(this.data.currentTab)
 
  },
 
  showList: function (tab) {
    var userinfo = wx.getStorageSync("user");
    var that = this;
    var id = userinfo.id
    var str;
    var sizeQty;
    switch (tab) {
      case 0:
        str = "&status=";
        sizeQty = 'size';
        break;
      case 1:
        str = "&status=1";
        sizeQty = 'size1';
        break;
      case 2:
        str = "&status=2";
        sizeQty = 'size2';
        break;
    }
    wx.request({
      url: app.globalData.url + '/api/businessAggr/draftQuery?page=1&size=' + that.data[sizeQty] + '&userId=' + id + '&flag=message' + str,
      success: function (res) {
        if (res.data.code == 0) {
          (res.data.data.content).forEach(e => {
            (e.createTime) = app.formatDate(e.createTime)
            switch (e.businessType) {
              case '扫黑除恶':
                e.iconSrc = app.globalData.imgUrl + '/image/businessManage/saoheichue_b.png';
                break;
              case '公益随手拍':
                e.iconSrc = app.globalData.imgUrl + '/image/businessManage/suishoupai_b.png';
                break;
              case '联络站':
                if (e.stationType == 4) {
                  e.businessType = "人大代表联络站";
                  e.flag = 'renda';
                }
                if (e.stationType == 3) {
                  e.businessType = "特约检察员监督员联络站";
                  e.flag = 'teyue';
                }
                if (e.stationType == 2) {
                  e.businessType = "政协委员联络员联络站";
                  e.flag = 'zhengxie';
                }
                if (e.stationType == 1) {
                  e.businessType = "人民监督员联络站";
                  e.flag = 'renmin';
                }
                e.businessType1 = "联络站";
                e.iconSrc = app.globalData.imgUrl + '/image/icon_lianluo.svg';
                break;
              case '投诉建议':
                e.iconSrc = app.globalData.imgUrl + '/image/businessManage/icon_tousujianyi@2x.png'
            }
 
 
          });
          if (res.data.data.totalElements < that.data[sizeQty]) {
            that.setData({
              dataSet: res.data.data.content,
              hasMoreData: false,
              content: '------我是有底线的------'
            })
          } else {
            that.setData({
              dataSet: res.data.data.content,
              hasMoreData: true,
              content: '------加载更多------',
              [sizeQty]: that.data[sizeQty] + 10
            })
          }
        } else {
          wx.showModal({
            title: '提示',
            content: "请求失败!"
          })
        }
      }
    })
  },
 
  businessSchedule: function (event) {
    var id = event.currentTarget.id;
    var businessType = this.data.dataSet[id].businessType;
    var businessId = this.data.dataSet[id].businessId;
    var businessType1 = this.data.dataSet[id].businessType1 || '';
    var flag = this.data.dataSet[id].flag || '';
    var picType = this.data.dataSet[id].picType || '';
    if (businessType == "公益随手拍") {
      wx.navigateTo({
        url: '../publicSnapshot/publicSnapshot?id=' + businessId + '&type=' + picType,
      })
    } else if (businessType == "扫黑除恶") {
      wx.navigateTo({
        url: '../scanEvildoing/scanEvildoing?id=' + businessId,
      })
    } else if (businessType == "投诉建议") {
      wx.navigateTo({
        url: '../complaintAdvice/complaintAdvice?id=' + businessId,
      })
    } else if (businessType == "联络站") {
      wx.navigateTo({
        url: '../junctionStation/junctionStation?id=' + businessId + '&flag=' + flag,
      })
    } else if (businessType == "普法预约") {
      wx.navigateTo({
        url: '../pfyy/pfyy?id=' + businessId + '&disabled=' + true,
      })
    } else {
      wx.showModal({
        title: '提示',
        content: "文件错误!"
      })
    }
  },
 
  onLoad: function () {
    this.showList(0)
  },
 
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    if (this.data.hasMoreData) {
      this.showList(this.data.currentTab)
      this.setData({
        content: '------加载更多------'
      })
    } else {
      this.setData({
        content: '------我是有底线的------'
      })
    }
  },
 
})