weapps-plugin-jingtong-verify 1.6.1 → 1.6.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/app.json +33 -33
- package/package.json +20 -20
- package/sdk.js +313 -289
- package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.js +31 -31
- package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.wxml +9 -9
- package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.wxss +65 -65
- package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.js +37 -37
- package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.wxml +30 -30
- package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.wxss +79 -79
- package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.js +32 -32
- package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.wxml +16 -16
- package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.wxss +57 -57
- package/weapps-plugin-jingtong-verify/components/gsd-lib/anim/anim.min.js +1 -1
- package/weapps-plugin-jingtong-verify/components/gsd-lib/crypto/crypto.js +37 -37
- package/weapps-plugin-jingtong-verify/components/gsd-lib/crypto/index.js +44 -44
- package/weapps-plugin-jingtong-verify/components/gsd-lib/dayjs/index.js +351 -351
- package/weapps-plugin-jingtong-verify/components/gsd-lib/event/index.js +117 -117
- package/weapps-plugin-jingtong-verify/components/gsd-lib/index.js +63 -63
- package/weapps-plugin-jingtong-verify/components/gsd-lib/map/index.js +10 -10
- package/weapps-plugin-jingtong-verify/components/gsd-lib/map/qmap.js +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-lib/storage/index.js +114 -114
- package/weapps-plugin-jingtong-verify/components/gsd-lib/utils/index.js +218 -218
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/formCheck.js +72 -72
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/formController.js +47 -47
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/icon.js +11 -11
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/list.js +16 -16
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/navigator.js +33 -33
- package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/primarySecondButton.js +18 -18
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.js +12 -12
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.wxml +15 -15
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.js +47 -47
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.wxml +13 -13
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.js +44 -44
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.wxml +28 -28
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.js +30 -30
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxml +42 -42
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxss +1 -1
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.js +418 -418
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.wxml +29 -29
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.js +11 -11
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.wxml +4 -4
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.js +179 -179
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.wxml +16 -16
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.js +92 -92
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxml +12 -12
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxss +2 -2
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.js +49 -49
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.wxml +14 -14
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.js +33 -33
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.wxml +2 -2
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.js +108 -108
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.wxml +53 -53
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.js +236 -236
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.json +8 -8
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.wxml +49 -49
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.js +328 -328
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.json +6 -6
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.wxml +26 -26
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.js +159 -159
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.json +3 -3
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.wxml +10 -10
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.js +112 -112
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.wxml +21 -21
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.js +21 -21
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.json +7 -7
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.wxml +16 -16
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.js +50 -50
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.json +5 -5
- package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.wxml +27 -27
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/add.svg +13 -13
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/arrow.svg +14 -14
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/delete.svg +16 -16
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/preview.svg +21 -21
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/user.svg +13 -13
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-agree.wxss +147 -147
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-badge.wxss +41 -41
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-button-group.wxss +244 -244
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-cell.wxss +220 -220
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-dropdown.wxss +115 -115
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-cell.wxss +101 -101
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-item.wxss +174 -174
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form.wxss +101 -101
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-icon.wxss +268 -268
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-index-list.wxss +206 -206
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-input.wxss +206 -206
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-picker.wxss +139 -139
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-popover.wxss +129 -129
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-search.wxss +171 -171
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-switch.wxss +176 -176
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-tips.wxss +173 -173
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/icon/iconfont.wxss +160 -160
- package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/main.wxss +283 -283
- package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/helper.js +55 -55
- package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validType.js +117 -117
- package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validator.js +106 -106
- package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.js +32 -32
- package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxml +8 -8
- package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxss +57 -57
- package/weapps-plugin-jingtong-verify/components/modal/modal.js +32 -32
- package/weapps-plugin-jingtong-verify/components/modal/modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/modal/modal.wxml +28 -28
- package/weapps-plugin-jingtong-verify/components/modal/modal.wxss +84 -84
- package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.js +82 -82
- package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxml +18 -18
- package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxss +72 -72
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.js +39 -39
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.json +3 -3
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxml +9 -9
- package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxss +51 -51
- package/weapps-plugin-jingtong-verify/i18n/index.js +7 -7
- package/weapps-plugin-jingtong-verify/i18n/logout.js +10 -10
- package/weapps-plugin-jingtong-verify/i18n/rules.js +262 -262
- package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.js +86 -86
- package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.json +6 -6
- package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxml +20 -20
- package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxss +51 -51
- package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.js +167 -167
- package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.json +3 -3
- package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxml +30 -30
- package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxss +91 -91
- package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.js +79 -79
- package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.json +5 -5
- package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxml +19 -19
- package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxss +44 -44
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.js +1557 -1547
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.json +17 -17
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxml +504 -504
- package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxss +133 -133
- package/weapps-plugin-jingtong-verify/pages/log-off/log-off.js +127 -127
- package/weapps-plugin-jingtong-verify/pages/log-off/log-off.json +5 -5
- package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxml +36 -36
- package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxss +60 -60
- package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.js +106 -106
- package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.json +3 -3
- package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxml +29 -29
- package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxss +68 -68
- package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.js +24 -24
- package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.json +3 -3
- package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxml +12 -12
- package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxss +33 -33
- package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.js +120 -120
- package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.json +6 -6
- package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxml +9 -9
- package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxss +1 -1
- package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.js +865 -854
- package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.json +11 -11
- package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxml +162 -162
- package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxss +64 -64
- package/weapps-plugin-jingtong-verify/pages/setting/setting.js +328 -328
- package/weapps-plugin-jingtong-verify/pages/setting/setting.json +5 -5
- package/weapps-plugin-jingtong-verify/pages/setting/setting.wxml +91 -91
- package/weapps-plugin-jingtong-verify/pages/setting/setting.wxss +69 -69
- package/weapps-plugin-jingtong-verify/pages/user-info/user-info.js +306 -306
- package/weapps-plugin-jingtong-verify/pages/user-info/user-info.json +7 -7
- package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxml +142 -142
- package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxss +110 -110
- package/weapps-plugin-jingtong-verify/style/page.wxss +13 -13
- package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTracker.js +15 -15
- package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTrackerMain.js +59 -59
- package/weapps-plugin-jingtong-verify/utils/country.js +209 -209
- package/weapps-plugin-jingtong-verify/utils/index.js +306 -306
- package/weapps-plugin-jingtong-verify/utils/jsencrypt.min.js +1 -1
- package/weapps-plugin-jingtong-verify/utils/request.js +1 -1
- package/weapps-plugin-jingtong-verify/utils/rules.js +301 -301
- package/weapps-plugin-jingtong-verify/utils/tifadmin_config.js +61 -61
- package/weapps-plugin-jingtong-verify/utils/validate.js +772 -772
|
@@ -1,855 +1,866 @@
|
|
|
1
|
-
// weapps-plugin-jingtong-verify/pages/face-verify/index.js
|
|
2
|
-
const jingtongVerifyRequest = require('../../utils/request')
|
|
3
|
-
const utils = require("../../utils/index")
|
|
4
|
-
const {
|
|
5
|
-
flow
|
|
6
|
-
} = require("@wecity/weda-plugin-utils");
|
|
7
|
-
const rulesConfig = require("../../utils/rules")
|
|
8
|
-
import {
|
|
9
|
-
SDKTrack,
|
|
10
|
-
setAccountInfo
|
|
11
|
-
} from '../../utils/QDTrackerNew/QDTrackerMain'
|
|
12
|
-
let cidType = '700'
|
|
13
|
-
|
|
14
|
-
Page({
|
|
15
|
-
/**
|
|
16
|
-
* 页面的初始数据
|
|
17
|
-
*/
|
|
18
|
-
data: {
|
|
19
|
-
language: 'en', // 语言环境:英文
|
|
20
|
-
formData: {
|
|
21
|
-
cid_type: '700', // 证件类型
|
|
22
|
-
id_card_number: '',
|
|
23
|
-
nation: '', // 国籍
|
|
24
|
-
nation_name: '',
|
|
25
|
-
sur_name: '', // 姓
|
|
26
|
-
first_name: '', // 名
|
|
27
|
-
sex: '', // 性别
|
|
28
|
-
birthday: '', // 出生日期
|
|
29
|
-
cid_expire_date: '', // 护照有效期
|
|
30
|
-
phone: '',
|
|
31
|
-
verify_expire_time: '', // 登录有效期
|
|
32
|
-
agree: false,
|
|
33
|
-
isbind: 1
|
|
34
|
-
},
|
|
35
|
-
needUnite: '', // 是否需要串联起来
|
|
36
|
-
cidTypeRange: [{
|
|
37
|
-
name: 'International passport',
|
|
38
|
-
value: '700'
|
|
39
|
-
} // 外国护照
|
|
40
|
-
],
|
|
41
|
-
sexRange: [{
|
|
42
|
-
name: 'Male',
|
|
43
|
-
value: 1
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: 'Female',
|
|
47
|
-
value: 2
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
loginTimeRangeEn: [{
|
|
51
|
-
name: 'Keep me logged in for 1 day',
|
|
52
|
-
value: 24
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: 'Keep me logged in for 7 days',
|
|
56
|
-
value: 168
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: 'Keep me logged in for 30 days',
|
|
60
|
-
value: 720
|
|
61
|
-
}
|
|
62
|
-
],
|
|
63
|
-
validateType: {
|
|
64
|
-
id_card_number(value) {
|
|
65
|
-
return utils.validate.checkCid(value, cidType).data
|
|
66
|
-
},
|
|
67
|
-
// surName(value) {
|
|
68
|
-
// return utils.validate.checkName(value, cidType).data
|
|
69
|
-
// },
|
|
70
|
-
// firstName(value) {
|
|
71
|
-
// return utils.validate.checkName(value, cidType).data
|
|
72
|
-
// }
|
|
73
|
-
},
|
|
74
|
-
rules: rulesConfig.ForeignPassortRules('en'),
|
|
75
|
-
// 打开文档的防抖操作
|
|
76
|
-
canOpenPdf: true,
|
|
77
|
-
// 外国人护照核验状态 '1'(通过) '4'(审核中) ''(无审核单) 其它值(审核失败)
|
|
78
|
-
passportAuthStatus: '',
|
|
79
|
-
passportAuthPersonCode: '',
|
|
80
|
-
// 核验单数据
|
|
81
|
-
passportOldData: {},
|
|
82
|
-
// 弹窗
|
|
83
|
-
showModal: false,
|
|
84
|
-
modalStatus: 'info',
|
|
85
|
-
// 定义日期边界值
|
|
86
|
-
birthdayMaxDate: [new Date().getFullYear(), (new Date().getMonth() + 1), new Date().getDate()],
|
|
87
|
-
cidExpireMinDate: [new Date().getFullYear(), (new Date().getMonth() + 1), new Date().getDate()],
|
|
88
|
-
// cidType转化为certType
|
|
89
|
-
certTypeMap: {
|
|
90
|
-
'111': 1,
|
|
91
|
-
'516': 78,
|
|
92
|
-
'511': 4,
|
|
93
|
-
'17': 5,
|
|
94
|
-
'18': 6,
|
|
95
|
-
'414': 2,
|
|
96
|
-
'553': 9,
|
|
97
|
-
'700': 3
|
|
98
|
-
},
|
|
99
|
-
// 记录是否已经登录成功
|
|
100
|
-
hadSuccessLogin: false,
|
|
101
|
-
// 该操作会触发小程序的销毁回调
|
|
102
|
-
exitedState: true,
|
|
103
|
-
// surname自定义校验状态,傻逼数广傻逼组件逼的
|
|
104
|
-
sur_name_state: {
|
|
105
|
-
valid: true,
|
|
106
|
-
msg: ''
|
|
107
|
-
},
|
|
108
|
-
// givenName自定义校验状态,傻逼数广傻逼组件逼的
|
|
109
|
-
first_name_state: {
|
|
110
|
-
valid: true,
|
|
111
|
-
msg: ''
|
|
112
|
-
},
|
|
113
|
-
showCustomTips: false,
|
|
114
|
-
customTipsMsg: ''
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
// 验证sur_name和first_name
|
|
118
|
-
validateFullname() {
|
|
119
|
-
const {
|
|
120
|
-
sur_name,
|
|
121
|
-
first_name
|
|
122
|
-
} = this.data.formData
|
|
123
|
-
// 两个都没填
|
|
124
|
-
if ((sur_name == null || sur_name === '') && (first_name == null || first_name === '')) {
|
|
125
|
-
const msgEmpty = 'Please fill in surname or given name.';
|
|
126
|
-
this.setData({
|
|
127
|
-
sur_name_state: {
|
|
128
|
-
valid: false,
|
|
129
|
-
msg: msgEmpty
|
|
130
|
-
},
|
|
131
|
-
first_name_state: {
|
|
132
|
-
valid: false,
|
|
133
|
-
msg: msgEmpty
|
|
134
|
-
}
|
|
135
|
-
})
|
|
136
|
-
return {
|
|
137
|
-
valid: false,
|
|
138
|
-
msg: msgEmpty
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
this.setData({
|
|
142
|
-
sur_name_state: {
|
|
143
|
-
valid: true,
|
|
144
|
-
msg: ''
|
|
145
|
-
},
|
|
146
|
-
first_name_state: {
|
|
147
|
-
valid: false,
|
|
148
|
-
msg: ''
|
|
149
|
-
}
|
|
150
|
-
})
|
|
151
|
-
// 其中一个填了,或者两个都填了
|
|
152
|
-
let sur_name_flag = true
|
|
153
|
-
let msg = 'Please enter capital letters'
|
|
154
|
-
if (sur_name != null && sur_name !== '') {
|
|
155
|
-
const valid = utils.validate.checkName(sur_name, cidType)
|
|
156
|
-
if (valid.data) {
|
|
157
|
-
sur_name_flag = true
|
|
158
|
-
} else {
|
|
159
|
-
this.setData({
|
|
160
|
-
sur_name_state: {
|
|
161
|
-
valid: false,
|
|
162
|
-
msg
|
|
163
|
-
}
|
|
164
|
-
})
|
|
165
|
-
sur_name_flag = false
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
let first_name_flag = true
|
|
169
|
-
if (first_name != null && first_name !== '') {
|
|
170
|
-
const valid = utils.validate.checkName(first_name, cidType)
|
|
171
|
-
if (valid.data) {
|
|
172
|
-
first_name_flag = true
|
|
173
|
-
} else {
|
|
174
|
-
this.setData({
|
|
175
|
-
first_name_state: {
|
|
176
|
-
valid: false,
|
|
177
|
-
msg
|
|
178
|
-
}
|
|
179
|
-
})
|
|
180
|
-
first_name_flag = false
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (sur_name_flag && first_name_flag) {
|
|
184
|
-
this.setData({
|
|
185
|
-
sur_name_state: {
|
|
186
|
-
valid: true,
|
|
187
|
-
msg: ''
|
|
188
|
-
},
|
|
189
|
-
first_name_state: {
|
|
190
|
-
valid: false,
|
|
191
|
-
msg: ''
|
|
192
|
-
}
|
|
193
|
-
})
|
|
194
|
-
}
|
|
195
|
-
const valid = sur_name_flag && first_name_flag
|
|
196
|
-
return {
|
|
197
|
-
valid,
|
|
198
|
-
msg: valid ? '' : msg
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
// 自定义change事件,sur_name和first_name专用
|
|
203
|
-
handleCustomChange(e) {
|
|
204
|
-
let value = e.detail.value
|
|
205
|
-
let field = e.target.id
|
|
206
|
-
// 删除前后空格
|
|
207
|
-
if (typeof value === 'string') {
|
|
208
|
-
value = value.trim()
|
|
209
|
-
}
|
|
210
|
-
this.setData({
|
|
211
|
-
[`formData.${field}`]: value,
|
|
212
|
-
})
|
|
213
|
-
// 临时存储表单数据
|
|
214
|
-
this.saveFormDataTemp()
|
|
215
|
-
this.validateFullname()
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
// 关闭提示条
|
|
219
|
-
handleTipsClose(e) {
|
|
220
|
-
this.setData({
|
|
221
|
-
showCustomTips: e.detail.isShow
|
|
222
|
-
});
|
|
223
|
-
},
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* 生命周期函数--监听页面加载
|
|
227
|
-
*/
|
|
228
|
-
onLoad(options) {
|
|
229
|
-
console.log('onLoad', options)
|
|
230
|
-
// 设置用户账号信息
|
|
231
|
-
setAccountInfo(wx.getStorageSync('tif.openid'))
|
|
232
|
-
|
|
233
|
-
this.setData({
|
|
234
|
-
needUnite: options.needUnite || 'true'
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
// 清空本地Temp数据
|
|
238
|
-
wx.setStorageSync('tif.formDataTemp', '')
|
|
239
|
-
|
|
240
|
-
// 获取外国护照核验结果
|
|
241
|
-
this.fetchPassortAuthResult()
|
|
242
|
-
},
|
|
243
|
-
|
|
244
|
-
// 生命周期函数--监听页面显示
|
|
245
|
-
onShow: function () {
|
|
246
|
-
wx.hideShareMenu()
|
|
247
|
-
|
|
248
|
-
// 获取国籍
|
|
249
|
-
let pages = getCurrentPages()
|
|
250
|
-
let currentPage = pages[pages.length - 1]
|
|
251
|
-
let hadChoseNation = currentPage.data.hadChoseNation || false
|
|
252
|
-
|
|
253
|
-
if (hadChoseNation) {
|
|
254
|
-
let cid_type = currentPage.data.formData.cid_type
|
|
255
|
-
// 回传数据
|
|
256
|
-
this.reFullFormDataTemp(cid_type)
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
// 选择完国籍或认证失败后回传 -- 回传本地临时存储用户表单信息
|
|
261
|
-
reFullFormDataTemp(cid_type) {
|
|
262
|
-
const formDataTemp = wx.getStorageSync('tif.formDataTemp') || {}
|
|
263
|
-
let formDataOld = this.data.formData
|
|
264
|
-
|
|
265
|
-
if (formDataTemp && formDataTemp[cid_type]) {
|
|
266
|
-
console.log('存在可回填的temp数据', formDataTemp[cid_type])
|
|
267
|
-
let formData = Object.assign(formDataOld, formDataTemp[cid_type])
|
|
268
|
-
this.setData({
|
|
269
|
-
formData
|
|
270
|
-
}, () => {
|
|
271
|
-
wx.hideLoading()
|
|
272
|
-
})
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
|
|
276
|
-
// 同意协议和隐私政策
|
|
277
|
-
viewPrivacy(e) {
|
|
278
|
-
// 错误触发销毁回调函数处理
|
|
279
|
-
this.handleExitedState()
|
|
280
|
-
|
|
281
|
-
// 临时存储表单数据
|
|
282
|
-
this.saveFormDataTemp()
|
|
283
|
-
|
|
284
|
-
let canOpenPdf = this.data.canOpenPdf
|
|
285
|
-
if (canOpenPdf) {
|
|
286
|
-
this.setData({
|
|
287
|
-
canOpenPdf: false
|
|
288
|
-
})
|
|
289
|
-
let {
|
|
290
|
-
name,
|
|
291
|
-
file
|
|
292
|
-
} = e.currentTarget.dataset
|
|
293
|
-
console.log('文件地址', `https://js.jt.beijing.gov.cn/jt/tiffile/${file}.pdf`)
|
|
294
|
-
utils.openDoc({
|
|
295
|
-
url: `https://js.jt.beijing.gov.cn/jt/tiffile/${file}.pdf`,
|
|
296
|
-
fileType: 'pdf',
|
|
297
|
-
name,
|
|
298
|
-
successFn: () => {
|
|
299
|
-
console.log('文档打开成功回调')
|
|
300
|
-
setTimeout(() => {
|
|
301
|
-
this.setData({
|
|
302
|
-
canOpenPdf: true
|
|
303
|
-
})
|
|
304
|
-
}, 500)
|
|
305
|
-
}
|
|
306
|
-
})
|
|
307
|
-
} else {
|
|
308
|
-
setTimeout(() => {
|
|
309
|
-
this.setData({
|
|
310
|
-
canOpenPdf: true
|
|
311
|
-
})
|
|
312
|
-
}, 3500)
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
|
|
316
|
-
// 选择事件
|
|
317
|
-
handleChange(e) {
|
|
318
|
-
let value = e.detail.value
|
|
319
|
-
let formId = e.target.id
|
|
320
|
-
|
|
321
|
-
// 删除前后空格
|
|
322
|
-
if (typeof value === 'string' && formId !== 'cid_type') {
|
|
323
|
-
value = value.trim()
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
this.setData({
|
|
327
|
-
[`formData.${formId}`]: value,
|
|
328
|
-
})
|
|
329
|
-
// 临时存储表单数据
|
|
330
|
-
this.saveFormDataTemp()
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
// 临时存储用户填写的表单信息
|
|
334
|
-
saveFormDataTemp() {
|
|
335
|
-
let {
|
|
336
|
-
formData
|
|
337
|
-
} = this.data
|
|
338
|
-
|
|
339
|
-
let formDataTemp = wx.getStorageSync('tif.formDataTemp') || {}
|
|
340
|
-
formDataTemp['700'] = formData
|
|
341
|
-
wx.setStorageSync('tif.formDataTemp', formDataTemp)
|
|
342
|
-
},
|
|
343
|
-
|
|
344
|
-
// 获取外国人护照核验结果、是否需要返回状态
|
|
345
|
-
fetchPassortAuthResult(needStatus = false) {
|
|
346
|
-
let formData = this.data.formData
|
|
347
|
-
|
|
348
|
-
return new Promise((resolve) => {
|
|
349
|
-
jingtongVerifyRequest.getPassportInfo({
|
|
350
|
-
success: res => {
|
|
351
|
-
console.log('外国人护照核验接口获取成功', res)
|
|
352
|
-
this.setData({
|
|
353
|
-
passportAuthStatus: res.status,
|
|
354
|
-
passportAuthPersonCode: res.person_code
|
|
355
|
-
})
|
|
356
|
-
|
|
357
|
-
if (needStatus) {
|
|
358
|
-
// 需要返回状态
|
|
359
|
-
resolve(res.status)
|
|
360
|
-
} else {
|
|
361
|
-
let {
|
|
362
|
-
id_card_number,
|
|
363
|
-
nation,
|
|
364
|
-
sur_name,
|
|
365
|
-
first_name,
|
|
366
|
-
sex,
|
|
367
|
-
birthday,
|
|
368
|
-
cid_expire_date,
|
|
369
|
-
phone,
|
|
370
|
-
verify_expire_time,
|
|
371
|
-
nation_name
|
|
372
|
-
} = res
|
|
373
|
-
let passportOldData = {
|
|
374
|
-
id_card_number,
|
|
375
|
-
nation,
|
|
376
|
-
nation_name,
|
|
377
|
-
sur_name,
|
|
378
|
-
first_name,
|
|
379
|
-
sex: sex ? sex : '',
|
|
380
|
-
birthday,
|
|
381
|
-
cid_expire_date,
|
|
382
|
-
phone,
|
|
383
|
-
verify_expire_time: verify_expire_time && Number(verify_expire_time) || ''
|
|
384
|
-
}
|
|
385
|
-
formData = Object.assign(formData, res, passportOldData)
|
|
386
|
-
this.setData({
|
|
387
|
-
formData,
|
|
388
|
-
passportOldData
|
|
389
|
-
})
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
fail: err => {
|
|
393
|
-
console.log('外国人护照核验接口获取失败', err)
|
|
394
|
-
let {
|
|
395
|
-
errmsg
|
|
396
|
-
} = JSON.parse(err)
|
|
397
|
-
wx.showToast({
|
|
398
|
-
title: errmsg || '获取核验信息接口失败',
|
|
399
|
-
icon: 'none',
|
|
400
|
-
duration: 3000
|
|
401
|
-
})
|
|
402
|
-
}
|
|
403
|
-
})
|
|
404
|
-
})
|
|
405
|
-
},
|
|
406
|
-
|
|
407
|
-
// 选择国籍
|
|
408
|
-
handleNationTap() {
|
|
409
|
-
// 临时存储表单数据
|
|
410
|
-
this.saveFormDataTemp()
|
|
411
|
-
flow.navigateTo({
|
|
412
|
-
url: `../nation-list/nation-list?cid_type=700`,
|
|
413
|
-
})
|
|
414
|
-
},
|
|
415
|
-
|
|
416
|
-
// 显示自定义校验错误提示
|
|
417
|
-
showCuntomErrTip(msg) {
|
|
418
|
-
this.setData({
|
|
419
|
-
showCustomTips: true,
|
|
420
|
-
customTipsMsg: msg
|
|
421
|
-
}, () => {
|
|
422
|
-
// 3秒后关闭
|
|
423
|
-
setTimeout(() => {
|
|
424
|
-
this.setData({
|
|
425
|
-
showCustomTips: false,
|
|
426
|
-
customTipsMsg: ''
|
|
427
|
-
});
|
|
428
|
-
}, 3500);
|
|
429
|
-
})
|
|
430
|
-
},
|
|
431
|
-
|
|
432
|
-
async handleFormSubmit(e) {
|
|
433
|
-
const formValid = e.detail.validStatus
|
|
434
|
-
const customValid = this.validateFullname()
|
|
435
|
-
if (!e.detail.validStatus || !customValid.valid) {
|
|
436
|
-
// 自定义校验字段有问题,获取表单错误列表
|
|
437
|
-
const formErrList = e.detail.value
|
|
438
|
-
// 如果表单校验有问题,自定义校验没问题,则显示表单校验错误提示
|
|
439
|
-
if (!formValid && customValid.valid) {
|
|
440
|
-
this.showCuntomErrTip(formErrList[0].message)
|
|
441
|
-
return
|
|
442
|
-
}
|
|
443
|
-
// 如果表单校验没有问题,自定义校验有问题,则显示自定义校验错误提示
|
|
444
|
-
if (formValid && !customValid.valid) {
|
|
445
|
-
this.showCuntomErrTip(customValid.msg)
|
|
446
|
-
return
|
|
447
|
-
}
|
|
448
|
-
// 如果两者都有问题,则判断显示谁
|
|
449
|
-
let lastMsg = ''
|
|
450
|
-
if (formErrList.some(i => ["id_card_number", "nation"].includes(i.name))) {
|
|
451
|
-
lastMsg = formErrList[0].message
|
|
452
|
-
} else {
|
|
453
|
-
lastMsg = customValid.msg
|
|
454
|
-
}
|
|
455
|
-
this.showCuntomErrTip(lastMsg)
|
|
456
|
-
return
|
|
457
|
-
}
|
|
458
|
-
this.setData({
|
|
459
|
-
showCustomTips: false,
|
|
460
|
-
customTipsMsg: ''
|
|
461
|
-
})
|
|
462
|
-
wx.showLoading({
|
|
463
|
-
title: '加载中…',
|
|
464
|
-
mask: true
|
|
465
|
-
})
|
|
466
|
-
|
|
467
|
-
console.log('删除“姓名、证件号码、护照号码、手机号码”的前后空格')
|
|
468
|
-
let {
|
|
469
|
-
id_card_number,
|
|
470
|
-
sur_name,
|
|
471
|
-
first_name,
|
|
472
|
-
phone,
|
|
473
|
-
cid_type
|
|
474
|
-
} = this.data.formData
|
|
475
|
-
// sur_name值为空,增加空格
|
|
476
|
-
if (sur_name == null || sur_name === '') {
|
|
477
|
-
sur_name = ' '
|
|
478
|
-
} else {
|
|
479
|
-
sur_name = sur_name.trim()
|
|
480
|
-
}
|
|
481
|
-
// first_name值为空,增加空格
|
|
482
|
-
if (first_name == null || first_name === '') {
|
|
483
|
-
first_name = ' '
|
|
484
|
-
} else {
|
|
485
|
-
first_name = first_name.trim()
|
|
486
|
-
}
|
|
487
|
-
this.setData({
|
|
488
|
-
['formData.sur_name']: sur_name,
|
|
489
|
-
['formData.first_name']: first_name,
|
|
490
|
-
['formData.phone']: phone.trim()
|
|
491
|
-
})
|
|
492
|
-
|
|
493
|
-
if (cid_type === '700') {
|
|
494
|
-
console.log('删除“外国人护照号码”中间空格')
|
|
495
|
-
this.setData({
|
|
496
|
-
['formData.id_card_number']: id_card_number.replace(/\s+/g, '')
|
|
497
|
-
})
|
|
498
|
-
}
|
|
499
|
-
console.log('入参', this.data.formData)
|
|
500
|
-
|
|
501
|
-
console.log('外国人护照核验')
|
|
502
|
-
// 外国人护照核验
|
|
503
|
-
this.handlePassortAuth()
|
|
504
|
-
},
|
|
505
|
-
|
|
506
|
-
// 外国人护照核验处理逻辑
|
|
507
|
-
handlePassortAuth() {
|
|
508
|
-
let authStatus = this.data.passportAuthStatus
|
|
509
|
-
let newData = this.data.formData
|
|
510
|
-
let oldData = this.data.passportOldData
|
|
511
|
-
console.log('当前核验单状态', authStatus)
|
|
512
|
-
|
|
513
|
-
if (!authStatus) {
|
|
514
|
-
console.log('无审核单', authStatus)
|
|
515
|
-
// 外国人护照核验,提交核验单
|
|
516
|
-
this.passportAuth()
|
|
517
|
-
} else {
|
|
518
|
-
// 查上一单的状态
|
|
519
|
-
this.fetchPassortAuthResult(true).then(status => {
|
|
520
|
-
console.log('====查上一单的状态====', status)
|
|
521
|
-
if (status === '1') {
|
|
522
|
-
// 核验通过,弹窗提示
|
|
523
|
-
console.log('外国人护照核验通过')
|
|
524
|
-
this.passportAuthSuccess()
|
|
525
|
-
} else {
|
|
526
|
-
// 比对表单数据是否有修改
|
|
527
|
-
console.log('新旧表单数据比对', newData, oldData)
|
|
528
|
-
if (utils.objIsEqual(newData, oldData)) {
|
|
529
|
-
console.log('表单数据没有修改')
|
|
530
|
-
if (status === '4') {
|
|
531
|
-
// 核验中
|
|
532
|
-
this.fetchPassortAuthResult(true).then(status => {
|
|
533
|
-
console.log('再次获取外国人护照核验状态', status)
|
|
534
|
-
if (status === '1') {
|
|
535
|
-
console.log('外国人护照核验通过')
|
|
536
|
-
this.passportAuthSuccess()
|
|
537
|
-
} else if (status === '4') {
|
|
538
|
-
console.log('外国人护照核验中,弹窗提示')
|
|
539
|
-
this.handleShowModal(status)
|
|
540
|
-
} else {
|
|
541
|
-
// 核验不通过,弹窗提示
|
|
542
|
-
this.passportAuthFail(status)
|
|
543
|
-
}
|
|
544
|
-
})
|
|
545
|
-
} else {
|
|
546
|
-
// 核验不通过,弹窗提示
|
|
547
|
-
this.passportAuthFail(status)
|
|
548
|
-
}
|
|
549
|
-
} else {
|
|
550
|
-
console.log('表单数据存在修改')
|
|
551
|
-
// 外国人护照核验,提交核验单
|
|
552
|
-
this.passportAuth()
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
})
|
|
556
|
-
}
|
|
557
|
-
},
|
|
558
|
-
|
|
559
|
-
// 外国人护照核验不通过逻辑
|
|
560
|
-
passportAuthFail(status) {
|
|
561
|
-
console.log('===外国人护照核验不通过,弹窗提示===')
|
|
562
|
-
// 判断当前person_code是否已失效
|
|
563
|
-
const personCode = this.data.passportAuthPersonCode
|
|
564
|
-
const localPersonCode = wx.getStorageSync('tif.fail.person_code') || ''
|
|
565
|
-
if (personCode === localPersonCode) {
|
|
566
|
-
// 提交核验单
|
|
567
|
-
this.passportAuth()
|
|
568
|
-
} else {
|
|
569
|
-
// 埋点上报事件:自然人登录
|
|
570
|
-
this.loginTracker(2, this.data.formData.cid_type)
|
|
571
|
-
|
|
572
|
-
this.handleShowModal(status)
|
|
573
|
-
// 记录这个person_code是失效的
|
|
574
|
-
wx.setStorageSync('tif.fail.person_code', this.data.passportAuthPersonCode)
|
|
575
|
-
}
|
|
576
|
-
},
|
|
577
|
-
|
|
578
|
-
// 外国人护照核验接口
|
|
579
|
-
async passportAuth() {
|
|
580
|
-
console.log('===========提交核验单============')
|
|
581
|
-
let formData = this.data.formData
|
|
582
|
-
|
|
583
|
-
const isLegalDate = utils.greaterCurrentTime(formData.cid_expire_date)
|
|
584
|
-
console.log('isLegalDate', isLegalDate)
|
|
585
|
-
if (!isLegalDate) {
|
|
586
|
-
console.log('护照有效期日期不合法')
|
|
587
|
-
wx.showToast({
|
|
588
|
-
title: 'Please select the passport expiration date',
|
|
589
|
-
icon: 'none',
|
|
590
|
-
duration: 3000
|
|
591
|
-
})
|
|
592
|
-
this.setData({
|
|
593
|
-
'formData.cid_expire_date': ''
|
|
594
|
-
})
|
|
595
|
-
return
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
const [err, res] = await utils.awaitTo(jingtongVerifyRequest.passportAuth(formData))
|
|
599
|
-
if (err) {
|
|
600
|
-
console.log('外国人护照核验接口认证失败', err)
|
|
601
|
-
let {
|
|
602
|
-
errmsg
|
|
603
|
-
} = JSON.parse(err)
|
|
604
|
-
wx.showToast({
|
|
605
|
-
title: errmsg || '认证失败',
|
|
606
|
-
icon: 'none',
|
|
607
|
-
duration: 3000
|
|
608
|
-
})
|
|
609
|
-
return
|
|
610
|
-
}
|
|
611
|
-
console.log('弹窗提示等待1分钟', res)
|
|
612
|
-
this.setData({
|
|
613
|
-
passportAuthStatus: '4',
|
|
614
|
-
passportOldData: JSON.parse(JSON.stringify(formData)),
|
|
615
|
-
passportAuthPersonCode: ''
|
|
616
|
-
})
|
|
617
|
-
wx.setStorageSync('tif.fail.person_code', '')
|
|
618
|
-
this.handleShowModal('4')
|
|
619
|
-
},
|
|
620
|
-
|
|
621
|
-
// 外国人护照核验通过
|
|
622
|
-
passportAuthSuccess() {
|
|
623
|
-
// 调用删除接口/静默登录并返回session信息
|
|
624
|
-
jingtongVerifyRequest.deletePassportAuth({
|
|
625
|
-
success: session => {
|
|
626
|
-
console.log('返回session信息', session)
|
|
627
|
-
|
|
628
|
-
// 删除缓存信息
|
|
629
|
-
console.log('删除缓存信息')
|
|
630
|
-
let formDataTemp = wx.getStorageSync('tif.formDataTemp')
|
|
631
|
-
formDataTemp['700'] = {}
|
|
632
|
-
wx.setStorageSync('tif.formDataTemp', formDataTemp)
|
|
633
|
-
this.setData({
|
|
634
|
-
passportOldData: {}
|
|
635
|
-
})
|
|
636
|
-
|
|
637
|
-
this.authSuccess(session, true)
|
|
638
|
-
},
|
|
639
|
-
fail: err => {
|
|
640
|
-
// 埋点上报事件:自然人登录
|
|
641
|
-
this.loginTracker(2, this.data.formData.cid_type)
|
|
642
|
-
|
|
643
|
-
let {
|
|
644
|
-
errmsg
|
|
645
|
-
} = JSON.parse(err)
|
|
646
|
-
wx.showToast({
|
|
647
|
-
title: errmsg || 'auth fail',
|
|
648
|
-
icon: 'none',
|
|
649
|
-
duration: 3000
|
|
650
|
-
})
|
|
651
|
-
}
|
|
652
|
-
})
|
|
653
|
-
},
|
|
654
|
-
|
|
655
|
-
// 认证成功后续操作
|
|
656
|
-
authSuccess(session, isEn = false) {
|
|
657
|
-
console.log('====判断是否真的登录成功=====')
|
|
658
|
-
if (!session) {
|
|
659
|
-
wx.showToast({
|
|
660
|
-
title: 'Login has expired, please log in again',
|
|
661
|
-
icon: 'none',
|
|
662
|
-
duration: 3000
|
|
663
|
-
})
|
|
664
|
-
return
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
const {
|
|
668
|
-
face_time,
|
|
669
|
-
realname_time,
|
|
670
|
-
cid,
|
|
671
|
-
has_phone,
|
|
672
|
-
certType
|
|
673
|
-
} = session
|
|
674
|
-
if ((!face_time && !realname_time) || !cid) {
|
|
675
|
-
wx.showToast({
|
|
676
|
-
title: `Login has expired, please log in again: ${this.data.formData.cid_type}`,
|
|
677
|
-
icon: 'none',
|
|
678
|
-
duration: 2000
|
|
679
|
-
})
|
|
680
|
-
return
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
wx.showToast({
|
|
684
|
-
title: isEn ? 'Verification successful, redirecting...' : '验证成功, 跳转中…',
|
|
685
|
-
icon: 'none',
|
|
686
|
-
duration: 5000,
|
|
687
|
-
mask: true
|
|
688
|
-
})
|
|
689
|
-
|
|
690
|
-
const cidType = session.cid_type
|
|
691
|
-
|
|
692
|
-
// 本地存储表单核验成功数据
|
|
693
|
-
wx.setStorageSync('tif.formDataSuccess', this.data.formData)
|
|
694
|
-
|
|
695
|
-
// 将弹窗标识设置为不需要弹窗
|
|
696
|
-
jingtongVerifyRequest.setUserReadStatus(false).then(() => {
|
|
697
|
-
console.log('设置弹窗标识成功')
|
|
698
|
-
}).catch(err => {
|
|
699
|
-
console.log('设置弹窗标识失败', err)
|
|
700
|
-
})
|
|
701
|
-
|
|
702
|
-
setTimeout(() => {
|
|
703
|
-
if (this.data.needUnite === "true") {
|
|
704
|
-
console.log('
|
|
705
|
-
|
|
706
|
-
//
|
|
707
|
-
//
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
const
|
|
715
|
-
const
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
console.log('
|
|
719
|
-
console.log('
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
//
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
//
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
this.
|
|
853
|
-
|
|
854
|
-
|
|
1
|
+
// weapps-plugin-jingtong-verify/pages/face-verify/index.js
|
|
2
|
+
const jingtongVerifyRequest = require('../../utils/request')
|
|
3
|
+
const utils = require("../../utils/index")
|
|
4
|
+
const {
|
|
5
|
+
flow
|
|
6
|
+
} = require("@wecity/weda-plugin-utils");
|
|
7
|
+
const rulesConfig = require("../../utils/rules")
|
|
8
|
+
import {
|
|
9
|
+
SDKTrack,
|
|
10
|
+
setAccountInfo
|
|
11
|
+
} from '../../utils/QDTrackerNew/QDTrackerMain'
|
|
12
|
+
let cidType = '700'
|
|
13
|
+
|
|
14
|
+
Page({
|
|
15
|
+
/**
|
|
16
|
+
* 页面的初始数据
|
|
17
|
+
*/
|
|
18
|
+
data: {
|
|
19
|
+
language: 'en', // 语言环境:英文
|
|
20
|
+
formData: {
|
|
21
|
+
cid_type: '700', // 证件类型
|
|
22
|
+
id_card_number: '',
|
|
23
|
+
nation: '', // 国籍
|
|
24
|
+
nation_name: '',
|
|
25
|
+
sur_name: '', // 姓
|
|
26
|
+
first_name: '', // 名
|
|
27
|
+
sex: '', // 性别
|
|
28
|
+
birthday: '', // 出生日期
|
|
29
|
+
cid_expire_date: '', // 护照有效期
|
|
30
|
+
phone: '',
|
|
31
|
+
verify_expire_time: '', // 登录有效期
|
|
32
|
+
agree: false,
|
|
33
|
+
isbind: 1
|
|
34
|
+
},
|
|
35
|
+
needUnite: '', // 是否需要串联起来
|
|
36
|
+
cidTypeRange: [{
|
|
37
|
+
name: 'International passport',
|
|
38
|
+
value: '700'
|
|
39
|
+
} // 外国护照
|
|
40
|
+
],
|
|
41
|
+
sexRange: [{
|
|
42
|
+
name: 'Male',
|
|
43
|
+
value: 1
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Female',
|
|
47
|
+
value: 2
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
loginTimeRangeEn: [{
|
|
51
|
+
name: 'Keep me logged in for 1 day',
|
|
52
|
+
value: 24
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'Keep me logged in for 7 days',
|
|
56
|
+
value: 168
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'Keep me logged in for 30 days',
|
|
60
|
+
value: 720
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
validateType: {
|
|
64
|
+
id_card_number(value) {
|
|
65
|
+
return utils.validate.checkCid(value, cidType).data
|
|
66
|
+
},
|
|
67
|
+
// surName(value) {
|
|
68
|
+
// return utils.validate.checkName(value, cidType).data
|
|
69
|
+
// },
|
|
70
|
+
// firstName(value) {
|
|
71
|
+
// return utils.validate.checkName(value, cidType).data
|
|
72
|
+
// }
|
|
73
|
+
},
|
|
74
|
+
rules: rulesConfig.ForeignPassortRules('en'),
|
|
75
|
+
// 打开文档的防抖操作
|
|
76
|
+
canOpenPdf: true,
|
|
77
|
+
// 外国人护照核验状态 '1'(通过) '4'(审核中) ''(无审核单) 其它值(审核失败)
|
|
78
|
+
passportAuthStatus: '',
|
|
79
|
+
passportAuthPersonCode: '',
|
|
80
|
+
// 核验单数据
|
|
81
|
+
passportOldData: {},
|
|
82
|
+
// 弹窗
|
|
83
|
+
showModal: false,
|
|
84
|
+
modalStatus: 'info',
|
|
85
|
+
// 定义日期边界值
|
|
86
|
+
birthdayMaxDate: [new Date().getFullYear(), (new Date().getMonth() + 1), new Date().getDate()],
|
|
87
|
+
cidExpireMinDate: [new Date().getFullYear(), (new Date().getMonth() + 1), new Date().getDate()],
|
|
88
|
+
// cidType转化为certType
|
|
89
|
+
certTypeMap: {
|
|
90
|
+
'111': 1,
|
|
91
|
+
'516': 78,
|
|
92
|
+
'511': 4,
|
|
93
|
+
'17': 5,
|
|
94
|
+
'18': 6,
|
|
95
|
+
'414': 2,
|
|
96
|
+
'553': 9,
|
|
97
|
+
'700': 3
|
|
98
|
+
},
|
|
99
|
+
// 记录是否已经登录成功
|
|
100
|
+
hadSuccessLogin: false,
|
|
101
|
+
// 该操作会触发小程序的销毁回调
|
|
102
|
+
exitedState: true,
|
|
103
|
+
// surname自定义校验状态,傻逼数广傻逼组件逼的
|
|
104
|
+
sur_name_state: {
|
|
105
|
+
valid: true,
|
|
106
|
+
msg: ''
|
|
107
|
+
},
|
|
108
|
+
// givenName自定义校验状态,傻逼数广傻逼组件逼的
|
|
109
|
+
first_name_state: {
|
|
110
|
+
valid: true,
|
|
111
|
+
msg: ''
|
|
112
|
+
},
|
|
113
|
+
showCustomTips: false,
|
|
114
|
+
customTipsMsg: ''
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
// 验证sur_name和first_name
|
|
118
|
+
validateFullname() {
|
|
119
|
+
const {
|
|
120
|
+
sur_name,
|
|
121
|
+
first_name
|
|
122
|
+
} = this.data.formData
|
|
123
|
+
// 两个都没填
|
|
124
|
+
if ((sur_name == null || sur_name === '') && (first_name == null || first_name === '')) {
|
|
125
|
+
const msgEmpty = 'Please fill in surname or given name.';
|
|
126
|
+
this.setData({
|
|
127
|
+
sur_name_state: {
|
|
128
|
+
valid: false,
|
|
129
|
+
msg: msgEmpty
|
|
130
|
+
},
|
|
131
|
+
first_name_state: {
|
|
132
|
+
valid: false,
|
|
133
|
+
msg: msgEmpty
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
return {
|
|
137
|
+
valid: false,
|
|
138
|
+
msg: msgEmpty
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
this.setData({
|
|
142
|
+
sur_name_state: {
|
|
143
|
+
valid: true,
|
|
144
|
+
msg: ''
|
|
145
|
+
},
|
|
146
|
+
first_name_state: {
|
|
147
|
+
valid: false,
|
|
148
|
+
msg: ''
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
// 其中一个填了,或者两个都填了
|
|
152
|
+
let sur_name_flag = true
|
|
153
|
+
let msg = 'Please enter capital letters'
|
|
154
|
+
if (sur_name != null && sur_name !== '') {
|
|
155
|
+
const valid = utils.validate.checkName(sur_name, cidType)
|
|
156
|
+
if (valid.data) {
|
|
157
|
+
sur_name_flag = true
|
|
158
|
+
} else {
|
|
159
|
+
this.setData({
|
|
160
|
+
sur_name_state: {
|
|
161
|
+
valid: false,
|
|
162
|
+
msg
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
sur_name_flag = false
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
let first_name_flag = true
|
|
169
|
+
if (first_name != null && first_name !== '') {
|
|
170
|
+
const valid = utils.validate.checkName(first_name, cidType)
|
|
171
|
+
if (valid.data) {
|
|
172
|
+
first_name_flag = true
|
|
173
|
+
} else {
|
|
174
|
+
this.setData({
|
|
175
|
+
first_name_state: {
|
|
176
|
+
valid: false,
|
|
177
|
+
msg
|
|
178
|
+
}
|
|
179
|
+
})
|
|
180
|
+
first_name_flag = false
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (sur_name_flag && first_name_flag) {
|
|
184
|
+
this.setData({
|
|
185
|
+
sur_name_state: {
|
|
186
|
+
valid: true,
|
|
187
|
+
msg: ''
|
|
188
|
+
},
|
|
189
|
+
first_name_state: {
|
|
190
|
+
valid: false,
|
|
191
|
+
msg: ''
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
}
|
|
195
|
+
const valid = sur_name_flag && first_name_flag
|
|
196
|
+
return {
|
|
197
|
+
valid,
|
|
198
|
+
msg: valid ? '' : msg
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
// 自定义change事件,sur_name和first_name专用
|
|
203
|
+
handleCustomChange(e) {
|
|
204
|
+
let value = e.detail.value
|
|
205
|
+
let field = e.target.id
|
|
206
|
+
// 删除前后空格
|
|
207
|
+
if (typeof value === 'string') {
|
|
208
|
+
value = value.trim()
|
|
209
|
+
}
|
|
210
|
+
this.setData({
|
|
211
|
+
[`formData.${field}`]: value,
|
|
212
|
+
})
|
|
213
|
+
// 临时存储表单数据
|
|
214
|
+
this.saveFormDataTemp()
|
|
215
|
+
this.validateFullname()
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
// 关闭提示条
|
|
219
|
+
handleTipsClose(e) {
|
|
220
|
+
this.setData({
|
|
221
|
+
showCustomTips: e.detail.isShow
|
|
222
|
+
});
|
|
223
|
+
},
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* 生命周期函数--监听页面加载
|
|
227
|
+
*/
|
|
228
|
+
onLoad(options) {
|
|
229
|
+
console.log('onLoad', options)
|
|
230
|
+
// 设置用户账号信息
|
|
231
|
+
setAccountInfo(wx.getStorageSync('tif.openid'))
|
|
232
|
+
|
|
233
|
+
this.setData({
|
|
234
|
+
needUnite: options.needUnite || 'true'
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
// 清空本地Temp数据
|
|
238
|
+
wx.setStorageSync('tif.formDataTemp', '')
|
|
239
|
+
|
|
240
|
+
// 获取外国护照核验结果
|
|
241
|
+
this.fetchPassortAuthResult()
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
// 生命周期函数--监听页面显示
|
|
245
|
+
onShow: function () {
|
|
246
|
+
wx.hideShareMenu()
|
|
247
|
+
|
|
248
|
+
// 获取国籍
|
|
249
|
+
let pages = getCurrentPages()
|
|
250
|
+
let currentPage = pages[pages.length - 1]
|
|
251
|
+
let hadChoseNation = currentPage.data.hadChoseNation || false
|
|
252
|
+
|
|
253
|
+
if (hadChoseNation) {
|
|
254
|
+
let cid_type = currentPage.data.formData.cid_type
|
|
255
|
+
// 回传数据
|
|
256
|
+
this.reFullFormDataTemp(cid_type)
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
// 选择完国籍或认证失败后回传 -- 回传本地临时存储用户表单信息
|
|
261
|
+
reFullFormDataTemp(cid_type) {
|
|
262
|
+
const formDataTemp = wx.getStorageSync('tif.formDataTemp') || {}
|
|
263
|
+
let formDataOld = this.data.formData
|
|
264
|
+
|
|
265
|
+
if (formDataTemp && formDataTemp[cid_type]) {
|
|
266
|
+
console.log('存在可回填的temp数据', formDataTemp[cid_type])
|
|
267
|
+
let formData = Object.assign(formDataOld, formDataTemp[cid_type])
|
|
268
|
+
this.setData({
|
|
269
|
+
formData
|
|
270
|
+
}, () => {
|
|
271
|
+
wx.hideLoading()
|
|
272
|
+
})
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
|
|
276
|
+
// 同意协议和隐私政策
|
|
277
|
+
viewPrivacy(e) {
|
|
278
|
+
// 错误触发销毁回调函数处理
|
|
279
|
+
this.handleExitedState()
|
|
280
|
+
|
|
281
|
+
// 临时存储表单数据
|
|
282
|
+
this.saveFormDataTemp()
|
|
283
|
+
|
|
284
|
+
let canOpenPdf = this.data.canOpenPdf
|
|
285
|
+
if (canOpenPdf) {
|
|
286
|
+
this.setData({
|
|
287
|
+
canOpenPdf: false
|
|
288
|
+
})
|
|
289
|
+
let {
|
|
290
|
+
name,
|
|
291
|
+
file
|
|
292
|
+
} = e.currentTarget.dataset
|
|
293
|
+
console.log('文件地址', `https://js.jt.beijing.gov.cn/jt/tiffile/${file}.pdf`)
|
|
294
|
+
utils.openDoc({
|
|
295
|
+
url: `https://js.jt.beijing.gov.cn/jt/tiffile/${file}.pdf`,
|
|
296
|
+
fileType: 'pdf',
|
|
297
|
+
name,
|
|
298
|
+
successFn: () => {
|
|
299
|
+
console.log('文档打开成功回调')
|
|
300
|
+
setTimeout(() => {
|
|
301
|
+
this.setData({
|
|
302
|
+
canOpenPdf: true
|
|
303
|
+
})
|
|
304
|
+
}, 500)
|
|
305
|
+
}
|
|
306
|
+
})
|
|
307
|
+
} else {
|
|
308
|
+
setTimeout(() => {
|
|
309
|
+
this.setData({
|
|
310
|
+
canOpenPdf: true
|
|
311
|
+
})
|
|
312
|
+
}, 3500)
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
// 选择事件
|
|
317
|
+
handleChange(e) {
|
|
318
|
+
let value = e.detail.value
|
|
319
|
+
let formId = e.target.id
|
|
320
|
+
|
|
321
|
+
// 删除前后空格
|
|
322
|
+
if (typeof value === 'string' && formId !== 'cid_type') {
|
|
323
|
+
value = value.trim()
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
this.setData({
|
|
327
|
+
[`formData.${formId}`]: value,
|
|
328
|
+
})
|
|
329
|
+
// 临时存储表单数据
|
|
330
|
+
this.saveFormDataTemp()
|
|
331
|
+
},
|
|
332
|
+
|
|
333
|
+
// 临时存储用户填写的表单信息
|
|
334
|
+
saveFormDataTemp() {
|
|
335
|
+
let {
|
|
336
|
+
formData
|
|
337
|
+
} = this.data
|
|
338
|
+
|
|
339
|
+
let formDataTemp = wx.getStorageSync('tif.formDataTemp') || {}
|
|
340
|
+
formDataTemp['700'] = formData
|
|
341
|
+
wx.setStorageSync('tif.formDataTemp', formDataTemp)
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
// 获取外国人护照核验结果、是否需要返回状态
|
|
345
|
+
fetchPassortAuthResult(needStatus = false) {
|
|
346
|
+
let formData = this.data.formData
|
|
347
|
+
|
|
348
|
+
return new Promise((resolve) => {
|
|
349
|
+
jingtongVerifyRequest.getPassportInfo({
|
|
350
|
+
success: res => {
|
|
351
|
+
console.log('外国人护照核验接口获取成功', res)
|
|
352
|
+
this.setData({
|
|
353
|
+
passportAuthStatus: res.status,
|
|
354
|
+
passportAuthPersonCode: res.person_code
|
|
355
|
+
})
|
|
356
|
+
|
|
357
|
+
if (needStatus) {
|
|
358
|
+
// 需要返回状态
|
|
359
|
+
resolve(res.status)
|
|
360
|
+
} else {
|
|
361
|
+
let {
|
|
362
|
+
id_card_number,
|
|
363
|
+
nation,
|
|
364
|
+
sur_name,
|
|
365
|
+
first_name,
|
|
366
|
+
sex,
|
|
367
|
+
birthday,
|
|
368
|
+
cid_expire_date,
|
|
369
|
+
phone,
|
|
370
|
+
verify_expire_time,
|
|
371
|
+
nation_name
|
|
372
|
+
} = res
|
|
373
|
+
let passportOldData = {
|
|
374
|
+
id_card_number,
|
|
375
|
+
nation,
|
|
376
|
+
nation_name,
|
|
377
|
+
sur_name,
|
|
378
|
+
first_name,
|
|
379
|
+
sex: sex ? sex : '',
|
|
380
|
+
birthday,
|
|
381
|
+
cid_expire_date,
|
|
382
|
+
phone,
|
|
383
|
+
verify_expire_time: verify_expire_time && Number(verify_expire_time) || ''
|
|
384
|
+
}
|
|
385
|
+
formData = Object.assign(formData, res, passportOldData)
|
|
386
|
+
this.setData({
|
|
387
|
+
formData,
|
|
388
|
+
passportOldData
|
|
389
|
+
})
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
fail: err => {
|
|
393
|
+
console.log('外国人护照核验接口获取失败', err)
|
|
394
|
+
let {
|
|
395
|
+
errmsg
|
|
396
|
+
} = JSON.parse(err)
|
|
397
|
+
wx.showToast({
|
|
398
|
+
title: errmsg || '获取核验信息接口失败',
|
|
399
|
+
icon: 'none',
|
|
400
|
+
duration: 3000
|
|
401
|
+
})
|
|
402
|
+
}
|
|
403
|
+
})
|
|
404
|
+
})
|
|
405
|
+
},
|
|
406
|
+
|
|
407
|
+
// 选择国籍
|
|
408
|
+
handleNationTap() {
|
|
409
|
+
// 临时存储表单数据
|
|
410
|
+
this.saveFormDataTemp()
|
|
411
|
+
flow.navigateTo({
|
|
412
|
+
url: `../nation-list/nation-list?cid_type=700`,
|
|
413
|
+
})
|
|
414
|
+
},
|
|
415
|
+
|
|
416
|
+
// 显示自定义校验错误提示
|
|
417
|
+
showCuntomErrTip(msg) {
|
|
418
|
+
this.setData({
|
|
419
|
+
showCustomTips: true,
|
|
420
|
+
customTipsMsg: msg
|
|
421
|
+
}, () => {
|
|
422
|
+
// 3秒后关闭
|
|
423
|
+
setTimeout(() => {
|
|
424
|
+
this.setData({
|
|
425
|
+
showCustomTips: false,
|
|
426
|
+
customTipsMsg: ''
|
|
427
|
+
});
|
|
428
|
+
}, 3500);
|
|
429
|
+
})
|
|
430
|
+
},
|
|
431
|
+
|
|
432
|
+
async handleFormSubmit(e) {
|
|
433
|
+
const formValid = e.detail.validStatus
|
|
434
|
+
const customValid = this.validateFullname()
|
|
435
|
+
if (!e.detail.validStatus || !customValid.valid) {
|
|
436
|
+
// 自定义校验字段有问题,获取表单错误列表
|
|
437
|
+
const formErrList = e.detail.value
|
|
438
|
+
// 如果表单校验有问题,自定义校验没问题,则显示表单校验错误提示
|
|
439
|
+
if (!formValid && customValid.valid) {
|
|
440
|
+
this.showCuntomErrTip(formErrList[0].message)
|
|
441
|
+
return
|
|
442
|
+
}
|
|
443
|
+
// 如果表单校验没有问题,自定义校验有问题,则显示自定义校验错误提示
|
|
444
|
+
if (formValid && !customValid.valid) {
|
|
445
|
+
this.showCuntomErrTip(customValid.msg)
|
|
446
|
+
return
|
|
447
|
+
}
|
|
448
|
+
// 如果两者都有问题,则判断显示谁
|
|
449
|
+
let lastMsg = ''
|
|
450
|
+
if (formErrList.some(i => ["id_card_number", "nation"].includes(i.name))) {
|
|
451
|
+
lastMsg = formErrList[0].message
|
|
452
|
+
} else {
|
|
453
|
+
lastMsg = customValid.msg
|
|
454
|
+
}
|
|
455
|
+
this.showCuntomErrTip(lastMsg)
|
|
456
|
+
return
|
|
457
|
+
}
|
|
458
|
+
this.setData({
|
|
459
|
+
showCustomTips: false,
|
|
460
|
+
customTipsMsg: ''
|
|
461
|
+
})
|
|
462
|
+
wx.showLoading({
|
|
463
|
+
title: '加载中…',
|
|
464
|
+
mask: true
|
|
465
|
+
})
|
|
466
|
+
|
|
467
|
+
console.log('删除“姓名、证件号码、护照号码、手机号码”的前后空格')
|
|
468
|
+
let {
|
|
469
|
+
id_card_number,
|
|
470
|
+
sur_name,
|
|
471
|
+
first_name,
|
|
472
|
+
phone,
|
|
473
|
+
cid_type
|
|
474
|
+
} = this.data.formData
|
|
475
|
+
// sur_name值为空,增加空格
|
|
476
|
+
if (sur_name == null || sur_name === '') {
|
|
477
|
+
sur_name = ' '
|
|
478
|
+
} else {
|
|
479
|
+
sur_name = sur_name.trim()
|
|
480
|
+
}
|
|
481
|
+
// first_name值为空,增加空格
|
|
482
|
+
if (first_name == null || first_name === '') {
|
|
483
|
+
first_name = ' '
|
|
484
|
+
} else {
|
|
485
|
+
first_name = first_name.trim()
|
|
486
|
+
}
|
|
487
|
+
this.setData({
|
|
488
|
+
['formData.sur_name']: sur_name,
|
|
489
|
+
['formData.first_name']: first_name,
|
|
490
|
+
['formData.phone']: phone.trim()
|
|
491
|
+
})
|
|
492
|
+
|
|
493
|
+
if (cid_type === '700') {
|
|
494
|
+
console.log('删除“外国人护照号码”中间空格')
|
|
495
|
+
this.setData({
|
|
496
|
+
['formData.id_card_number']: id_card_number.replace(/\s+/g, '')
|
|
497
|
+
})
|
|
498
|
+
}
|
|
499
|
+
console.log('入参', this.data.formData)
|
|
500
|
+
|
|
501
|
+
console.log('外国人护照核验')
|
|
502
|
+
// 外国人护照核验
|
|
503
|
+
this.handlePassortAuth()
|
|
504
|
+
},
|
|
505
|
+
|
|
506
|
+
// 外国人护照核验处理逻辑
|
|
507
|
+
handlePassortAuth() {
|
|
508
|
+
let authStatus = this.data.passportAuthStatus
|
|
509
|
+
let newData = this.data.formData
|
|
510
|
+
let oldData = this.data.passportOldData
|
|
511
|
+
console.log('当前核验单状态', authStatus)
|
|
512
|
+
|
|
513
|
+
if (!authStatus) {
|
|
514
|
+
console.log('无审核单', authStatus)
|
|
515
|
+
// 外国人护照核验,提交核验单
|
|
516
|
+
this.passportAuth()
|
|
517
|
+
} else {
|
|
518
|
+
// 查上一单的状态
|
|
519
|
+
this.fetchPassortAuthResult(true).then(status => {
|
|
520
|
+
console.log('====查上一单的状态====', status)
|
|
521
|
+
if (status === '1') {
|
|
522
|
+
// 核验通过,弹窗提示
|
|
523
|
+
console.log('外国人护照核验通过')
|
|
524
|
+
this.passportAuthSuccess()
|
|
525
|
+
} else {
|
|
526
|
+
// 比对表单数据是否有修改
|
|
527
|
+
console.log('新旧表单数据比对', newData, oldData)
|
|
528
|
+
if (utils.objIsEqual(newData, oldData)) {
|
|
529
|
+
console.log('表单数据没有修改')
|
|
530
|
+
if (status === '4') {
|
|
531
|
+
// 核验中
|
|
532
|
+
this.fetchPassortAuthResult(true).then(status => {
|
|
533
|
+
console.log('再次获取外国人护照核验状态', status)
|
|
534
|
+
if (status === '1') {
|
|
535
|
+
console.log('外国人护照核验通过')
|
|
536
|
+
this.passportAuthSuccess()
|
|
537
|
+
} else if (status === '4') {
|
|
538
|
+
console.log('外国人护照核验中,弹窗提示')
|
|
539
|
+
this.handleShowModal(status)
|
|
540
|
+
} else {
|
|
541
|
+
// 核验不通过,弹窗提示
|
|
542
|
+
this.passportAuthFail(status)
|
|
543
|
+
}
|
|
544
|
+
})
|
|
545
|
+
} else {
|
|
546
|
+
// 核验不通过,弹窗提示
|
|
547
|
+
this.passportAuthFail(status)
|
|
548
|
+
}
|
|
549
|
+
} else {
|
|
550
|
+
console.log('表单数据存在修改')
|
|
551
|
+
// 外国人护照核验,提交核验单
|
|
552
|
+
this.passportAuth()
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
})
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
|
|
559
|
+
// 外国人护照核验不通过逻辑
|
|
560
|
+
passportAuthFail(status) {
|
|
561
|
+
console.log('===外国人护照核验不通过,弹窗提示===')
|
|
562
|
+
// 判断当前person_code是否已失效
|
|
563
|
+
const personCode = this.data.passportAuthPersonCode
|
|
564
|
+
const localPersonCode = wx.getStorageSync('tif.fail.person_code') || ''
|
|
565
|
+
if (personCode === localPersonCode) {
|
|
566
|
+
// 提交核验单
|
|
567
|
+
this.passportAuth()
|
|
568
|
+
} else {
|
|
569
|
+
// 埋点上报事件:自然人登录
|
|
570
|
+
this.loginTracker(2, this.data.formData.cid_type)
|
|
571
|
+
|
|
572
|
+
this.handleShowModal(status)
|
|
573
|
+
// 记录这个person_code是失效的
|
|
574
|
+
wx.setStorageSync('tif.fail.person_code', this.data.passportAuthPersonCode)
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
|
|
578
|
+
// 外国人护照核验接口
|
|
579
|
+
async passportAuth() {
|
|
580
|
+
console.log('===========提交核验单============')
|
|
581
|
+
let formData = this.data.formData
|
|
582
|
+
|
|
583
|
+
const isLegalDate = utils.greaterCurrentTime(formData.cid_expire_date)
|
|
584
|
+
console.log('isLegalDate', isLegalDate)
|
|
585
|
+
if (!isLegalDate) {
|
|
586
|
+
console.log('护照有效期日期不合法')
|
|
587
|
+
wx.showToast({
|
|
588
|
+
title: 'Please select the passport expiration date',
|
|
589
|
+
icon: 'none',
|
|
590
|
+
duration: 3000
|
|
591
|
+
})
|
|
592
|
+
this.setData({
|
|
593
|
+
'formData.cid_expire_date': ''
|
|
594
|
+
})
|
|
595
|
+
return
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
const [err, res] = await utils.awaitTo(jingtongVerifyRequest.passportAuth(formData))
|
|
599
|
+
if (err) {
|
|
600
|
+
console.log('外国人护照核验接口认证失败', err)
|
|
601
|
+
let {
|
|
602
|
+
errmsg
|
|
603
|
+
} = JSON.parse(err)
|
|
604
|
+
wx.showToast({
|
|
605
|
+
title: errmsg || '认证失败',
|
|
606
|
+
icon: 'none',
|
|
607
|
+
duration: 3000
|
|
608
|
+
})
|
|
609
|
+
return
|
|
610
|
+
}
|
|
611
|
+
console.log('弹窗提示等待1分钟', res)
|
|
612
|
+
this.setData({
|
|
613
|
+
passportAuthStatus: '4',
|
|
614
|
+
passportOldData: JSON.parse(JSON.stringify(formData)),
|
|
615
|
+
passportAuthPersonCode: ''
|
|
616
|
+
})
|
|
617
|
+
wx.setStorageSync('tif.fail.person_code', '')
|
|
618
|
+
this.handleShowModal('4')
|
|
619
|
+
},
|
|
620
|
+
|
|
621
|
+
// 外国人护照核验通过
|
|
622
|
+
passportAuthSuccess() {
|
|
623
|
+
// 调用删除接口/静默登录并返回session信息
|
|
624
|
+
jingtongVerifyRequest.deletePassportAuth({
|
|
625
|
+
success: session => {
|
|
626
|
+
console.log('返回session信息', session)
|
|
627
|
+
|
|
628
|
+
// 删除缓存信息
|
|
629
|
+
console.log('删除缓存信息')
|
|
630
|
+
let formDataTemp = wx.getStorageSync('tif.formDataTemp')
|
|
631
|
+
formDataTemp['700'] = {}
|
|
632
|
+
wx.setStorageSync('tif.formDataTemp', formDataTemp)
|
|
633
|
+
this.setData({
|
|
634
|
+
passportOldData: {}
|
|
635
|
+
})
|
|
636
|
+
|
|
637
|
+
this.authSuccess(session, true)
|
|
638
|
+
},
|
|
639
|
+
fail: err => {
|
|
640
|
+
// 埋点上报事件:自然人登录
|
|
641
|
+
this.loginTracker(2, this.data.formData.cid_type)
|
|
642
|
+
|
|
643
|
+
let {
|
|
644
|
+
errmsg
|
|
645
|
+
} = JSON.parse(err)
|
|
646
|
+
wx.showToast({
|
|
647
|
+
title: errmsg || 'auth fail',
|
|
648
|
+
icon: 'none',
|
|
649
|
+
duration: 3000
|
|
650
|
+
})
|
|
651
|
+
}
|
|
652
|
+
})
|
|
653
|
+
},
|
|
654
|
+
|
|
655
|
+
// 认证成功后续操作
|
|
656
|
+
authSuccess(session, isEn = false) {
|
|
657
|
+
console.log('====判断是否真的登录成功=====')
|
|
658
|
+
if (!session) {
|
|
659
|
+
wx.showToast({
|
|
660
|
+
title: 'Login has expired, please log in again',
|
|
661
|
+
icon: 'none',
|
|
662
|
+
duration: 3000
|
|
663
|
+
})
|
|
664
|
+
return
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
const {
|
|
668
|
+
face_time,
|
|
669
|
+
realname_time,
|
|
670
|
+
cid,
|
|
671
|
+
has_phone,
|
|
672
|
+
certType
|
|
673
|
+
} = session
|
|
674
|
+
if ((!face_time && !realname_time) || !cid) {
|
|
675
|
+
wx.showToast({
|
|
676
|
+
title: `Login has expired, please log in again: ${this.data.formData.cid_type}`,
|
|
677
|
+
icon: 'none',
|
|
678
|
+
duration: 2000
|
|
679
|
+
})
|
|
680
|
+
return
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
wx.showToast({
|
|
684
|
+
title: isEn ? 'Verification successful, redirecting...' : '验证成功, 跳转中…',
|
|
685
|
+
icon: 'none',
|
|
686
|
+
duration: 5000,
|
|
687
|
+
mask: true
|
|
688
|
+
})
|
|
689
|
+
|
|
690
|
+
const cidType = session.cid_type
|
|
691
|
+
|
|
692
|
+
// 本地存储表单核验成功数据
|
|
693
|
+
wx.setStorageSync('tif.formDataSuccess', this.data.formData)
|
|
694
|
+
|
|
695
|
+
// 将弹窗标识设置为不需要弹窗
|
|
696
|
+
jingtongVerifyRequest.setUserReadStatus(false).then(() => {
|
|
697
|
+
console.log('设置弹窗标识成功')
|
|
698
|
+
}).catch(err => {
|
|
699
|
+
console.log('设置弹窗标识失败', err)
|
|
700
|
+
})
|
|
701
|
+
|
|
702
|
+
setTimeout(() => {
|
|
703
|
+
if (this.data.needUnite === "true") {
|
|
704
|
+
console.log('通业务总接口passport-verify(skd: 1.6.2-beta.2)')
|
|
705
|
+
console.log('判断是否有手机号码', has_phone)
|
|
706
|
+
// this.setData({
|
|
707
|
+
// needUnite: ''
|
|
708
|
+
// })
|
|
709
|
+
|
|
710
|
+
// 登录成功回调 => 业务侧操作事项
|
|
711
|
+
wx.$_ServiceConfiguration && wx.$_ServiceConfiguration.methods && wx.$_ServiceConfiguration.methods._loginSuccessCallBack && wx.$_ServiceConfiguration.methods._loginSuccessCallBack(session)
|
|
712
|
+
|
|
713
|
+
if (has_phone) {
|
|
714
|
+
const realPhone = wx.getStorageSync('tif.realPhone') || ''
|
|
715
|
+
const caPhone = wx.getStorageSync('tif.caPhone') || ''
|
|
716
|
+
const confirmTime = wx.getStorageSync('tif.tel_confirm_time') || ''
|
|
717
|
+
|
|
718
|
+
console.log('realPhone', realPhone)
|
|
719
|
+
console.log('caPhone', caPhone)
|
|
720
|
+
console.log('confirmTime', confirmTime)
|
|
721
|
+
|
|
722
|
+
if (realPhone !== caPhone && confirmTime && (!utils.completeDate(new Date(Number(confirmTime + '000')), 6))) {
|
|
723
|
+
// 埋点上报事件:自然人登录
|
|
724
|
+
this.loginTracker(1, cidType)
|
|
725
|
+
|
|
726
|
+
this.setData({
|
|
727
|
+
hadSuccessLogin: true
|
|
728
|
+
})
|
|
729
|
+
|
|
730
|
+
// 【phone与caPhone不同】且【tel_confirm_time大于6个月】
|
|
731
|
+
// 数据库手机号码有效期大于6个月
|
|
732
|
+
// flow.redirectTo({
|
|
733
|
+
// url: '../confirm-phone/confirm-phone'
|
|
734
|
+
// })
|
|
735
|
+
// 新增逻辑:如果caPhone存在,则跳转原来的逻辑,即换绑手机号,否则跳转绑定手机号
|
|
736
|
+
if (caPhone == null || caPhone === '') {
|
|
737
|
+
flow.redirectTo({
|
|
738
|
+
url: '../bind-phone/bind-phone?source=14'
|
|
739
|
+
})
|
|
740
|
+
} else {
|
|
741
|
+
flow.redirectTo({
|
|
742
|
+
url: '../confirm-phone/confirm-phone'
|
|
743
|
+
})
|
|
744
|
+
}
|
|
745
|
+
} else {
|
|
746
|
+
jingtongVerifyRequest.personToken({
|
|
747
|
+
source: '12'
|
|
748
|
+
}).then(async data => {
|
|
749
|
+
// 设置用户账号信息
|
|
750
|
+
setAccountInfo(session.openid)
|
|
751
|
+
|
|
752
|
+
// 埋点上报事件:自然人登录
|
|
753
|
+
this.loginTracker(1, cidType)
|
|
754
|
+
|
|
755
|
+
this.setData({
|
|
756
|
+
hadSuccessLogin: true
|
|
757
|
+
})
|
|
758
|
+
|
|
759
|
+
// 埋点 - 个人用户实体全属性上报
|
|
760
|
+
let last_login_time = utils.getCurrentTime()
|
|
761
|
+
wx.setStorageSync('tif.lastLoginTime', last_login_time)
|
|
762
|
+
const userEntityReportData = Object.assign(session, {
|
|
763
|
+
user_status: '1',
|
|
764
|
+
last_login_time,
|
|
765
|
+
user_date_of_birth: session.cid_type === '111' ? utils.getBirthByIDCard(session.cid) : ''
|
|
766
|
+
})
|
|
767
|
+
await utils.awaitTo(jingtongVerifyRequest.userEntityReport(userEntityReportData))
|
|
768
|
+
|
|
769
|
+
setTimeout(() => {
|
|
770
|
+
flow.resolve({
|
|
771
|
+
token: data
|
|
772
|
+
})
|
|
773
|
+
}, 1200)
|
|
774
|
+
})
|
|
775
|
+
}
|
|
776
|
+
} else {
|
|
777
|
+
// 埋点上报事件:自然人登录
|
|
778
|
+
this.loginTracker(1, cidType)
|
|
779
|
+
|
|
780
|
+
this.setData({
|
|
781
|
+
hadSuccessLogin: true
|
|
782
|
+
})
|
|
783
|
+
|
|
784
|
+
flow.redirectTo({
|
|
785
|
+
url: '../bind-phone/bind-phone?source=4'
|
|
786
|
+
})
|
|
787
|
+
}
|
|
788
|
+
} else {
|
|
789
|
+
console.log('返回主包')
|
|
790
|
+
flow.resolve()
|
|
791
|
+
}
|
|
792
|
+
}, 800)
|
|
793
|
+
},
|
|
794
|
+
|
|
795
|
+
// 埋点上报事件:自然人登录
|
|
796
|
+
loginTracker(login_status = 1, cidType) {
|
|
797
|
+
SDKTrack('nature_person_login', {
|
|
798
|
+
// 1 登录成功;2 登录失败-身份信息核验失败;3 登录失败-人脸核验失败
|
|
799
|
+
// 4 登录失败-电子营业执照核验失败;5 登录失败-账号密码输入错误
|
|
800
|
+
// 6 取消登录(包含点击温馨提示的“取消”,点击请法人登录的×,在登录页面点击左上角返回按钮退出登录)
|
|
801
|
+
// 7 退出小程序终止登录;old_1 历史数据:除登录成功之外的所有情况
|
|
802
|
+
login_status,
|
|
803
|
+
login_certificate: this.data.certTypeMap[cidType] || 1, // 证件类型
|
|
804
|
+
invoke_location: '', // 调起位置
|
|
805
|
+
login_validity_period: this.data.formData.verify_expire_time / 24 || '' // 免登录时间
|
|
806
|
+
})
|
|
807
|
+
},
|
|
808
|
+
|
|
809
|
+
// 显示弹窗
|
|
810
|
+
handleShowModal(status) {
|
|
811
|
+
let modalStatus = ''
|
|
812
|
+
if (status === '3') {
|
|
813
|
+
// 未找到信息
|
|
814
|
+
modalStatus = 'warning'
|
|
815
|
+
} else if (status === '4') {
|
|
816
|
+
// 核验中
|
|
817
|
+
modalStatus = 'info'
|
|
818
|
+
} else {
|
|
819
|
+
// 信息有误
|
|
820
|
+
modalStatus = 'error'
|
|
821
|
+
}
|
|
822
|
+
this.setData({
|
|
823
|
+
modalStatus,
|
|
824
|
+
showModal: true
|
|
825
|
+
}, () => {
|
|
826
|
+
wx.hideLoading()
|
|
827
|
+
})
|
|
828
|
+
},
|
|
829
|
+
|
|
830
|
+
// modal确认事件
|
|
831
|
+
handleModalOk() {
|
|
832
|
+
this.setData({
|
|
833
|
+
showModal: false
|
|
834
|
+
})
|
|
835
|
+
},
|
|
836
|
+
|
|
837
|
+
onUnload: function () {
|
|
838
|
+
// 页面卸载时的逻辑处理
|
|
839
|
+
console.log('======页面即将卸载======', this.data.hadSuccessLogin);
|
|
840
|
+
if (!this.data.hadSuccessLogin) {
|
|
841
|
+
// 埋点上报事件:自然人登录
|
|
842
|
+
this.loginTracker(6, this.data.formData.cid_type)
|
|
843
|
+
}
|
|
844
|
+
},
|
|
845
|
+
|
|
846
|
+
// 有些操作程序会触发销毁回调函数,该操作不是真正的小程序销毁操作
|
|
847
|
+
handleExitedState() {
|
|
848
|
+
this.setData({
|
|
849
|
+
exitedState: false
|
|
850
|
+
})
|
|
851
|
+
setTimeout(() => {
|
|
852
|
+
this.setData({
|
|
853
|
+
exitedState: true
|
|
854
|
+
})
|
|
855
|
+
}, 2000)
|
|
856
|
+
},
|
|
857
|
+
|
|
858
|
+
onSaveExitState: function () {
|
|
859
|
+
// 小程序可能被销毁之前的逻辑处理
|
|
860
|
+
if (!this.data.hadSuccessLogin && this.data.exitedState) {
|
|
861
|
+
console.log('======小程序可能被销毁======')
|
|
862
|
+
// 埋点上报事件:自然人登录
|
|
863
|
+
this.loginTracker(7, this.data.formData.cid_type)
|
|
864
|
+
}
|
|
865
|
+
}
|
|
855
866
|
})
|