weapps-plugin-jingtong-verify 1.3.9 → 1.4.1-dev

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.
Files changed (187) hide show
  1. package/README.md +2 -1
  2. package/app.json +33 -33
  3. package/package.json +20 -20
  4. package/sdk.js +289 -289
  5. package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.js +31 -31
  6. package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.json +3 -3
  7. package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.wxml +9 -9
  8. package/weapps-plugin-jingtong-verify/components/card-modal/card-modal.wxss +65 -65
  9. package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.js +37 -37
  10. package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.json +3 -3
  11. package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.wxml +30 -30
  12. package/weapps-plugin-jingtong-verify/components/face-error-modal/face-error-modal.wxss +79 -79
  13. package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.js +32 -32
  14. package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.json +3 -3
  15. package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.wxml +16 -16
  16. package/weapps-plugin-jingtong-verify/components/face-modal/face-modal.wxss +57 -57
  17. package/weapps-plugin-jingtong-verify/components/gsd-lib/anim/anim.min.js +1 -1
  18. package/weapps-plugin-jingtong-verify/components/gsd-lib/crypto/crypto.js +37 -37
  19. package/weapps-plugin-jingtong-verify/components/gsd-lib/crypto/index.js +44 -44
  20. package/weapps-plugin-jingtong-verify/components/gsd-lib/dayjs/index.js +351 -351
  21. package/weapps-plugin-jingtong-verify/components/gsd-lib/event/index.js +117 -117
  22. package/weapps-plugin-jingtong-verify/components/gsd-lib/index.js +63 -63
  23. package/weapps-plugin-jingtong-verify/components/gsd-lib/map/index.js +10 -10
  24. package/weapps-plugin-jingtong-verify/components/gsd-lib/map/qmap.js +6 -6
  25. package/weapps-plugin-jingtong-verify/components/gsd-lib/storage/index.js +114 -114
  26. package/weapps-plugin-jingtong-verify/components/gsd-lib/utils/index.js +218 -218
  27. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/formCheck.js +72 -72
  28. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/formController.js +47 -47
  29. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/icon.js +11 -11
  30. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/list.js +16 -16
  31. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/navigator.js +33 -33
  32. package/weapps-plugin-jingtong-verify/components/gsd-ui/behaviors/primarySecondButton.js +18 -18
  33. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.js +12 -12
  34. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.json +5 -5
  35. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-agree/index.wxml +15 -15
  36. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.js +47 -0
  37. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.json +4 -0
  38. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.wxml +13 -0
  39. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.wxss +1 -0
  40. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.js +44 -44
  41. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.json +5 -5
  42. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.wxml +28 -28
  43. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.js +30 -0
  44. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.json +7 -0
  45. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxml +42 -0
  46. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxss +1 -0
  47. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.js +418 -414
  48. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.json +5 -5
  49. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.wxml +29 -29
  50. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.js +11 -11
  51. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.json +3 -3
  52. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.wxml +4 -4
  53. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.js +179 -179
  54. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.json +6 -6
  55. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.wxml +16 -16
  56. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.js +92 -92
  57. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.json +6 -6
  58. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxml +12 -12
  59. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxss +2 -2
  60. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.js +49 -48
  61. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.json +3 -3
  62. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.wxml +14 -13
  63. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.js +33 -33
  64. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.json +3 -3
  65. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.wxml +2 -2
  66. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.js +108 -108
  67. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.json +6 -6
  68. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.wxml +53 -53
  69. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.js +237 -233
  70. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.json +8 -8
  71. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.wxml +49 -49
  72. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.js +328 -324
  73. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.json +6 -6
  74. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.wxml +26 -26
  75. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.js +159 -159
  76. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.json +3 -3
  77. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.wxml +10 -10
  78. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.js +112 -112
  79. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.json +5 -5
  80. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.wxml +21 -21
  81. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.js +21 -0
  82. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.json +7 -0
  83. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.wxml +16 -0
  84. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.wxss +1 -0
  85. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.js +50 -50
  86. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.json +5 -5
  87. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.wxml +27 -27
  88. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/add.svg +13 -13
  89. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/arrow.svg +14 -14
  90. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/delete.svg +16 -16
  91. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/preview.svg +21 -21
  92. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/user.svg +13 -13
  93. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-agree.wxss +147 -147
  94. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-badge.wxss +41 -0
  95. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-button-group.wxss +244 -244
  96. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-cell.wxss +220 -0
  97. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-dropdown.wxss +115 -115
  98. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-cell.wxss +101 -101
  99. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-item.wxss +174 -167
  100. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form.wxss +101 -101
  101. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-icon.wxss +268 -268
  102. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-index-list.wxss +206 -206
  103. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-input.wxss +206 -206
  104. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-picker.wxss +139 -139
  105. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-popover.wxss +129 -129
  106. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-search.wxss +171 -171
  107. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-switch.wxss +176 -0
  108. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-tips.wxss +173 -173
  109. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/icon/iconfont.wxss +160 -160
  110. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/main.wxss +283 -283
  111. package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/helper.js +55 -55
  112. package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validType.js +117 -117
  113. package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validator.js +106 -106
  114. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.js +32 -32
  115. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.json +3 -3
  116. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxml +8 -8
  117. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxss +57 -57
  118. package/weapps-plugin-jingtong-verify/components/modal/modal.js +32 -32
  119. package/weapps-plugin-jingtong-verify/components/modal/modal.json +3 -3
  120. package/weapps-plugin-jingtong-verify/components/modal/modal.wxml +28 -28
  121. package/weapps-plugin-jingtong-verify/components/modal/modal.wxss +84 -84
  122. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.js +82 -82
  123. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.json +3 -3
  124. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxml +18 -18
  125. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxss +72 -71
  126. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.js +39 -35
  127. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.json +3 -3
  128. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxml +9 -9
  129. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxss +51 -51
  130. package/weapps-plugin-jingtong-verify/i18n/index.js +7 -7
  131. package/weapps-plugin-jingtong-verify/i18n/logout.js +10 -10
  132. package/weapps-plugin-jingtong-verify/i18n/rules.js +202 -189
  133. package/weapps-plugin-jingtong-verify/images/close-circle.png +0 -0
  134. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.js +86 -86
  135. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.json +6 -6
  136. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxml +20 -17
  137. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxss +51 -38
  138. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.js +167 -167
  139. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.json +3 -3
  140. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxml +30 -30
  141. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxss +91 -91
  142. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.js +79 -79
  143. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.json +5 -5
  144. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxml +19 -19
  145. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxss +44 -44
  146. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.js +1382 -1286
  147. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.json +16 -15
  148. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxml +494 -410
  149. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxss +116 -76
  150. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.js +127 -126
  151. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.json +5 -5
  152. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxml +36 -36
  153. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxss +60 -60
  154. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.js +106 -106
  155. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.json +3 -3
  156. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxml +29 -29
  157. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxss +68 -68
  158. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.js +24 -24
  159. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.json +3 -3
  160. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxml +12 -12
  161. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxss +33 -33
  162. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.js +110 -97
  163. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.json +6 -6
  164. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxml +9 -9
  165. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxss +1 -1
  166. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.js +641 -641
  167. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.json +10 -10
  168. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxml +152 -152
  169. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxss +47 -47
  170. package/weapps-plugin-jingtong-verify/pages/setting/setting.js +328 -328
  171. package/weapps-plugin-jingtong-verify/pages/setting/setting.json +5 -5
  172. package/weapps-plugin-jingtong-verify/pages/setting/setting.wxml +91 -91
  173. package/weapps-plugin-jingtong-verify/pages/setting/setting.wxss +69 -69
  174. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.js +306 -159
  175. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.json +7 -6
  176. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxml +142 -61
  177. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxss +110 -64
  178. package/weapps-plugin-jingtong-verify/style/page.wxss +13 -13
  179. package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTracker.js +15 -15
  180. package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTrackerMain.js +59 -59
  181. package/weapps-plugin-jingtong-verify/utils/country.js +209 -203
  182. package/weapps-plugin-jingtong-verify/utils/index.js +306 -306
  183. package/weapps-plugin-jingtong-verify/utils/jsencrypt.min.js +1 -1
  184. package/weapps-plugin-jingtong-verify/utils/request.js +89 -24
  185. package/weapps-plugin-jingtong-verify/utils/rules.js +258 -162
  186. package/weapps-plugin-jingtong-verify/utils/tifadmin_config.js +61 -61
  187. package/weapps-plugin-jingtong-verify/utils/validate.js +772 -754
package/sdk.js CHANGED
@@ -1,290 +1,290 @@
1
- const jingtongVerifyRequest = require('./weapps-plugin-jingtong-verify/utils/request')
2
- const { nation } = require("./weapps-plugin-jingtong-verify/utils/country")
3
- const {
4
- flow,
5
- config
6
- } = require('@wecity/weda-plugin-utils')
7
-
8
- // 统一插件配置
9
- exports.init = (options) => {
10
- console.log('设置配置', options)
11
- jingtongVerifyRequest.init(options)
12
- }
13
-
14
- // 对业务侧入参进行拦截和兼容
15
- const parseOptions = (options) => {
16
- const optionsType = Object.prototype.toString.call(options)
17
- console.log('===处理前options===', options)
18
- if ((options && optionsType !== '[object Object]') || (optionsType === '[object Null]')) {
19
- console.error('业务侧入参不合法!!入参的数据类型必须为对象')
20
- options = {}
21
- }
22
- options = Object.assign({}, options)
23
- console.log('== 处理后options ==', options)
24
- return options
25
- }
26
-
27
- // 获取会话
28
- exports.getSession = (options) => {
29
- // 对参数做兼容性处理
30
- let optionsParse = parseOptions(options)
31
-
32
- jingtongVerifyRequest.getSession({
33
- success: res => {
34
- optionsParse && optionsParse.success && optionsParse.success(res)
35
- },
36
- fail: fail => {
37
- console.log('getSession-fail', fail)
38
- optionsParse && optionsParse.fail && optionsParse.fail(fail)
39
- }
40
- })
41
- }
42
-
43
- // 个人信息
44
- exports.goToUserInfo = () => {
45
- console.log('跳转到子包 === 个人信息服务')
46
- return flow.createFlow('/weapps-plugin-jingtong-verify/pages/user-info/user-info')
47
- }
48
-
49
- // 设置
50
- exports.goToSetting = () => {
51
- console.log('跳转到子包 === 设置服务')
52
- return flow.createFlow('/weapps-plugin-jingtong-verify/pages/setting/setting')
53
- }
54
-
55
- // 身份验证
56
- const toVerify = () => {
57
- return flow.createFlow('/weapps-plugin-jingtong-verify/pages/face-verify/face-verify', {
58
- needUnite: 'true' // 需串联起来
59
- })
60
- }
61
-
62
- // 确认手机号码
63
- const toConfirmPhone = () => {
64
- return flow.createFlow('/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone')
65
- }
66
-
67
- // 绑定手机号码
68
- const toBindPhone = (source) => {
69
- return flow.createFlow('/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone', {
70
- source
71
- })
72
- }
73
-
74
- // 比较两个时间 time1,time2均为日期类型
75
- // 判断当前日期与time1日期是否相差小于6月
76
- const completeDate = (time1, m) => {
77
- var diffyear = new Date().getFullYear() - time1.getFullYear();
78
- var diffmonth = diffyear * 12 + new Date().getMonth() - time1.getMonth();
79
- if (diffmonth < 0) {
80
- return false;
81
- }
82
-
83
- var diffDay = new Date().getDate() - time1.getDate();
84
- if (diffmonth < m || (diffmonth == m && diffDay <= 0)) {
85
- if (diffmonth == m && diffDay == 0) {
86
- var timeA = time1.getHours() * 3600 + 60 * time1.getMinutes() + time1.getSeconds();
87
- var timeB = new Date().getHours() * 3600 + 60 * new Date().getMinutes() + new Date().getSeconds();
88
- if (timeB - timeA > 0) {
89
- return false;
90
- }
91
- }
92
- return true;
93
- }
94
- return false;
95
- }
96
-
97
- // 串通业务总接口
98
- exports.getPersonToken = (options) => {
99
- // 对参数做兼容性处理
100
- let optionsParse = parseOptions(options)
101
-
102
- jingtongVerifyRequest.getSession({
103
- success: res => {
104
- if (!res.face_time && !res.realname_time) {
105
- // 未身份验证/身份验证已过期
106
- toVerify().then(res => {
107
- optionsParse && optionsParse.success && optionsParse.success(res)
108
- })
109
- } else {
110
- // 身份验证未过期 => 判断有无手机号码
111
- if (res.has_phone) {
112
- const { tel_confirm_time } = res
113
- if (res.phone !== res.caPhone && tel_confirm_time && (!completeDate(new Date(Number(tel_confirm_time + '000')), 6))) {
114
- // 【phone与caPhone不同】且【tel_confirm_time大于6个月】
115
- toConfirmPhone().then(res => {
116
- optionsParse && optionsParse.success && optionsParse.success(res)
117
- })
118
- } else {
119
- // 手机号码未过期
120
- jingtongVerifyRequest.personToken({
121
- from: 'sdk'
122
- }).then(data => {
123
- optionsParse && optionsParse.success && optionsParse.success({
124
- token: data
125
- })
126
- }).catch(err => {
127
- console.log(JSON.parse(err))
128
- if (err && err === '4035') {
129
- // 无手机号码 => 绑定手机号码
130
- toBindPhone('5').then(res => {
131
- optionsParse && optionsParse.success && optionsParse.success(res)
132
- })
133
- }
134
- })
135
- }
136
- } else {
137
- // 无手机号码 => 绑定手机号码
138
- toBindPhone('6').then(res => {
139
- optionsParse && optionsParse.success && optionsParse.success(res)
140
- })
141
- }
142
- }
143
- },
144
- fail: err => {
145
- console.log('getSession-fail', err)
146
- optionsParse && optionsParse.fail && optionsParse.fail(err)
147
- }
148
- })
149
- }
150
-
151
- // 外国护照认证
152
- const toPassportVerify = () => {
153
- return flow.createFlow('/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify', {
154
- needUnite: 'true' // 需串联起来
155
- })
156
- }
157
-
158
- // 串通业务总接口 -- 外国护照入口
159
- exports.getPersonTokenPassport = (options) => {
160
- // 对参数做兼容性处理
161
- let optionsParse = parseOptions(options)
162
-
163
- jingtongVerifyRequest.getSession({
164
- success: res => {
165
- if (!res.face_time && !res.realname_time) {
166
- // 未身份验证/身份验证已过期
167
- toPassportVerify().then(res => {
168
- optionsParse && optionsParse.success && optionsParse.success(res)
169
- })
170
- } else {
171
- // 身份验证未过期 => 判断有无手机号码
172
- if (res.has_phone) {
173
- const { tel_confirm_time } = res
174
- if (res.phone !== res.caPhone && tel_confirm_time && (!completeDate(new Date(Number(tel_confirm_time + '000')), 6))) {
175
- // 【phone与caPhone不同】且【tel_confirm_time大于6个月】
176
- toConfirmPhone().then(res => {
177
- optionsParse && optionsParse.success && optionsParse.success(res)
178
- })
179
- } else {
180
- // 手机号码未过期
181
- jingtongVerifyRequest.personToken({
182
- from: 'sdk'
183
- }).then(data => {
184
- optionsParse && optionsParse.success && optionsParse.success({
185
- token: data
186
- })
187
- }).catch(err => {
188
- console.log(JSON.parse(err))
189
- if (err && err === '4035') {
190
- // 无手机号码 => 绑定手机号码
191
- toBindPhone('5').then(res => {
192
- optionsParse && optionsParse.success && optionsParse.success(res)
193
- })
194
- }
195
- })
196
- }
197
- } else {
198
- // 无手机号码 => 绑定手机号码
199
- toBindPhone('6').then(res => {
200
- optionsParse && optionsParse.success && optionsParse.success(res)
201
- })
202
- }
203
- }
204
- },
205
- fail: err => {
206
- console.log('getSession-fail', err)
207
- optionsParse && optionsParse.fail && optionsParse.fail(err)
208
- }
209
- })
210
- }
211
-
212
- // 退出登录(非页面)
213
- exports.toLogOut = (options) => {
214
- // 对参数做兼容性处理
215
- let optionsParse = parseOptions(options)
216
-
217
- // 将弹窗标识设置为不需要弹窗
218
- jingtongVerifyRequest.setUserReadStatus(false).then(() => {
219
- console.log('设置弹窗标识成功')
220
-
221
- jingtongVerifyRequest.logOut().then(() => {
222
- optionsParse && optionsParse.success && optionsParse.success()
223
- }).catch(err => {
224
- console.log('退出登录err', err)
225
- optionsParse && optionsParse.fail && optionsParse.fail(err)
226
- })
227
- }).catch(err => {
228
- console.log('设置弹窗标识失败', err)
229
- })
230
- }
231
-
232
- // 获取弹窗标识
233
- exports.getUserReadStatus = (options) => {
234
- // 对参数做兼容性处理
235
- let optionsParse = parseOptions(options)
236
-
237
- jingtongVerifyRequest.getUserReadStatus().then(res => {
238
- optionsParse && optionsParse.success && optionsParse.success(res)
239
- }).catch(err => {
240
- optionsParse && optionsParse.fail && optionsParse.fail(err)
241
- })
242
- }
243
-
244
- // 设置弹窗标识(入参默认为不需要弹窗)
245
- exports.setUserReadStatus = (options) => {
246
- // 对参数做兼容性处理
247
- let optionsParse = parseOptions(options)
248
-
249
- const status = optionsParse && optionsParse.needRead || false
250
- console.log('业务侧入参的弹窗标识', status)
251
- jingtongVerifyRequest.setUserReadStatus(status).then(() => {
252
- console.log('设置弹窗标识成功')
253
- }).catch(err => {
254
- console.log('设置弹窗标识失败', err)
255
- })
256
- }
257
-
258
- // 拉起人脸识别,返回结果
259
- exports.toFaceVerifyAll = (options) => {
260
- // 对参数做兼容性处理
261
- let optionsParse = parseOptions(options)
262
-
263
- jingtongVerifyRequest.fetchFaceVerify({
264
- params: optionsParse.params,
265
- success: res => {
266
- console.log('=====人脸识别成功=====', res)
267
- optionsParse && optionsParse.success && optionsParse.success(res)
268
- },
269
- fail: err => {
270
- console.log('=====人脸识别失败=====', err)
271
- optionsParse && optionsParse.fail && optionsParse.fail(err)
272
- }
273
- })
274
- }
275
-
276
- // 获取国籍列表
277
- exports.getNationList = () => {
278
- return nation || []
279
- }
280
-
281
- // 语言国际化
282
- exports.setLocalLanguage = (options) => {
283
- // 对参数做兼容性处理
284
- let optionsParse = parseOptions(options)
285
-
286
- Object.assign(optionsParse, {
287
- language: optionsParse.language || 'zh_CN'
288
- })
289
- wx.setStorageSync('tif.currentLanguage', optionsParse.language)
1
+ const jingtongVerifyRequest = require('./weapps-plugin-jingtong-verify/utils/request')
2
+ const { nation } = require("./weapps-plugin-jingtong-verify/utils/country")
3
+ const {
4
+ flow,
5
+ config
6
+ } = require('@wecity/weda-plugin-utils')
7
+
8
+ // 统一插件配置
9
+ exports.init = (options) => {
10
+ console.log('设置配置', options)
11
+ jingtongVerifyRequest.init(options)
12
+ }
13
+
14
+ // 对业务侧入参进行拦截和兼容
15
+ const parseOptions = (options) => {
16
+ const optionsType = Object.prototype.toString.call(options)
17
+ console.log('===处理前options===', options)
18
+ if ((options && optionsType !== '[object Object]') || (optionsType === '[object Null]')) {
19
+ console.error('业务侧入参不合法!!入参的数据类型必须为对象')
20
+ options = {}
21
+ }
22
+ options = Object.assign({}, options)
23
+ console.log('== 处理后options ==', options)
24
+ return options
25
+ }
26
+
27
+ // 获取会话
28
+ exports.getSession = (options) => {
29
+ // 对参数做兼容性处理
30
+ let optionsParse = parseOptions(options)
31
+
32
+ jingtongVerifyRequest.getSession({
33
+ success: res => {
34
+ optionsParse && optionsParse.success && optionsParse.success(res)
35
+ },
36
+ fail: fail => {
37
+ console.log('getSession-fail', fail)
38
+ optionsParse && optionsParse.fail && optionsParse.fail(fail)
39
+ }
40
+ })
41
+ }
42
+
43
+ // 个人信息
44
+ exports.goToUserInfo = () => {
45
+ console.log('跳转到子包 === 个人信息服务')
46
+ return flow.createFlow('/weapps-plugin-jingtong-verify/pages/user-info/user-info')
47
+ }
48
+
49
+ // 设置
50
+ exports.goToSetting = () => {
51
+ console.log('跳转到子包 === 设置服务')
52
+ return flow.createFlow('/weapps-plugin-jingtong-verify/pages/setting/setting')
53
+ }
54
+
55
+ // 身份验证
56
+ const toVerify = () => {
57
+ return flow.createFlow('/weapps-plugin-jingtong-verify/pages/face-verify/face-verify', {
58
+ needUnite: 'true' // 需串联起来
59
+ })
60
+ }
61
+
62
+ // 确认手机号码
63
+ const toConfirmPhone = () => {
64
+ return flow.createFlow('/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone')
65
+ }
66
+
67
+ // 绑定手机号码
68
+ const toBindPhone = (source) => {
69
+ return flow.createFlow('/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone', {
70
+ source
71
+ })
72
+ }
73
+
74
+ // 比较两个时间 time1,time2均为日期类型
75
+ // 判断当前日期与time1日期是否相差小于6月
76
+ const completeDate = (time1, m) => {
77
+ var diffyear = new Date().getFullYear() - time1.getFullYear();
78
+ var diffmonth = diffyear * 12 + new Date().getMonth() - time1.getMonth();
79
+ if (diffmonth < 0) {
80
+ return false;
81
+ }
82
+
83
+ var diffDay = new Date().getDate() - time1.getDate();
84
+ if (diffmonth < m || (diffmonth == m && diffDay <= 0)) {
85
+ if (diffmonth == m && diffDay == 0) {
86
+ var timeA = time1.getHours() * 3600 + 60 * time1.getMinutes() + time1.getSeconds();
87
+ var timeB = new Date().getHours() * 3600 + 60 * new Date().getMinutes() + new Date().getSeconds();
88
+ if (timeB - timeA > 0) {
89
+ return false;
90
+ }
91
+ }
92
+ return true;
93
+ }
94
+ return false;
95
+ }
96
+
97
+ // 串通业务总接口
98
+ exports.getPersonToken = (options) => {
99
+ // 对参数做兼容性处理
100
+ let optionsParse = parseOptions(options)
101
+
102
+ jingtongVerifyRequest.getSession({
103
+ success: res => {
104
+ if (!res.face_time && !res.realname_time) {
105
+ // 未身份验证/身份验证已过期
106
+ toVerify().then(res => {
107
+ optionsParse && optionsParse.success && optionsParse.success(res)
108
+ })
109
+ } else {
110
+ // 身份验证未过期 => 判断有无手机号码
111
+ if (res.has_phone) {
112
+ const { tel_confirm_time } = res
113
+ if (res.phone !== res.caPhone && tel_confirm_time && (!completeDate(new Date(Number(tel_confirm_time + '000')), 6))) {
114
+ // 【phone与caPhone不同】且【tel_confirm_time大于6个月】
115
+ toConfirmPhone().then(res => {
116
+ optionsParse && optionsParse.success && optionsParse.success(res)
117
+ })
118
+ } else {
119
+ // 手机号码未过期
120
+ jingtongVerifyRequest.personToken({
121
+ from: 'sdk'
122
+ }).then(data => {
123
+ optionsParse && optionsParse.success && optionsParse.success({
124
+ token: data
125
+ })
126
+ }).catch(err => {
127
+ console.log(JSON.parse(err))
128
+ if (err && err === '4035') {
129
+ // 无手机号码 => 绑定手机号码
130
+ toBindPhone('5').then(res => {
131
+ optionsParse && optionsParse.success && optionsParse.success(res)
132
+ })
133
+ }
134
+ })
135
+ }
136
+ } else {
137
+ // 无手机号码 => 绑定手机号码
138
+ toBindPhone('6').then(res => {
139
+ optionsParse && optionsParse.success && optionsParse.success(res)
140
+ })
141
+ }
142
+ }
143
+ },
144
+ fail: err => {
145
+ console.log('getSession-fail', err)
146
+ optionsParse && optionsParse.fail && optionsParse.fail(err)
147
+ }
148
+ })
149
+ }
150
+
151
+ // 外国护照认证
152
+ const toPassportVerify = () => {
153
+ return flow.createFlow('/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify', {
154
+ needUnite: 'true' // 需串联起来
155
+ })
156
+ }
157
+
158
+ // 串通业务总接口 -- 外国护照入口
159
+ exports.getPersonTokenPassport = (options) => {
160
+ // 对参数做兼容性处理
161
+ let optionsParse = parseOptions(options)
162
+
163
+ jingtongVerifyRequest.getSession({
164
+ success: res => {
165
+ if (!res.face_time && !res.realname_time) {
166
+ // 未身份验证/身份验证已过期
167
+ toPassportVerify().then(res => {
168
+ optionsParse && optionsParse.success && optionsParse.success(res)
169
+ })
170
+ } else {
171
+ // 身份验证未过期 => 判断有无手机号码
172
+ if (res.has_phone) {
173
+ const { tel_confirm_time } = res
174
+ if (res.phone !== res.caPhone && tel_confirm_time && (!completeDate(new Date(Number(tel_confirm_time + '000')), 6))) {
175
+ // 【phone与caPhone不同】且【tel_confirm_time大于6个月】
176
+ toConfirmPhone().then(res => {
177
+ optionsParse && optionsParse.success && optionsParse.success(res)
178
+ })
179
+ } else {
180
+ // 手机号码未过期
181
+ jingtongVerifyRequest.personToken({
182
+ from: 'sdk'
183
+ }).then(data => {
184
+ optionsParse && optionsParse.success && optionsParse.success({
185
+ token: data
186
+ })
187
+ }).catch(err => {
188
+ console.log(JSON.parse(err))
189
+ if (err && err === '4035') {
190
+ // 无手机号码 => 绑定手机号码
191
+ toBindPhone('5').then(res => {
192
+ optionsParse && optionsParse.success && optionsParse.success(res)
193
+ })
194
+ }
195
+ })
196
+ }
197
+ } else {
198
+ // 无手机号码 => 绑定手机号码
199
+ toBindPhone('6').then(res => {
200
+ optionsParse && optionsParse.success && optionsParse.success(res)
201
+ })
202
+ }
203
+ }
204
+ },
205
+ fail: err => {
206
+ console.log('getSession-fail', err)
207
+ optionsParse && optionsParse.fail && optionsParse.fail(err)
208
+ }
209
+ })
210
+ }
211
+
212
+ // 退出登录(非页面)
213
+ exports.toLogOut = (options) => {
214
+ // 对参数做兼容性处理
215
+ let optionsParse = parseOptions(options)
216
+
217
+ // 将弹窗标识设置为不需要弹窗
218
+ jingtongVerifyRequest.setUserReadStatus(false).then(() => {
219
+ console.log('设置弹窗标识成功')
220
+
221
+ jingtongVerifyRequest.logOut().then(() => {
222
+ optionsParse && optionsParse.success && optionsParse.success()
223
+ }).catch(err => {
224
+ console.log('退出登录err', err)
225
+ optionsParse && optionsParse.fail && optionsParse.fail(err)
226
+ })
227
+ }).catch(err => {
228
+ console.log('设置弹窗标识失败', err)
229
+ })
230
+ }
231
+
232
+ // 获取弹窗标识
233
+ exports.getUserReadStatus = (options) => {
234
+ // 对参数做兼容性处理
235
+ let optionsParse = parseOptions(options)
236
+
237
+ jingtongVerifyRequest.getUserReadStatus().then(res => {
238
+ optionsParse && optionsParse.success && optionsParse.success(res)
239
+ }).catch(err => {
240
+ optionsParse && optionsParse.fail && optionsParse.fail(err)
241
+ })
242
+ }
243
+
244
+ // 设置弹窗标识(入参默认为不需要弹窗)
245
+ exports.setUserReadStatus = (options) => {
246
+ // 对参数做兼容性处理
247
+ let optionsParse = parseOptions(options)
248
+
249
+ const status = optionsParse && optionsParse.needRead || false
250
+ console.log('业务侧入参的弹窗标识', status)
251
+ jingtongVerifyRequest.setUserReadStatus(status).then(() => {
252
+ console.log('设置弹窗标识成功')
253
+ }).catch(err => {
254
+ console.log('设置弹窗标识失败', err)
255
+ })
256
+ }
257
+
258
+ // 拉起人脸识别,返回结果
259
+ exports.toFaceVerifyAll = (options) => {
260
+ // 对参数做兼容性处理
261
+ let optionsParse = parseOptions(options)
262
+
263
+ jingtongVerifyRequest.fetchFaceVerify({
264
+ params: optionsParse.params,
265
+ success: res => {
266
+ console.log('=====人脸识别成功=====', res)
267
+ optionsParse && optionsParse.success && optionsParse.success(res)
268
+ },
269
+ fail: err => {
270
+ console.log('=====人脸识别失败=====', err)
271
+ optionsParse && optionsParse.fail && optionsParse.fail(err)
272
+ }
273
+ })
274
+ }
275
+
276
+ // 获取国籍列表
277
+ exports.getNationList = () => {
278
+ return nation || []
279
+ }
280
+
281
+ // 语言国际化
282
+ exports.setLocalLanguage = (options) => {
283
+ // 对参数做兼容性处理
284
+ let optionsParse = parseOptions(options)
285
+
286
+ Object.assign(optionsParse, {
287
+ language: optionsParse.language || 'zh_CN'
288
+ })
289
+ wx.setStorageSync('tif.currentLanguage', optionsParse.language)
290
290
  }
@@ -1,31 +1,31 @@
1
-
2
- Component({
3
- /**
4
- * 组件的属性列表
5
- */
6
- properties: {
7
- visible: {
8
- type: Boolean,
9
- value: false
10
- }
11
- },
12
-
13
- /**
14
- * 组件的初始数据
15
- */
16
- data: {
17
- content: ''
18
- },
19
-
20
- /**
21
- * 组件的方法列表
22
- */
23
- methods: {
24
- handleOk() {
25
- this.triggerEvent('ok')
26
- },
27
- handleCancel() {
28
- this.triggerEvent('cancel')
29
- }
30
- }
31
- })
1
+
2
+ Component({
3
+ /**
4
+ * 组件的属性列表
5
+ */
6
+ properties: {
7
+ visible: {
8
+ type: Boolean,
9
+ value: false
10
+ }
11
+ },
12
+
13
+ /**
14
+ * 组件的初始数据
15
+ */
16
+ data: {
17
+ content: ''
18
+ },
19
+
20
+ /**
21
+ * 组件的方法列表
22
+ */
23
+ methods: {
24
+ handleOk() {
25
+ this.triggerEvent('ok')
26
+ },
27
+ handleCancel() {
28
+ this.triggerEvent('cancel')
29
+ }
30
+ }
31
+ })
@@ -1,4 +1,4 @@
1
- {
2
- "component": true,
3
- "usingComponents": {}
1
+ {
2
+ "component": true,
3
+ "usingComponents": {}
4
4
  }
@@ -1,10 +1,10 @@
1
- <view wx:if="{{ visible }}" class="modal-view">
2
- <view class="modal-box">
3
- <view class="content">
4
- <view class="title">温馨提示</view>
5
- <view class="desc">当前认证方式维护中,您可使用【银行卡认证方式】继续登录,感谢您的理解。</view>
6
- <view class="btn btn-know" catch:tap="handleOk">使用银行卡认证方式登录</view>
7
- <view class="btn btn-cancel" catch:tap="handleCancel">取消</view>
8
- </view>
9
- </view>
1
+ <view wx:if="{{ visible }}" class="modal-view">
2
+ <view class="modal-box">
3
+ <view class="content">
4
+ <view class="title">温馨提示</view>
5
+ <view class="desc">当前认证方式维护中,您可使用【银行卡认证方式】继续登录,感谢您的理解。</view>
6
+ <view class="btn btn-know" catch:tap="handleOk">使用银行卡认证方式登录</view>
7
+ <view class="btn btn-cancel" catch:tap="handleCancel">取消</view>
8
+ </view>
9
+ </view>
10
10
  </view>