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.
Files changed (184) hide show
  1. package/README.md +1 -2
  2. package/app.json +33 -33
  3. package/package.json +20 -20
  4. package/sdk.js +313 -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 -47
  37. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.json +3 -3
  38. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-badge/index.wxml +13 -13
  39. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.js +44 -44
  40. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.json +5 -5
  41. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-button-group/index.wxml +28 -28
  42. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.js +30 -30
  43. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.json +6 -6
  44. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxml +42 -42
  45. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-cell/index.wxss +1 -1
  46. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.js +418 -418
  47. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.json +5 -5
  48. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-date-picker-en/index.wxml +29 -29
  49. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.js +11 -11
  50. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.json +3 -3
  51. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-dropdown/index.wxml +4 -4
  52. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.js +179 -179
  53. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.json +6 -6
  54. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form/index.wxml +16 -16
  55. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.js +92 -92
  56. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.json +6 -6
  57. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxml +12 -12
  58. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-cell/index.wxss +2 -2
  59. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.js +49 -49
  60. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.json +3 -3
  61. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-form-item/index.wxml +14 -14
  62. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.js +33 -33
  63. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.json +3 -3
  64. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-icon/index.wxml +2 -2
  65. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.js +108 -108
  66. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.json +6 -6
  67. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-index-list/index.wxml +53 -53
  68. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.js +236 -236
  69. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.json +8 -8
  70. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-input/index.wxml +49 -49
  71. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.js +328 -328
  72. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.json +6 -6
  73. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-picker/index.wxml +26 -26
  74. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.js +159 -159
  75. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.json +3 -3
  76. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-popover/index.wxml +10 -10
  77. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.js +112 -112
  78. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.json +5 -5
  79. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-search/index.wxml +21 -21
  80. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.js +21 -21
  81. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.json +7 -7
  82. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-switch/index.wxml +16 -16
  83. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.js +50 -50
  84. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.json +5 -5
  85. package/weapps-plugin-jingtong-verify/components/gsd-ui/g-tips/index.wxml +27 -27
  86. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/add.svg +13 -13
  87. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/arrow.svg +14 -14
  88. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/delete.svg +16 -16
  89. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/preview.svg +21 -21
  90. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/image/user.svg +13 -13
  91. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-agree.wxss +147 -147
  92. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-badge.wxss +41 -41
  93. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-button-group.wxss +244 -244
  94. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-cell.wxss +220 -220
  95. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-dropdown.wxss +115 -115
  96. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-cell.wxss +101 -101
  97. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form-item.wxss +174 -174
  98. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-form.wxss +101 -101
  99. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-icon.wxss +268 -268
  100. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-index-list.wxss +206 -206
  101. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-input.wxss +206 -206
  102. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-picker.wxss +139 -139
  103. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-popover.wxss +129 -129
  104. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-search.wxss +171 -171
  105. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-switch.wxss +176 -176
  106. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/components/g-tips.wxss +173 -173
  107. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/icon/iconfont.wxss +160 -160
  108. package/weapps-plugin-jingtong-verify/components/gsd-ui/static/style/main.wxss +283 -283
  109. package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/helper.js +55 -55
  110. package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validType.js +117 -117
  111. package/weapps-plugin-jingtong-verify/components/gsd-ui/utils/validator.js +106 -106
  112. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.js +32 -32
  113. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.json +3 -3
  114. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxml +8 -8
  115. package/weapps-plugin-jingtong-verify/components/lock-face-modal/lock-face-modal.wxss +57 -57
  116. package/weapps-plugin-jingtong-verify/components/modal/modal.js +32 -32
  117. package/weapps-plugin-jingtong-verify/components/modal/modal.json +3 -3
  118. package/weapps-plugin-jingtong-verify/components/modal/modal.wxml +28 -28
  119. package/weapps-plugin-jingtong-verify/components/modal/modal.wxss +84 -84
  120. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.js +82 -82
  121. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.json +3 -3
  122. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxml +18 -18
  123. package/weapps-plugin-jingtong-verify/components/my-modal/my-modal.wxss +72 -72
  124. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.js +39 -39
  125. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.json +3 -3
  126. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxml +9 -9
  127. package/weapps-plugin-jingtong-verify/components/tip-modal/tip-modal.wxss +51 -51
  128. package/weapps-plugin-jingtong-verify/i18n/index.js +7 -7
  129. package/weapps-plugin-jingtong-verify/i18n/logout.js +10 -10
  130. package/weapps-plugin-jingtong-verify/i18n/rules.js +262 -262
  131. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.js +86 -86
  132. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.json +6 -6
  133. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxml +20 -20
  134. package/weapps-plugin-jingtong-verify/pages/bind-phone/bind-phone.wxss +51 -51
  135. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.js +167 -167
  136. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.json +3 -3
  137. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxml +30 -30
  138. package/weapps-plugin-jingtong-verify/pages/confirm-phone/confirm-phone.wxss +91 -91
  139. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.js +79 -79
  140. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.json +5 -5
  141. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxml +19 -19
  142. package/weapps-plugin-jingtong-verify/pages/face-error-reason/face-error-reason.wxss +44 -44
  143. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.js +1557 -1547
  144. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.json +17 -17
  145. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxml +504 -504
  146. package/weapps-plugin-jingtong-verify/pages/face-verify/face-verify.wxss +133 -133
  147. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.js +127 -127
  148. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.json +5 -5
  149. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxml +36 -36
  150. package/weapps-plugin-jingtong-verify/pages/log-off/log-off.wxss +60 -60
  151. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.js +106 -106
  152. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.json +3 -3
  153. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxml +29 -29
  154. package/weapps-plugin-jingtong-verify/pages/login-manage/login-manage.wxss +68 -68
  155. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.js +24 -24
  156. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.json +3 -3
  157. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxml +12 -12
  158. package/weapps-plugin-jingtong-verify/pages/logoff-success/logoff-success.wxss +33 -33
  159. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.js +120 -120
  160. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.json +6 -6
  161. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxml +9 -9
  162. package/weapps-plugin-jingtong-verify/pages/nation-list/nation-list.wxss +1 -1
  163. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.js +865 -854
  164. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.json +11 -11
  165. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxml +162 -162
  166. package/weapps-plugin-jingtong-verify/pages/passport-verify/passport-verify.wxss +64 -64
  167. package/weapps-plugin-jingtong-verify/pages/setting/setting.js +328 -328
  168. package/weapps-plugin-jingtong-verify/pages/setting/setting.json +5 -5
  169. package/weapps-plugin-jingtong-verify/pages/setting/setting.wxml +91 -91
  170. package/weapps-plugin-jingtong-verify/pages/setting/setting.wxss +69 -69
  171. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.js +306 -306
  172. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.json +7 -7
  173. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxml +142 -142
  174. package/weapps-plugin-jingtong-verify/pages/user-info/user-info.wxss +110 -110
  175. package/weapps-plugin-jingtong-verify/style/page.wxss +13 -13
  176. package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTracker.js +15 -15
  177. package/weapps-plugin-jingtong-verify/utils/QDTrackerNew/QDTrackerMain.js +59 -59
  178. package/weapps-plugin-jingtong-verify/utils/country.js +209 -209
  179. package/weapps-plugin-jingtong-verify/utils/index.js +306 -306
  180. package/weapps-plugin-jingtong-verify/utils/jsencrypt.min.js +1 -1
  181. package/weapps-plugin-jingtong-verify/utils/request.js +1 -1
  182. package/weapps-plugin-jingtong-verify/utils/rules.js +301 -301
  183. package/weapps-plugin-jingtong-verify/utils/tifadmin_config.js +61 -61
  184. package/weapps-plugin-jingtong-verify/utils/validate.js +772 -772
@@ -1,6 +1,6 @@
1
- {
2
- "component": true,
3
- "usingComponents": {
4
- "g-form-item": "../g-form-item/index"
5
- }
1
+ {
2
+ "component": true,
3
+ "usingComponents": {
4
+ "g-form-item": "../g-form-item/index"
5
+ }
6
6
  }
@@ -1,30 +1,30 @@
1
- <g-form-item label="{{label}}" disabled="{{disabled}}" status="{{_status}}" statusMessage="{{_statusMessage}}" required="{{ _required }}">
2
- <view class="picker" bind:tap="open">
3
- <view class="picker__value {{_isEmpty ? 'picker__value--placeholder': ''}} {{disabled ? 'picker__value--disabled' : ''}}">{{_displayName}}</view>
4
- <view class="picker__action">{{actionText}}</view>
5
- </view>
6
- </g-form-item>
7
-
8
- <view class="date-picker-mask" hidden="{{!pickerDateshow}}" bindtap="close"></view>
9
- <view class="date-picker-box {{pickerDateshow?'date-picker-show':''}}">
10
- <view class="date-picker-view-title">
11
- <view class="date-picker-view-title-item">Year</view>
12
- <view class="date-picker-view-title-item">Month</view>
13
- <view class="date-picker-view-title-item">Day</view>
14
- </view>
15
- <picker-view class="date-picker-view" indicator-class="date-picker-indicator" value="{{pickerValue}}" bindchange="bindChange">
16
- <picker-view-column>
17
- <view wx:for="{{years}}" wx:key="index">{{item}}</view>
18
- </picker-view-column>
19
- <picker-view-column>
20
- <view wx:for="{{months}}" wx:key="index">{{item}}</view>
21
- </picker-view-column>
22
- <picker-view-column>
23
- <view wx:for="{{days}}" wx:key="index">{{item}}</view>
24
- </picker-view-column>
25
- </picker-view>
26
- <view class="picker-header">
27
- <button bindtap="close">{{cancelText}}</button>
28
- <button bindtap="handleSelect" class="primary-btn">{{okText}}</button>
29
- </view>
1
+ <g-form-item label="{{label}}" disabled="{{disabled}}" status="{{_status}}" statusMessage="{{_statusMessage}}" required="{{ _required }}">
2
+ <view class="picker" bind:tap="open">
3
+ <view class="picker__value {{_isEmpty ? 'picker__value--placeholder': ''}} {{disabled ? 'picker__value--disabled' : ''}}">{{_displayName}}</view>
4
+ <view class="picker__action">{{actionText}}</view>
5
+ </view>
6
+ </g-form-item>
7
+
8
+ <view class="date-picker-mask" hidden="{{!pickerDateshow}}" bindtap="close"></view>
9
+ <view class="date-picker-box {{pickerDateshow?'date-picker-show':''}}">
10
+ <view class="date-picker-view-title">
11
+ <view class="date-picker-view-title-item">Year</view>
12
+ <view class="date-picker-view-title-item">Month</view>
13
+ <view class="date-picker-view-title-item">Day</view>
14
+ </view>
15
+ <picker-view class="date-picker-view" indicator-class="date-picker-indicator" value="{{pickerValue}}" bindchange="bindChange">
16
+ <picker-view-column>
17
+ <view wx:for="{{years}}" wx:key="index">{{item}}</view>
18
+ </picker-view-column>
19
+ <picker-view-column>
20
+ <view wx:for="{{months}}" wx:key="index">{{item}}</view>
21
+ </picker-view-column>
22
+ <picker-view-column>
23
+ <view wx:for="{{days}}" wx:key="index">{{item}}</view>
24
+ </picker-view-column>
25
+ </picker-view>
26
+ <view class="picker-header">
27
+ <button bindtap="close">{{cancelText}}</button>
28
+ <button bindtap="handleSelect" class="primary-btn">{{okText}}</button>
29
+ </view>
30
30
  </view>
@@ -1,11 +1,11 @@
1
- // pages/g-dropdown/index.js
2
- Component({
3
- properties: {
4
- color: {
5
- type: String,
6
- value: '#000'
7
- }
8
- },
9
- data: {},
10
- methods: {}
11
- });
1
+ // pages/g-dropdown/index.js
2
+ Component({
3
+ properties: {
4
+ color: {
5
+ type: String,
6
+ value: '#000'
7
+ }
8
+ },
9
+ data: {},
10
+ methods: {}
11
+ });
@@ -1,4 +1,4 @@
1
- {
2
- "component": true,
3
- "usingComponents": {}
1
+ {
2
+ "component": true,
3
+ "usingComponents": {}
4
4
  }
@@ -1,5 +1,5 @@
1
- <!--pages/g-dropdown/index.wxml-->
2
- <view class="dropdown">
3
- <view><slot /></view>
4
- <view class="dropdown__icon" style="border-top-color: {{color}}"></view>
1
+ <!--pages/g-dropdown/index.wxml-->
2
+ <view class="dropdown">
3
+ <view><slot /></view>
4
+ <view class="dropdown__icon" style="border-top-color: {{color}}"></view>
5
5
  </view>
@@ -1,179 +1,179 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // pages/g-form/index.js
4
- const FormControllerBehavior = require("../behaviors/formController");
5
- const primarySecondButtonBehaviors = require("../behaviors/primarySecondButton");
6
- const validator = require("../utils/validator");
7
- const _ = require('../utils/helper');
8
- const Event = require('../../gsd-lib/event/index');
9
- Component({
10
- __loading__: false,
11
- options: {
12
- multipleSlots: true
13
- },
14
- behaviors: [primarySecondButtonBehaviors],
15
- relations: {
16
- 'form-fields': {
17
- type: 'descendant',
18
- target: FormControllerBehavior
19
- }
20
- },
21
- properties: {
22
- model: {
23
- type: Object,
24
- value: {}
25
- },
26
- rules: {
27
- type: Object,
28
- value: {},
29
- observer(newValue) {
30
- if (newValue) {
31
- this.resetFormFiels();
32
- }
33
- }
34
- },
35
- showTips: {
36
- type: Boolean,
37
- value: true
38
- },
39
- showAgree: Boolean,
40
- autoAgree: Boolean,
41
- disabled: Boolean,
42
- buttonDirection: {
43
- type: String,
44
- value: 'horizontal'
45
- },
46
- validateType: {
47
- type: Object,
48
- value: {}
49
- },
50
- submitEvent: String
51
- },
52
- data: {
53
- _isAgree: false,
54
- _tipsShow: false,
55
- _tipsMessage: '表单提交失败'
56
- },
57
- ready() {
58
- const { submitEvent } = this.properties;
59
- if (submitEvent) {
60
- Event.addEventListener(submitEvent, () => this.handleSubmit());
61
- }
62
- },
63
- detached() {
64
- const { submitEvent } = this.properties;
65
- if (submitEvent) {
66
- Event.removeEventListener(submitEvent);
67
- }
68
- },
69
- methods: {
70
- getFormField(id) {
71
- const formFields = this.getFormFields();
72
- if (formFields && formFields.length > 0) {
73
- return formFields.find(node => {
74
- return _.standardPath(node.id) === _.standardPath(id);
75
- });
76
- }
77
- },
78
- getFormFields() {
79
- return this.getRelationNodes('form-fields');
80
- },
81
- // 重置表单内的状态
82
- resetFormFiels() {
83
- (this.getFormFields() || []).forEach(node => {
84
- // 重置状态
85
- node.setData({
86
- _status: '',
87
- _statusMessage: ''
88
- });
89
- });
90
- },
91
- noticeFormFiels(errorConfig) {
92
- const formFields = this.getFormFields();
93
- this.showTopTips(errorConfig[0]);
94
- // 通知具体各个组件的状态
95
- if (formFields.length > 0) {
96
- formFields.forEach(node => {
97
- // 获取到当前控件匹配到的错误规则
98
- errorConfig.forEach(config => {
99
- if (_.standardPath(node.id) === _.standardPath(config.name)) {
100
- // 通知组件修改状态
101
- if (node.warn)
102
- node.warn(config);
103
- }
104
- });
105
- });
106
- }
107
- },
108
- // 显示顶部提示条
109
- showTopTips(errorConfig) {
110
- console.log('顶部通知框: ', errorConfig);
111
- if (errorConfig) {
112
- this.setData({
113
- _tipsShow: true,
114
- _tipsMessage: errorConfig.message || '表单输入有误'
115
- }, () => {
116
- // 3秒后关闭
117
- setTimeout(() => {
118
- this.setData({
119
- _tipsShow: false,
120
- _tipsMessage: ''
121
- });
122
- }, 3000);
123
- });
124
- }
125
- },
126
- // 关闭提示条
127
- handleTipsClose(e) {
128
- this.setData({
129
- _tipsShow: e.detail.isShow
130
- });
131
- },
132
- handleSubmit(e) {
133
- const { model, rules, validateType } = this.properties;
134
- // 正在提交时,就不继续执行
135
- if (this.__loading__)
136
- return false;
137
- console.log('g-form 提交表单:', model, rules);
138
- this.__loading__ = true;
139
- validator(model, rules || {}, validateType || {})
140
- .then((errorArr) => {
141
- this.__loading__ = false;
142
- if (errorArr.length === 0) {
143
- // 校验成功,并把数据推回给业务组件做业务处理
144
- // 推送事件
145
- this.triggerEvent('submit', {
146
- validStatus: true,
147
- value: model,
148
- formId: (e && e.detail && e.detail.formId) || 'no-formID'
149
- });
150
- }
151
- else {
152
- // 去掉相同表单的错误信息,只保留其中一个
153
- errorArr = Array.from(new Set(errorArr.map(errorField => errorField.name)))
154
- .map(fieldName => {
155
- let targetItem;
156
- errorArr.some(item => {
157
- if (item.name === fieldName) {
158
- targetItem = item;
159
- return true;
160
- }
161
- });
162
- return targetItem;
163
- });
164
- // 校验失败,组件内部提供错误提示和状态,并把错误信息推回给业务组件处理
165
- this.noticeFormFiels(errorArr);
166
- // 推送事件
167
- this.triggerEvent('submit', {
168
- validStatus: false,
169
- value: errorArr
170
- });
171
- }
172
- })
173
- .catch(e => {
174
- console.log('g-form error:', e);
175
- this.__loading__ = false;
176
- });
177
- }
178
- }
179
- });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // pages/g-form/index.js
4
+ const FormControllerBehavior = require("../behaviors/formController");
5
+ const primarySecondButtonBehaviors = require("../behaviors/primarySecondButton");
6
+ const validator = require("../utils/validator");
7
+ const _ = require('../utils/helper');
8
+ const Event = require('../../gsd-lib/event/index');
9
+ Component({
10
+ __loading__: false,
11
+ options: {
12
+ multipleSlots: true
13
+ },
14
+ behaviors: [primarySecondButtonBehaviors],
15
+ relations: {
16
+ 'form-fields': {
17
+ type: 'descendant',
18
+ target: FormControllerBehavior
19
+ }
20
+ },
21
+ properties: {
22
+ model: {
23
+ type: Object,
24
+ value: {}
25
+ },
26
+ rules: {
27
+ type: Object,
28
+ value: {},
29
+ observer(newValue) {
30
+ if (newValue) {
31
+ this.resetFormFiels();
32
+ }
33
+ }
34
+ },
35
+ showTips: {
36
+ type: Boolean,
37
+ value: true
38
+ },
39
+ showAgree: Boolean,
40
+ autoAgree: Boolean,
41
+ disabled: Boolean,
42
+ buttonDirection: {
43
+ type: String,
44
+ value: 'horizontal'
45
+ },
46
+ validateType: {
47
+ type: Object,
48
+ value: {}
49
+ },
50
+ submitEvent: String
51
+ },
52
+ data: {
53
+ _isAgree: false,
54
+ _tipsShow: false,
55
+ _tipsMessage: '表单提交失败'
56
+ },
57
+ ready() {
58
+ const { submitEvent } = this.properties;
59
+ if (submitEvent) {
60
+ Event.addEventListener(submitEvent, () => this.handleSubmit());
61
+ }
62
+ },
63
+ detached() {
64
+ const { submitEvent } = this.properties;
65
+ if (submitEvent) {
66
+ Event.removeEventListener(submitEvent);
67
+ }
68
+ },
69
+ methods: {
70
+ getFormField(id) {
71
+ const formFields = this.getFormFields();
72
+ if (formFields && formFields.length > 0) {
73
+ return formFields.find(node => {
74
+ return _.standardPath(node.id) === _.standardPath(id);
75
+ });
76
+ }
77
+ },
78
+ getFormFields() {
79
+ return this.getRelationNodes('form-fields');
80
+ },
81
+ // 重置表单内的状态
82
+ resetFormFiels() {
83
+ (this.getFormFields() || []).forEach(node => {
84
+ // 重置状态
85
+ node.setData({
86
+ _status: '',
87
+ _statusMessage: ''
88
+ });
89
+ });
90
+ },
91
+ noticeFormFiels(errorConfig) {
92
+ const formFields = this.getFormFields();
93
+ this.showTopTips(errorConfig[0]);
94
+ // 通知具体各个组件的状态
95
+ if (formFields.length > 0) {
96
+ formFields.forEach(node => {
97
+ // 获取到当前控件匹配到的错误规则
98
+ errorConfig.forEach(config => {
99
+ if (_.standardPath(node.id) === _.standardPath(config.name)) {
100
+ // 通知组件修改状态
101
+ if (node.warn)
102
+ node.warn(config);
103
+ }
104
+ });
105
+ });
106
+ }
107
+ },
108
+ // 显示顶部提示条
109
+ showTopTips(errorConfig) {
110
+ console.log('顶部通知框: ', errorConfig);
111
+ if (errorConfig) {
112
+ this.setData({
113
+ _tipsShow: true,
114
+ _tipsMessage: errorConfig.message || '表单输入有误'
115
+ }, () => {
116
+ // 3秒后关闭
117
+ setTimeout(() => {
118
+ this.setData({
119
+ _tipsShow: false,
120
+ _tipsMessage: ''
121
+ });
122
+ }, 3000);
123
+ });
124
+ }
125
+ },
126
+ // 关闭提示条
127
+ handleTipsClose(e) {
128
+ this.setData({
129
+ _tipsShow: e.detail.isShow
130
+ });
131
+ },
132
+ handleSubmit(e) {
133
+ const { model, rules, validateType } = this.properties;
134
+ // 正在提交时,就不继续执行
135
+ if (this.__loading__)
136
+ return false;
137
+ console.log('g-form 提交表单:', model, rules);
138
+ this.__loading__ = true;
139
+ validator(model, rules || {}, validateType || {})
140
+ .then((errorArr) => {
141
+ this.__loading__ = false;
142
+ if (errorArr.length === 0) {
143
+ // 校验成功,并把数据推回给业务组件做业务处理
144
+ // 推送事件
145
+ this.triggerEvent('submit', {
146
+ validStatus: true,
147
+ value: model,
148
+ formId: (e && e.detail && e.detail.formId) || 'no-formID'
149
+ });
150
+ }
151
+ else {
152
+ // 去掉相同表单的错误信息,只保留其中一个
153
+ errorArr = Array.from(new Set(errorArr.map(errorField => errorField.name)))
154
+ .map(fieldName => {
155
+ let targetItem;
156
+ errorArr.some(item => {
157
+ if (item.name === fieldName) {
158
+ targetItem = item;
159
+ return true;
160
+ }
161
+ });
162
+ return targetItem;
163
+ });
164
+ // 校验失败,组件内部提供错误提示和状态,并把错误信息推回给业务组件处理
165
+ this.noticeFormFiels(errorArr);
166
+ // 推送事件
167
+ this.triggerEvent('submit', {
168
+ validStatus: false,
169
+ value: errorArr
170
+ });
171
+ }
172
+ })
173
+ .catch(e => {
174
+ console.log('g-form error:', e);
175
+ this.__loading__ = false;
176
+ });
177
+ }
178
+ }
179
+ });
@@ -1,7 +1,7 @@
1
- {
2
- "component": true,
3
- "usingComponents": {
4
- "g-tips": "../g-tips/index",
5
- "g-button-group": "../g-button-group/index"
6
- }
1
+ {
2
+ "component": true,
3
+ "usingComponents": {
4
+ "g-tips": "../g-tips/index",
5
+ "g-button-group": "../g-button-group/index"
6
+ }
7
7
  }
@@ -1,16 +1,16 @@
1
- <!-- pages/g-form/index.wxml -->
2
- <view>
3
- <g-tips wx:if="{{showTips}}" position="fixed" is-show="{{_tipsShow}}" status="warn" closeable catch:close="handleTipsClose">
4
- {{_tipsMessage}}
5
- </g-tips>
6
- <form class="form">
7
- <!-- slot/slot[content] 共用 -->
8
- <slot></slot>
9
- <slot name="content"></slot>
10
- <g-button-group agree="{{showAgree}}" auto-agree="{{autoAgree}}" disabled="{{disabled}}" direction="{{buttonDirection}}" primary-text="{{primaryText}}" second-text="{{secondText}}" catch:primaryTap="handleSubmit" catch:secondTap="handleSecondTap">
11
- <view wx:if="{{showAgree}}" slot="agree">
12
- <slot name="agree"></slot>
13
- </view>
14
- </g-button-group>
15
- </form>
16
- </view>
1
+ <!-- pages/g-form/index.wxml -->
2
+ <view>
3
+ <g-tips wx:if="{{showTips}}" position="fixed" is-show="{{_tipsShow}}" status="warn" closeable catch:close="handleTipsClose">
4
+ {{_tipsMessage}}
5
+ </g-tips>
6
+ <form class="form">
7
+ <!-- slot/slot[content] 共用 -->
8
+ <slot></slot>
9
+ <slot name="content"></slot>
10
+ <g-button-group agree="{{showAgree}}" auto-agree="{{autoAgree}}" disabled="{{disabled}}" direction="{{buttonDirection}}" primary-text="{{primaryText}}" second-text="{{secondText}}" catch:primaryTap="handleSubmit" catch:secondTap="handleSecondTap">
11
+ <view wx:if="{{showAgree}}" slot="agree">
12
+ <slot name="agree"></slot>
13
+ </view>
14
+ </g-button-group>
15
+ </form>
16
+ </view>