正在显示
3 个修改的文件
包含
131 行增加
和
49 行删除
1 | // pages/main/guide/guide.js | 1 | // pages/main/guide/guide.js |
2 | var baseUrl = getApp().globalData.baseUrl; | 2 | var baseUrl = getApp().globalData.baseUrl; |
3 | +let Authorization = ''; | ||
3 | Page({ | 4 | Page({ |
4 | 5 | ||
5 | /** | 6 | /** |
@@ -7,7 +8,7 @@ Page({ | @@ -7,7 +8,7 @@ Page({ | ||
7 | */ | 8 | */ |
8 | data: { | 9 | data: { |
9 | isshow: false, | 10 | isshow: false, |
10 | - has_verify:false | 11 | + has_verify: true |
11 | }, | 12 | }, |
12 | 13 | ||
13 | /** | 14 | /** |
@@ -28,34 +29,73 @@ Page({ | @@ -28,34 +29,73 @@ Page({ | ||
28 | * 生命周期函数--监听页面显示 | 29 | * 生命周期函数--监听页面显示 |
29 | */ | 30 | */ |
30 | onShow: function() { | 31 | onShow: function() { |
31 | - this.taxconfirm(); | 32 | + this.checkUserInfo() |
32 | }, | 33 | }, |
33 | 34 | ||
34 | - taxconfirm: function() { | 35 | + //判断该雇员是否有姓名和身份证号 |
36 | + checkUserInfo: function() { | ||
35 | var that = this; | 37 | var that = this; |
36 | - var Authorization = getApp().globalData.Authorization; | 38 | + Authorization = getApp().globalData.Authorization; |
37 | console.log("Authorization", Authorization) | 39 | console.log("Authorization", Authorization) |
38 | if (Authorization && Authorization.length > 10) { | 40 | if (Authorization && Authorization.length > 10) { |
39 | wx.request({ | 41 | wx.request({ |
40 | - url: baseUrl + 'persontax/v1/personal-taxes-confirm', | 42 | + url: baseUrl + 'socialwork/v1/employees/verify', |
43 | + data: {}, | ||
41 | header: { | 44 | header: { |
42 | 'content-type': 'application/json', | 45 | 'content-type': 'application/json', |
43 | "Authorization": Authorization | 46 | "Authorization": Authorization |
44 | }, | 47 | }, |
45 | success: function(res) { | 48 | success: function(res) { |
46 | - console.log("taxconfirm", res) | ||
47 | - if (res.statusCode == 200 && !that.data.isshow && res.data.status != '0' ) { //未完善 | ||
48 | - that.showModal(res.data) | 49 | + if (res.statusCode && res.statusCode >= 300) { |
50 | + wx.showToast({ | ||
51 | + title: res.data.message, | ||
52 | + icon: 'none', | ||
53 | + duration: 1000 | ||
54 | + }) | ||
49 | } else { | 55 | } else { |
50 | that.setData({ | 56 | that.setData({ |
51 | - isshow: false | 57 | + has_verify: false |
52 | }) | 58 | }) |
59 | + // if (!res.data.need_verify) { //不需要再实名认证 | ||
60 | + // that.setData({ | ||
61 | + // has_verify: true | ||
62 | + // }) | ||
63 | + // that.taxconfirm(); | ||
64 | + // } else { | ||
65 | + // that.setData({ | ||
66 | + // has_verify: false | ||
67 | + // }) | ||
68 | + // } | ||
53 | } | 69 | } |
54 | } | 70 | } |
55 | }) | 71 | }) |
56 | } | 72 | } |
57 | }, | 73 | }, |
58 | 74 | ||
75 | + taxconfirm: function() { | ||
76 | + var that = this; | ||
77 | + Authorization = getApp().globalData.Authorization; | ||
78 | + | ||
79 | + wx.request({ | ||
80 | + url: baseUrl + 'persontax/v1/personal-taxes-confirm', | ||
81 | + header: { | ||
82 | + 'content-type': 'application/json', | ||
83 | + "Authorization": Authorization | ||
84 | + }, | ||
85 | + success: function(res) { | ||
86 | + console.log("taxconfirm", res) | ||
87 | + if (res.statusCode == 200 && !that.data.isshow && res.data.status != '0') { //未完善 | ||
88 | + that.showModal(res.data) | ||
89 | + } else { | ||
90 | + that.setData({ | ||
91 | + isshow: false | ||
92 | + }) | ||
93 | + } | ||
94 | + } | ||
95 | + }) | ||
96 | + | ||
97 | + }, | ||
98 | + | ||
59 | showModal: function(data) { | 99 | showModal: function(data) { |
60 | var that = this | 100 | var that = this |
61 | that.setData({ | 101 | that.setData({ |
@@ -121,13 +161,13 @@ Page({ | @@ -121,13 +161,13 @@ Page({ | ||
121 | }) | 161 | }) |
122 | }, | 162 | }, |
123 | 163 | ||
124 | - loginout:function(){ | 164 | + loginout: function() { |
125 | wx.showModal({ | 165 | wx.showModal({ |
126 | title: '退出登录', | 166 | title: '退出登录', |
127 | content: '确认要退出登录吗?', | 167 | content: '确认要退出登录吗?', |
128 | confirmText: '确定', | 168 | confirmText: '确定', |
129 | showCancel: true, | 169 | showCancel: true, |
130 | - cancelText:"取消", | 170 | + cancelText: "取消", |
131 | confirmColor: '#357aeb', | 171 | confirmColor: '#357aeb', |
132 | success(res) { | 172 | success(res) { |
133 | console.log("loginout", res) | 173 | console.log("loginout", res) |
@@ -142,13 +182,13 @@ Page({ | @@ -142,13 +182,13 @@ Page({ | ||
142 | }, | 182 | }, |
143 | 183 | ||
144 | 184 | ||
145 | - go_verify_idcard:function(){//身份证认证 | 185 | + go_verify_idcard: function() { //身份证认证 |
146 | wx.navigateTo({ | 186 | wx.navigateTo({ |
147 | url: '../verify/verify_info?foreigner=false', | 187 | url: '../verify/verify_info?foreigner=false', |
148 | }) | 188 | }) |
149 | }, | 189 | }, |
150 | 190 | ||
151 | - go_verify: function () { //外籍人员信息认证 | 191 | + go_verify: function() { //外籍人员信息认证 |
152 | wx.navigateTo({ | 192 | wx.navigateTo({ |
153 | url: '../verify/verify_info?foreigner=true', | 193 | url: '../verify/verify_info?foreigner=true', |
154 | }) | 194 | }) |
@@ -211,6 +211,26 @@ Page({ | @@ -211,6 +211,26 @@ Page({ | ||
211 | gonext: function () { | 211 | gonext: function () { |
212 | if (this.data.already_getdata) { | 212 | if (this.data.already_getdata) { |
213 | //提交数据 | 213 | //提交数据 |
214 | + wx.request({ | ||
215 | + url: baseUrl + 'uaa/v1/users/auth', | ||
216 | + method: 'POST', | ||
217 | + data: { | ||
218 | + id_card_front: front_card_copy, | ||
219 | + id_card_back: back_card_copy | ||
220 | + }, | ||
221 | + header: { | ||
222 | + 'content-type': 'application/json', | ||
223 | + "Authorization": Authorization | ||
224 | + }, | ||
225 | + success: function (res) { | ||
226 | + if (res.statusCode && res.statusCode >= 300) { | ||
227 | + this.showtoast(res.data.message); | ||
228 | + } else { | ||
229 | + this.showtoast('提交成功'); | ||
230 | + wx.navigateBack({}) | ||
231 | + } | ||
232 | + } | ||
233 | + }) | ||
214 | wx.navigateTo({ | 234 | wx.navigateTo({ |
215 | url: '../verify_result/verify_result?result=succ', | 235 | url: '../verify_result/verify_result?result=succ', |
216 | }) | 236 | }) |
@@ -3,6 +3,8 @@ var format = require('../../../utils/util.js'); | @@ -3,6 +3,8 @@ var format = require('../../../utils/util.js'); | ||
3 | const reg_18_Number = /^[0-9]{18}$/; | 3 | const reg_18_Number = /^[0-9]{18}$/; |
4 | const reg_9_n_a = /^([a-zA-z]|[0-9]){9}$/; | 4 | const reg_9_n_a = /^([a-zA-z]|[0-9]){9}$/; |
5 | const reg_15_n_a = /^([a-zA-z]|[0-9]){15}$/; | 5 | const reg_15_n_a = /^([a-zA-z]|[0-9]){15}$/; |
6 | +var baseUrl = getApp().globalData.baseUrl; | ||
7 | +let Authorization = ''; | ||
6 | Page({ | 8 | Page({ |
7 | /** | 9 | /** |
8 | * Page initial data | 10 | * Page initial data |
@@ -10,25 +12,23 @@ Page({ | @@ -10,25 +12,23 @@ Page({ | ||
10 | data: { | 12 | data: { |
11 | is_foreigner: false, | 13 | is_foreigner: false, |
12 | btn_text: "下一步", | 14 | btn_text: "下一步", |
13 | - info_steps: [ | ||
14 | - { | ||
15 | - label: '身份信息', | ||
16 | - status: 'success' | ||
17 | - }, { | ||
18 | - label: '上传证件照', | ||
19 | - status: 'circle' | ||
20 | - } | ||
21 | - ], | 15 | + info_steps: [{ |
16 | + label: '身份信息', | ||
17 | + status: 'success' | ||
18 | + }, { | ||
19 | + label: '上传证件照', | ||
20 | + status: 'circle' | ||
21 | + }], | ||
22 | cardTypeArray: ['中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)'], | 22 | cardTypeArray: ['中国护照', '港澳居民来往内地通行证', '港澳居民居住证', '台湾居民来往大陆通行证', '台湾居民居住证', '外国护照', '外国人永久居留身份证', '外国人工作许可证(A类)', '外国人工作许可证(B类)', '外国人工作许可证(C类)'], |
23 | cardtype: "", | 23 | cardtype: "", |
24 | - card_number:"", | ||
25 | - name:"", | 24 | + card_number: "", |
25 | + name: "", | ||
26 | }, | 26 | }, |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * Lifecycle function--Called when page load | 29 | * Lifecycle function--Called when page load |
30 | */ | 30 | */ |
31 | - onLoad: function (options) { | 31 | + onLoad: function(options) { |
32 | console.log("options", options); | 32 | console.log("options", options); |
33 | this.setData({ | 33 | this.setData({ |
34 | is_foreigner: options.foreigner, | 34 | is_foreigner: options.foreigner, |
@@ -39,18 +39,18 @@ Page({ | @@ -39,18 +39,18 @@ Page({ | ||
39 | /** | 39 | /** |
40 | * Lifecycle function--Called when page is initially rendered | 40 | * Lifecycle function--Called when page is initially rendered |
41 | */ | 41 | */ |
42 | - onReady: function () { | 42 | + onReady: function() { |
43 | 43 | ||
44 | }, | 44 | }, |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Lifecycle function--Called when page show | 47 | * Lifecycle function--Called when page show |
48 | */ | 48 | */ |
49 | - onShow: function () { | 49 | + onShow: function() { |
50 | 50 | ||
51 | }, | 51 | }, |
52 | 52 | ||
53 | - bindCardtypeChange: function (e) { | 53 | + bindCardtypeChange: function(e) { |
54 | console.log("bindCardtypeChange", e) | 54 | console.log("bindCardtypeChange", e) |
55 | var cardTypeArray = this.data.cardTypeArray | 55 | var cardTypeArray = this.data.cardTypeArray |
56 | var new_type = cardTypeArray[e.detail.value] //['name'] | 56 | var new_type = cardTypeArray[e.detail.value] //['name'] |
@@ -59,32 +59,33 @@ Page({ | @@ -59,32 +59,33 @@ Page({ | ||
59 | }) | 59 | }) |
60 | }, | 60 | }, |
61 | 61 | ||
62 | - bindinputcardnum: function (e) { | 62 | + bindinputcardnum: function(e) { |
63 | var idCardNo = e.detail.value | 63 | var idCardNo = e.detail.value |
64 | this.setData({ | 64 | this.setData({ |
65 | card_number: idCardNo | 65 | card_number: idCardNo |
66 | }) | 66 | }) |
67 | }, | 67 | }, |
68 | 68 | ||
69 | - nameInput: function (e) { | 69 | + nameInput: function(e) { |
70 | this.setData({ | 70 | this.setData({ |
71 | name: e.detail.value | 71 | name: e.detail.value |
72 | }) | 72 | }) |
73 | }, | 73 | }, |
74 | 74 | ||
75 | - dealCardType: function () {//提交前验证输入的内容规则 | ||
76 | - | 75 | + dealCardType: function() { //提交前验证输入的内容规则 |
76 | + | ||
77 | }, | 77 | }, |
78 | 78 | ||
79 | - gonext: function () { | ||
80 | - //校验证照类型,证照号码,姓名 | 79 | + gonext: function() { |
80 | + var that = this | ||
81 | + //校验证照类型,证照号码,姓名 | ||
81 | var type = this.data.cardtype; | 82 | var type = this.data.cardtype; |
82 | var idCardNo = this.data.card_number; | 83 | var idCardNo = this.data.card_number; |
83 | var name = this.data.name.replace(/(^\s*)|(\s*$)/g, ""); | 84 | var name = this.data.name.replace(/(^\s*)|(\s*$)/g, ""); |
84 | - var regname_c = /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,30}$/; //中文 | ||
85 | - var regname_e = /^[A-Za-z][A-Za-z\s]*[A-Za-z]$/; //英文 | 85 | + var regname_c = /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,30}$/; //中文 |
86 | + var regname_e = /^[A-Za-z][A-Za-z\s]*[A-Za-z]$/; //英文 | ||
86 | console.log('cardtype', type) | 87 | console.log('cardtype', type) |
87 | - if (this.data.is_foreigner == 'true') {//非身份证 | 88 | + if (this.data.is_foreigner == 'true') { //非身份证 |
88 | if (type.length < 1) { | 89 | if (type.length < 1) { |
89 | this.showtoast('请选择证照类型'); | 90 | this.showtoast('请选择证照类型'); |
90 | return | 91 | return |
@@ -121,13 +122,34 @@ Page({ | @@ -121,13 +122,34 @@ Page({ | ||
121 | return | 122 | return |
122 | } | 123 | } |
123 | //TODO 请求数据,上传用户身份信息 | 124 | //TODO 请求数据,上传用户身份信息 |
124 | - wx.showToast({ | ||
125 | - title: '提交成功', | ||
126 | - icon: "none", | ||
127 | - duration: 2000 | 125 | + Authorization = getApp().globalData.Authorization; |
126 | + wx.request({ | ||
127 | + url: baseUrl + 'uaa/v1/users/auth-extend', | ||
128 | + method: 'POST', | ||
129 | + data: { | ||
130 | + name: name, | ||
131 | + id_card_type: type, | ||
132 | + id_card_no: idCardNo | ||
133 | + }, | ||
134 | + header: { | ||
135 | + 'content-type': 'application/json', | ||
136 | + "Authorization": Authorization | ||
137 | + }, | ||
138 | + success: function (res) { | ||
139 | + console.log("SUCC",res.data) | ||
140 | + if (res.data.code && res.data.code >= 300) { | ||
141 | + wx.navigateTo({ | ||
142 | + url: 'verify_result/verify_result?result=fail', | ||
143 | + }) | ||
144 | + that.showtoast(res.data.message); | ||
145 | + } else { | ||
146 | + wx.navigateTo({ | ||
147 | + url: 'verify_result/verify_result?result=succ', | ||
148 | + }) | ||
149 | + } | ||
150 | + } | ||
128 | }) | 151 | }) |
129 | - wx.navigateBack({}) | ||
130 | - } else {//身份证 | 152 | + } else { //身份证 |
131 | if (name.length < 1) { | 153 | if (name.length < 1) { |
132 | this.showtoast('请输入姓名'); | 154 | this.showtoast('请输入姓名'); |
133 | return | 155 | return |
@@ -150,7 +172,7 @@ Page({ | @@ -150,7 +172,7 @@ Page({ | ||
150 | } | 172 | } |
151 | }, | 173 | }, |
152 | 174 | ||
153 | - showtoast: function (title) { | 175 | + showtoast: function(title) { |
154 | wx.showToast({ | 176 | wx.showToast({ |
155 | title: title, | 177 | title: title, |
156 | duration: 2000, | 178 | duration: 2000, |
@@ -162,35 +184,35 @@ Page({ | @@ -162,35 +184,35 @@ Page({ | ||
162 | /** | 184 | /** |
163 | * Lifecycle function--Called when page hide | 185 | * Lifecycle function--Called when page hide |
164 | */ | 186 | */ |
165 | - onHide: function () { | 187 | + onHide: function() { |
166 | 188 | ||
167 | }, | 189 | }, |
168 | 190 | ||
169 | /** | 191 | /** |
170 | * Lifecycle function--Called when page unload | 192 | * Lifecycle function--Called when page unload |
171 | */ | 193 | */ |
172 | - onUnload: function () { | 194 | + onUnload: function() { |
173 | 195 | ||
174 | }, | 196 | }, |
175 | 197 | ||
176 | /** | 198 | /** |
177 | * Page event handler function--Called when user drop down | 199 | * Page event handler function--Called when user drop down |
178 | */ | 200 | */ |
179 | - onPullDownRefresh: function () { | 201 | + onPullDownRefresh: function() { |
180 | 202 | ||
181 | }, | 203 | }, |
182 | 204 | ||
183 | /** | 205 | /** |
184 | * Called when page reach bottom | 206 | * Called when page reach bottom |
185 | */ | 207 | */ |
186 | - onReachBottom: function () { | 208 | + onReachBottom: function() { |
187 | 209 | ||
188 | }, | 210 | }, |
189 | 211 | ||
190 | /** | 212 | /** |
191 | * Called when user click on the top right corner to share | 213 | * Called when user click on the top right corner to share |
192 | */ | 214 | */ |
193 | - onShareAppMessage: function () { | 215 | + onShareAppMessage: function() { |
194 | 216 | ||
195 | } | 217 | } |
196 | }) | 218 | }) |
请
注册
或
登录
后发表评论