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
//index.js
//获取应用实例
const app = getApp()
Page({
  data: {
    page: app.globalData.imgUrl + '/image/page.png',
    ywbl2: app.globalData.imgUrl + '/image/ywbl2.svg',
    ywbl3: app.globalData.imgUrl + '/image/ywbl3.svg',
    ywbl1: app.globalData.imgUrl + '/image/ywbl1.svg',
    shouldAuth: false,
    period: '',
    userType: ''
  },
 
  //业务申请进度
  businessSchedule: function() {
    wx.navigateTo({
      url: '../businessSchedule/businessSchedule',
    })
  },
  //在线申诉
  complain: function() {
    wx.navigateTo({
      url: '../excess/excess?name=申诉人&name1=代理人&url=' + ['../complain/complain'],
    })
  },
  // 国家赔偿
  compensation: function() {
    wx.navigateTo({
      url: '../excess/excess?name=请求人&name1=代理人&url=' + ['../compensation/compensation'],
    })
  },
  // 群众意见箱
  massesSuggest: function() {
    wx.navigateTo({
      url: '../massesSuggest/massesSuggest',
    })
  },
 
  //信访预约
  petitionLetters: function() {
    wx.navigateTo({
      url: '../excess/excess?name=信访人&name1=代理人&url=' + ['../petitionLetters/petitionLetters'],
    })
  },
 
  //司法救助
  judicial: function() {
    var url = '../judicial/judicial?id=new';
    if (this.data.shouldAuth) {
      wx.showModal({
        title: '人脸识别确认',
        content: '为了保证您信息的真实性,请前往人脸认证',
        cancelText: '回到首页',
        confirmText: '前往认证',
        success: function(res) {
          if (res.confirm) {
            wx.navigateTo({
              url: '../face/face?url=' + encodeURIComponent(url),
            })
          } else if (res.cancel) {
            wx.redirectTo({
              url: '../index/index',
            })
          }
        }
      })
    } else {
      wx.navigateTo({
        url: url,
      })
    }
 
  },
 
  //案件进度查询
  progressQuery: function() {
    var url = '../progressQuery/progressQuery?id=new';
 
    if (this.data.shouldAuth) {
      wx.showModal({
        title: '人脸识别确认',
        content: '为了保证您信息的真实性,请前往人脸认证',
        cancelText: '回到首页',
        confirmText: '前往认证',
        success: function(res) {
          if (res.confirm) {
            wx.navigateTo({
              url: '../face/face?url=' + encodeURIComponent(url),
            })
          } else if (res.cancel) {
            wx.redirectTo({
              url: '../index/index',
            })
          }
        }
      })
    } else {
      wx.navigateTo({
        url: url,
      })
    }
 
  },
 
  onLoad: function() {
    //调用接口
    var that = this;
    that.showPeriod();
    var openId = wx.getStorageSync("openId");
    wx.request({
      url: app.globalData.url + '/api/ma/user/findByOpenId?openId=' + openId,
      success: function(res) {
        if (res.data.code == '0') {
          if (res.data.data.isFaceVerify == 0) {
            that.setData({
              shouldAuth: true,
              userType: res.data.data.userType
            })
          } else {
            that.setData({
              shouldAuth: false,
              userType: res.data.data.userType
            })
          }
        } else {
          wx.showModal({
            title: '提示',
            content: "请求失败!"
          })
        }
      }
    })
  },
 
  login: function(e) {
    var url = e.currentTarget.dataset.url;
    console.log(url)
    wx.navigateTo({
      url: '../lawServiceLogin/lawServiceLogin?url=' + url,
    })
  },
  //在线咨询
  artificial: function() {
    wx.navigateTo({
      url: '../artificial/artificial',
    })
  },
  goToMini: function() {
    wx.navigateToMiniProgram({
      appId: 'wxb49b1bd912ba9c08'
    })
 
  },
  developIng: function() {
    app.developIng()
  },
  // 投诉建议
  complaintAdvice: function() {
    wx.navigateTo({
      url: '../complaintAdvice/complaintAdvice?id=new',
    })
  },
 
  //联络站(4个)
  junctionStation: function(e) {
    var str = e.currentTarget.dataset.str;
    var userType = this.changeTypeToName(this.data.userType);
    console.log(this.data.userType);
    if (str != userType) {
      wx.showModal({
        title: '提示',
        content: "您暂无使用权限,请您前往个人中心补充相关信息,待审核通过之后在进行使用。"
      })
      return;
    }
    wx.navigateTo({
      url: '../junctionStation/junctionStation?id=new' + '&flag=' + str,
    })
  },
 
  // 确认时间段
  showPeriod: function() {
    this.setData({
      period: app.period()
    })
  },
 
  changeTypeToName: function(userType) {
    switch (userType) {
      case '2':
        return 'renda';
      case '3':
        return 'zhengxie';
      case '4':
        return 'renmin';
      case '5':
        return 'teyue';
    }
  }
})