weapps-plugin-jingtong-verify 1.3.7 → 1.3.8

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "weapps-plugin-jingtong-verify",
3
3
  "pluginName": "weapps-plugin-jingtong-verify",
4
4
  "pluginType": "mp",
5
- "version": "1.3.7",
5
+ "version": "1.3.8",
6
6
  "description": "",
7
7
  "main": "sdk.js",
8
8
  "author": "tongyirenzheng",
@@ -58,6 +58,8 @@ Component({
58
58
  },
59
59
  password: Boolean,
60
60
  clearable: Boolean,
61
+ showEye: Boolean,
62
+ isOpen: Boolean,
61
63
  disabled: Boolean,
62
64
  prepend: Boolean,
63
65
  append: Boolean,
@@ -124,6 +126,7 @@ Component({
124
126
  },
125
127
  // 内部校验 input
126
128
  validateInput() {
129
+ console.log('=========内部校验=======')
127
130
  if (!this.id) {
128
131
  throw new Error('请提供需要校验的组件 ID');
129
132
  }
@@ -168,13 +171,15 @@ Component({
168
171
  },
169
172
  // blur
170
173
  handleBlur(e) {
174
+ console.log('blur', e)
171
175
  const { validateTrigger } = this.properties;
172
- if (validateTrigger === 'blur') {
176
+ const { eye, open } = e.currentTarget.dataset
177
+ if (validateTrigger === 'blur' && ((eye && open) || !eye)) {
173
178
  // 触发内部校验
174
179
  setTimeout(() => {
175
180
  this.validateInput();
176
181
  }, 300)
177
- }
182
+ }
178
183
  this.setData({ _focus: false });
179
184
  this.triggerEvent('blur', e.detail);
180
185
  // 避免输入法最后一个字没点击确认
@@ -202,6 +207,20 @@ Component({
202
207
  this.validateInput();
203
208
  }
204
209
  },
210
+ // 明文
211
+ handleTapEye(e) {
212
+ const { disabled } = this.properties;
213
+ const { _focus } = this.data;
214
+ if (disabled)
215
+ return false;
216
+ // this.triggerEvent('input', { value: '' });
217
+ // this.triggerEvent('change', { value: '' });
218
+ // if (!_focus) {
219
+ // // 触发内部校验
220
+ // this.validateInput();
221
+ // }
222
+ this.triggerEvent('openEye', { isOpen: e.currentTarget.dataset.open });
223
+ },
205
224
  // tap info
206
225
  handleTapIcon() {
207
226
  const { icon } = this.properties;
@@ -21,13 +21,18 @@
21
21
  adjust-position="{{adjustPosition}}"
22
22
  bindinput="handleInput" bindfocus="handleFocus"
23
23
  bindblur="handleBlur" bindconfirm="handleConfirm"
24
+ data-open="{{isOpen}}"
25
+ data-eye="{{showEye}}"
24
26
  />
25
27
 
26
-
27
28
  <view class="{{icon === 'info'?'input__iconInfo__container':'input__icon__container'}}" >
28
29
  <view class="input__icon input__icon--clear" hidden="{{!clearable || !value}}" catch:tap="handleTapClear">
29
30
  <g-icon type="close-circle" size="36"/>
30
31
  </view>
32
+ <view class="input__icon input__icon--clear" hidden="{{!showEye}}" catch:tap="handleTapEye" data-value="{{value}}" data-open="{{isOpen}}">
33
+ <g-icon type="eye" size="36" wx:if="{{isOpen}}" />
34
+ <g-icon type="eye-close" size="36" wx:else />
35
+ </view>
31
36
  <view class="input__icon input__icon--{{icon}}" wx:if="{{icon}}" catch:tap="handleTapIcon">
32
37
  <g-popover wx:if="{{icon === 'info'}}" content="{{iconDesc}}" placement="topRight">
33
38
  <g-icon type="info-o" size="36"/>
@@ -1233,5 +1233,29 @@ Page({
1233
1233
  flow.navigateTo({
1234
1234
  url: `../face-error-reason/face-error-reason?type=${this.data.faceErrorType}`,
1235
1235
  })
1236
+ },
1237
+
1238
+ openEye(e) {
1239
+ console.log(e)
1240
+ const isOpen = e.detail.isOpen
1241
+ const key = e.currentTarget.id
1242
+ const strKey = e.currentTarget.dataset.star
1243
+ console.log('isOpen', isOpen)
1244
+ console.log('key', key)
1245
+ console.log('strKey', strKey)
1246
+ if (isOpen) {
1247
+ console.log('显示脱敏')
1248
+ const { name, id_card_number } = this.data.formData
1249
+ const value = key === 'name' ? utils.hideName(name) : utils.hideIdCard(id_card_number, '111')
1250
+ console.log('value', value)
1251
+ this.setData({
1252
+ [`formData.${strKey}`]: value
1253
+ })
1254
+ } else {
1255
+ console.log('删除脱敏,显示明文')
1256
+ this.setData({
1257
+ [`formData.${strKey}`]: ''
1258
+ })
1259
+ }
1236
1260
  }
1237
1261
  })
@@ -86,10 +86,13 @@
86
86
  label="姓名"
87
87
  placeholder="请输入本人姓名"
88
88
  value="{{ formData.strName || formData.name }}"
89
- clearable="true"
89
+ clearable="{{ false }}"
90
+ showEye="{{ true }}"
91
+ isOpen="{{ !formData.strName }}"
90
92
  bind:change="handleChange"
91
93
  showQuestion="{{ true }}"
92
94
  bind:showQuestionTip="showQuestionTip"
95
+ bind:openEye="openEye"
93
96
  />
94
97
  </view>
95
98
 
@@ -100,10 +103,13 @@
100
103
  label="证件号码"
101
104
  placeholder="请输入本人证件号码"
102
105
  value="{{ formData.strCid || formData.id_card_number }}"
103
- clearable="true"
106
+ clearable="{{ false }}"
107
+ showEye="{{ true }}"
108
+ isOpen="{{ !formData.strCid }}"
104
109
  bind:change="handleChange"
105
110
  showQuestion="{{ true }}"
106
111
  bind:showQuestionTip="showQuestionTip"
112
+ bind:openEye="openEye"
107
113
  />
108
114
  </view>
109
115
  </view>