forked from nsjcy/frontEnd/nsjcy

liuwh
2020-03-29 9c7c21e8eacda173feb418bdfe739f7f97358233
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
const app = getApp();
Page({
  data: {
    img1: app.globalData.imgUrl + '/image/img1.png',
    img2: app.globalData.imgUrl + '/image/pic_a.png',
    img3: app.globalData.imgUrl + '/image/pic_b.png',
    img4: app.globalData.imgUrl + '/image/pic_c.png',
    img5: app.globalData.imgUrl + '/image/pic_d.png',
    img6: app.globalData.imgUrl + '/image/pic_e.png',
    img7: app.globalData.imgUrl + '/image/pic_f.png',
    srcollMsg: '暂无办理信息'
  },
  onLoad: function(options) {
    var that = this;
    wx.request({
      url: app.globalData.url + '/api/v1/pictures/finds?businessType=25&status=2',
      success: function(res) {
        var srcollMsg = '';
        if (res.data.code == 0) {
          for (var i = 0; i < res.data.data.length; i++) {
            var name = '';
            if (res.data.data[i].userName.length == 2){
              name = plusXing(res.data.data[i].userName, 1, 0, '*');
            } else if(res.data.data[i].userName.length == 3){
              name = plusXing(res.data.data[i].userName, 1, 1, '*');
            }else{
              name = plusXing(res.data.data[i].userName, 1, 2, '*');
            }
            
            srcollMsg +=name + "成功办理" + picType(res.data.data[i].picType) + "上报;"
          }
        }
        console.log(srcollMsg)
        that.setData({
          srcollMsg
        })
      }
    })
  },
  publicSnapshot: function(e) {
    var picType = e.currentTarget.dataset.type;
    wx.navigateTo({
      url: '../publicSnapshot/publicSnapshot?id=new&type=' + picType,
    })
  },
})
 
function picType(type) {
  switch (type) {
    case "1":
      return "生态环境与资源保护领域";
    case "2":
      return "食品药品安全领域";
    case "3":
      return "文物保护领域";
    case "4":
      return "英雄烈士保护领域";
    case "5":
      return "国有财产保护领域";
    case "6":
      return "国有土地出让领域";
  }
}
 
function plusXing(str, frontLen, endLen, cha) {
  var len = str.length - frontLen - endLen;
  var xing = '';
  for (var i = 0; i < len; i++) {
    xing += cha;
 
  }
  return str.substring(0, frontLen) + xing + str.substring(str.length - endLen);
 
};