weapps-plugin-jingtong-verify 1.3.7 → 1.3.9

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.9",
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"/>
@@ -312,6 +312,26 @@ Page({
312
312
  })
313
313
  },
314
314
 
315
+ // 判断是否是PC端登录
316
+ getDevice() {
317
+ return new Promise((resolve, reject) => {
318
+ const systemInfo = wx.getDeviceInfo();
319
+ console.log('systemInfo', systemInfo)
320
+ if (['windows', 'mac'].includes(systemInfo.platform)) {
321
+ console.log('当前为电脑端微信');
322
+ wx.showToast({
323
+ title: '请您使用移动端京通小程序',
324
+ icon: 'none',
325
+ duration: 3000
326
+ })
327
+ return
328
+ } else {
329
+ console.log('当前为手机端');
330
+ resolve()
331
+ }
332
+ })
333
+ },
334
+
315
335
  // 根据证件类型匹配校验正则和校验类型
316
336
  toMatchRules() {
317
337
  let { cid_type, nation, nation_name } = this.data.formData
@@ -598,6 +618,9 @@ Page({
598
618
  if (currentAuthType === 'wxFace') {
599
619
  console.log('微信人脸识别认证')
600
620
 
621
+ // 判断是否是PC端登录
622
+ await this.getDevice()
623
+
601
624
  // 判断人脸失败次数
602
625
  await this.fetchFaceFailCount(false)
603
626
 
@@ -611,6 +634,9 @@ Page({
611
634
  // 错误触发销毁回调函数处理
612
635
  this.handleExitedState()
613
636
 
637
+ // 判断是否是PC端登录
638
+ await this.getDevice()
639
+
614
640
  // 出入境微信人脸识别接口
615
641
  this.toFaceReceptionAuth()
616
642
  } else if(currentAuthType === 'cardAuth') {
@@ -1233,5 +1259,29 @@ Page({
1233
1259
  flow.navigateTo({
1234
1260
  url: `../face-error-reason/face-error-reason?type=${this.data.faceErrorType}`,
1235
1261
  })
1262
+ },
1263
+
1264
+ openEye(e) {
1265
+ console.log(e)
1266
+ const isOpen = e.detail.isOpen
1267
+ const key = e.currentTarget.id
1268
+ const strKey = e.currentTarget.dataset.star
1269
+ console.log('isOpen', isOpen)
1270
+ console.log('key', key)
1271
+ console.log('strKey', strKey)
1272
+ if (isOpen) {
1273
+ console.log('显示脱敏')
1274
+ const { name, id_card_number } = this.data.formData
1275
+ const value = key === 'name' ? utils.hideName(name) : utils.hideIdCard(id_card_number, '111')
1276
+ console.log('value', value)
1277
+ this.setData({
1278
+ [`formData.${strKey}`]: value
1279
+ })
1280
+ } else {
1281
+ console.log('删除脱敏,显示明文')
1282
+ this.setData({
1283
+ [`formData.${strKey}`]: ''
1284
+ })
1285
+ }
1236
1286
  }
1237
1287
  })
@@ -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>