forked from nsjcy/frontEnd/nsjcy

liyj
2020-02-03 7a4d973140ee0168f509098b52745c8a7947ca74
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
// pages/drafts/drafts.js
const app = getApp()
Page({
 
  /**
   * 页面的初始数据
   */
  data: {
    newData: [],
    size: 10,
    content: '------加载中------',
    hasMoreData: true,
  },
 
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function() {
    this.getMusicInfo();
  },
 
  getMusicInfo: function() {
    var userinfo = wx.getStorageSync("user");
    console.log(userinfo)
    var _this = this;
    var id = userinfo.id
    wx.request({
      url: app.globalData.url + '/api/businessAggr/draftQuery?page=1&size=' + _this.data.size + '&userId=' + id,
      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/jindu_b.png';
                break;
              case '司法救助':
                e.iconSrc = app.globalData.imgUrl +'/image/businessManage/jiuzhu_b.png';
                break;
              case '信访预约':
                e.iconSrc = app.globalData.imgUrl +'/image/businessManage/yuyue_b.png';
                break;
              case '国家赔偿':
                e.iconSrc = app.globalData.imgUrl +'/image/businessManage/peichang_b.png';
                break;
              case '在线申诉':
                e.iconSrc = app.globalData.imgUrl +'/image/businessManage/shensu_b.png';
                break;
              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 = "联络站";
                break;
            }
          });
          if (res.data.data.totalElements < _this.data.size) {
            _this.setData({
              newData: res.data.data.content,
              hasMoreData: false,
              content: '------我是有底线的------'
            })
          } else {
            _this.setData({
              newData: res.data.data.content,
              hasMoreData: true,
              content: '------加载更多------',
              size: _this.data.size + 10
            })
          }
        } else {
          wx.showModal({
            title: '提示',
            content: "请求失败!"
          })
        }
      }
    })
  },
 
  del: function(event) {
    var id = event.currentTarget.id;
    var businessId = this.data.newData[id].businessId;
    var that = this;
    wx.showModal({
      title: '提示',
      content: '确定删除吗?',
      success: function(res) {
        if (res.confirm) {
          wx.request({
            url: app.globalData.url + '/api/businessAggr/delete?id=' + businessId,
            success: function(res) {
              if (res.data.code == 0) {
                wx.showToast({
                  title: '删除成功!',
                  icon: 'success',
                  duration: 2000
                }, that.getMusicInfo())
              }
            }
          })
        } else if (res.cancel) {
          console.log('用户点击取消')
        }
      }
    }, )
  },
 
  Info: function(event) {
    var id = event.currentTarget.id;
    var businessType = this.data.newData[id].businessType;
    var businessId = this.data.newData[id].businessId;
    var flag = this.data.newData[id].flag;
    var businessType1 = this.data.newData[id].businessType1 || '';
    console.log(businessType, businessId);
    if (businessType == "案件进度查询") {
      wx.navigateTo({
        url: '../progressQuery/progressQuery?status=1&id=' + businessId,
      })
    } else if (businessType == "信访预约") {
      wx.navigateTo({
        url: '../petitionLetters/petitionLetters?status=1&id=' + businessId,
      })
    } else if (businessType == "国家赔偿") {
      wx.navigateTo({
        url: '../compensation/compensation?status=1&id=' + businessId,
      })
    } else if (businessType == "司法救助") {
      wx.navigateTo({
        url: '../judicial/judicial?status=1&id=' + businessId,
      })
    } else if (businessType == "在线申诉") {
      wx.navigateTo({
        url: '../complain/complain?status=1&id=' + businessId,
      })
    } else if (businessType == "公益随手拍"){
      wx.navigateTo({
        url: '../publicSnapshot/publicSnapshot?status=1&id=' + businessId,
      })
    } else if (businessType == "扫黑除恶") {
      wx.navigateTo({
        url: '../scanEvildoing/scanEvildoing?status=1&id=' + businessId,
      })
    } else if (businessType == "投诉建议") {
      wx.navigateTo({
        url: '../complaintAdvice/complaintAdvice?status=1&id=' + businessId,
      })
    } else if (businessType1 == "联络站") {
      wx.navigateTo({
        url: '../junctionStation/junctionStation?status=1&id=' + businessId + '&flag=' + flag,
      })
    }else {
      wx.showModal({
        title: '提示',
        content: "文件错误!"
      })
    }
  },
 
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {
 
  },
 
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
 
  },
 
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {
 
  },
 
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {
 
  },
 
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {
 
  },
 
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {
    if (this.data.hasMoreData) {
      this.getMusicInfo();
      this.setData({
        content: '------加载更多------'
      })
    } else {
      this.setData({
        content: '------我是有底线的------'
      })
    }
  },
 
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {
 
  }
})