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
| const app = getApp()
| Page({
| data: {
| src: app.globalData.imgUrl + '/image/bg1.jpg',
| name: '',
| IdNumber: '',
| url: '',
| },
| nameInput: function(e) {
| this.setData({
| name: e.detail.value,
| })
| },
|
| IdNumberInput: function(e) {
| this.setData({
| IdNumber: e.detail.value,
| })
| },
|
| onLoad: function(option) {
| this.setData({
| url: decodeURIComponent(option.url),
| })
| },
|
| submit: function(e) {
| var that = this;
| var name = this.data.name;
| var idCardNumber = this.data.IdNumber;
| if (!name) {
| return app.showModal("请填写姓名!");
| }
| if (!idCardNumber) {
| return app.showModal("请填写身份证号码!");
| }
| wx.checkIsSupportFacialRecognition({
| success() {
| wx.startFacialRecognitionVerify({
| name: name,
| idCardNumber: idCardNumber,
| success() {
| // //成功调用后台方法
| var openId = wx.getStorageSync("openId");
| wx.request({
| url: app.globalData.url + '/api/ma/user/update',
| method: 'POST',
| header: {
| "Content-Type": "application/json"
| },
| data: {
| "wxUnionId": openId,
| 'userName': name,
| 'idcard': idCardNumber,
| },
| success: function(res) {
| if (res.data.code == 0) {
| if (!res.data.data.mobile) {
| wx.showModal({
| title: '信息补充确认',
| content: '为了更加便捷的为您服务,请补充您的个人信息',
| cancelText: '回到首页',
| confirmText: '前往补充',
| success: function (res) {
| if (res.confirm) {
| wx.navigateTo({
| url: '../personInfo/personInfo?url=' + encodeURIComponent(that.data.url),
| })
| } else if (res.cancel) {
| wx.redirectTo({
| url: '../index/index',
| })
| }
| }
| })
| } else {
| wx.navigateTo({
| url: that.data.url,
| })
| }
| } else {
| wx.showToast({
| title: '网络失败,请稍后再试',
| icon: 'none'
| })
| }
|
| }
| })
| },
| fail(res) {
| //失败给出提示
|
| }
| })
| },
| fail(res) {
| wx.showToast({
| title: '暂不支持人脸识别,请升级微信后重试',
| icon: 'none',
| duration: 2000
| })
| wx.navigateTo({
| url: that.data.url,
| })
| }
| })
| }
| })
|
|