react_hsbc_teller 2.0.51 → 2.0.53

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react_hsbc_teller",
3
- "version": "2.0.51",
3
+ "version": "2.0.53",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -6,7 +6,7 @@ import QRCode from 'qrcode.react';
6
6
  import API from '../../api/api';
7
7
  import { BoardOperate } from '../../common/index.esm.js';
8
8
  import './video.less'
9
- import { compressImage, isLight } from '../../utils/utils'
9
+ import { compressImage, isLight, saveBase64Image, combineBase64Images } from '../../utils/utils'
10
10
  import Recorder from "js-audio-recorder";
11
11
  import MyAsrController from '../../utils/asrController'
12
12
  import Header from '../header/header.jsx'
@@ -63,7 +63,7 @@ import MultiModule from '../multiModule/multiModule'//签字、抄录
63
63
  import axios from 'axios';
64
64
  import CryptoJS from "crypto-js";
65
65
 
66
- const SDK_VERISON = '2.0.51'
66
+ const SDK_VERISON = '2.0.53'
67
67
  const IDtypeFront = '请客户在其设备后置摄像头下展示证件正面(如:身份证照片页面)'
68
68
  const IDtypeBack = '请在后置摄像头下展示证件反面(如:身份证国徽页)'
69
69
  const { Option } = Select;
@@ -249,8 +249,8 @@ class Video extends Component {
249
249
  linkData: '',
250
250
  roomCustomerList: [],
251
251
  userIdCardResults: {},
252
- facialImg: '',
253
- isFaceImage: false,
252
+ facialImg: '', // 人脸图片
253
+ isFaceImage: false, // 是否拍过照片,用于控制下一步的显示
254
254
  isModalVisibleFacial: false,
255
255
  isModalVisibleEnd: false,
256
256
  isModalVisible: false,
@@ -995,7 +995,7 @@ class Video extends Component {
995
995
  const list = []
996
996
  for (let i =1;i<=12;i++){
997
997
  let item = this.state.videoList[i-1];
998
- if (document.getElementById('video'+ i).name && !item.isPIBIntranet && item.userSide===1) {
998
+ if (document.getElementById('video'+ i).name && !item.isPIBIntranet) {
999
999
  // console.log(this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById("feedId"+i).innerText))
1000
1000
  list.push({
1001
1001
  feedId: this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById("feedId"+i).innerText).feedId,
@@ -1267,7 +1267,8 @@ class Video extends Component {
1267
1267
  name: 'publish_video1',
1268
1268
  title: this.props.meetingInfo.host ? this.props.meetingInfo.host : '客户经理1',
1269
1269
  mute: this.state.voiceStatue,
1270
- noVideo: false
1270
+ noVideo: false,
1271
+ userId: this.props.tellerAccount
1271
1272
  })
1272
1273
  }
1273
1274
  console.log(this.state.videoList)
@@ -1412,7 +1413,7 @@ class Video extends Component {
1412
1413
  let microphoneSize = 50
1413
1414
  var img = document.getElementById("icon_huatong");
1414
1415
  var img1 = document.getElementById("icon_huatong_close");
1415
- if (!this.state.listVideoPicture[i].title.includes(IPAD_SUFFIX)) {
1416
+ if (!this.state.listVideoPicture[i].userId.includes(IPAD_SUFFIX)) {
1416
1417
  if (this.state.listVideoPicture[i].mute) {
1417
1418
  cobj.drawImage(img1, 10, 360 * (i + 1) - 60 + baseStartHeight, microphoneSize, microphoneSize);
1418
1419
  } else {
@@ -4102,6 +4103,7 @@ class Video extends Component {
4102
4103
  isPIBIntranet: false,
4103
4104
  idIndex: i,
4104
4105
  hasOcr: 0,
4106
+ userId: ''
4105
4107
  })
4106
4108
  }
4107
4109
  this.videoErrorEvent = (event) => {
@@ -4834,6 +4836,8 @@ class Video extends Component {
4834
4836
  // })
4835
4837
  } else {
4836
4838
  console.log('身份证ocr')
4839
+ const idCardName = this.state.idCardName
4840
+ const documentType = this.state.documentType
4837
4841
  // 身份证,进行人脸识别后再入库
4838
4842
  this.state.userIdCardResults[this.state.faceCustomerUid] = {
4839
4843
  idCardName: this.state.idCardName,
@@ -4871,6 +4875,14 @@ class Video extends Component {
4871
4875
  setTimeout(() => {
4872
4876
  this.publishVideoTwo()
4873
4877
  }, 0);
4878
+
4879
+ // 保存图片到本地
4880
+ setTimeout(() => {
4881
+ combineBase64Images(this.state.facialImgFront, this.state.facialImgBack, (base64Image)=>{
4882
+ saveBase64Image(base64Image, `${idCardName}-${documentType}`)
4883
+ })
4884
+ }, 100);
4885
+
4874
4886
  }
4875
4887
  }
4876
4888
  // ocr结果入库
@@ -4920,6 +4932,16 @@ class Video extends Component {
4920
4932
  if (this.state.isPictureInPicture) {
4921
4933
  this.pictureInPicture('Refresh')
4922
4934
  }
4935
+ // console.log(this.state.facialImgFront)
4936
+ // console.log(`${data.idCardName}-${this.state.documentType}`)
4937
+ if (this.state.documentType == 'HK_MO_RESIDENCE_CARD' || this.state.documentType == 'TW_RESIDENCE_CARD') {
4938
+ // 居住证正反面需要拼接成一张图
4939
+ combineBase64Images(this.state.facialImgFront, this.state.facialImgBack, (base64Image)=>{
4940
+ saveBase64Image(base64Image, `${data.reviseIdCardName||data.idCardName}-${this.state.documentType}`)
4941
+ })
4942
+ } else {
4943
+ saveBase64Image(this.state.facialImgFront, `${data.reviseIdCardName||data.idCardName}-${this.state.documentType}`)
4944
+ }
4923
4945
  } else {
4924
4946
  console.log('1')
4925
4947
  this.messageClick('保持信息失败', 'error')
@@ -5448,7 +5470,12 @@ class Video extends Component {
5448
5470
 
5449
5471
  compressImage(imgBase64, (compressedImg)=>{
5450
5472
  // console.log(compressedImg)
5451
- if (this.state.IDtypeFrontOrBack == IDtypeFront) {
5473
+ if (this.state.titleModal == '身份验证') {
5474
+ this.setState({
5475
+ facialImg: compressedImg,
5476
+ isFaceImage: true,
5477
+ })
5478
+ } else if (this.state.IDtypeFrontOrBack == IDtypeFront) {
5452
5479
  this.setState({
5453
5480
  facialImg: compressedImg,
5454
5481
  isFaceImage: true,
@@ -7053,7 +7080,7 @@ class Video extends Component {
7053
7080
  <label style={{ display: 'none' }} id={'feedId'+(item.idIndex)} type="text" />
7054
7081
 
7055
7082
  <div onClick={this.muteOpposite.bind(this, 'video'+(item.idIndex))} style={{ display: (item.videoName) ? '' : 'none'}} className={`customerTitle titleSamlle`}>
7056
- { item.videoName.includes(IPAD_SUFFIX) ? <span style={{paddingLeft: '8px'}}> </span>:<>
7083
+ { item.userId.includes(IPAD_SUFFIX) ? <span style={{paddingLeft: '8px'}}> </span>:<>
7057
7084
  {
7058
7085
  item.mute && <img
7059
7086
  alt=""
@@ -115,8 +115,85 @@ function isLight(src, sensitivity = 1) {
115
115
  }
116
116
 
117
117
  }
118
+
119
+ function combineBase64Images(image1, image2, callback) {
120
+ // console.log(image1, image2)
121
+ // 创建Canvas元素
122
+ var canvas = document.createElement('canvas');
123
+ var ctx = canvas.getContext('2d');
124
+
125
+ // 加载第一张图片
126
+ var img1 = new Image();
127
+ img1.onload = function() {
128
+
129
+ // 加载第二张图片
130
+ var img2 = new Image();
131
+ img2.onload = function() {
132
+
133
+ // 设置Canvas的宽度和高度
134
+ const imageWidth = 1280;
135
+ const imageHeight = 720;
136
+ canvas.width = imageWidth ; // 不压缩的话是 1280 x 720
137
+ canvas.height = imageHeight * 2;
138
+
139
+ console.log(img1.width, img1.height)
140
+ console.log(img2.width, img2.height)
141
+
142
+ // 绘制第一张图片
143
+ ctx.drawImage(img1, 0, 0, imageWidth, imageHeight);
144
+ // 绘制第二张图片在第一张图片下方
145
+ ctx.drawImage(img2, 0, imageHeight, imageWidth, imageHeight);
146
+
147
+
148
+ // 导出拼接后的图片为base64
149
+ var combinedImageData = canvas.toDataURL('image/png');
150
+
151
+ // 执行回调函数,返回base64字符串
152
+ callback(combinedImageData);
153
+ console.log(combinedImageData)
154
+
155
+ };
156
+ img2.src = image2;
157
+ };
158
+ img1.src = image1;
159
+
160
+ }
161
+
162
+ function saveBase64Image(base64Data, fileName) {
163
+ // 将base64字符串转换为Blob对象
164
+ let arr = base64Data.split(',');
165
+ let mime = arr[0].match(/:(.*?);/)[1];
166
+ let bstr = atob(arr[1]);
167
+ let n = bstr.length;
168
+ let u8arr = new Uint8Array(n);
169
+
170
+ while (n--) {
171
+ u8arr[n] = bstr.charCodeAt(n);
172
+ }
173
+
174
+ let blob = new Blob([u8arr], { type: mime });
175
+
176
+ // 创建一个指向Blob对象的URL
177
+ let url = URL.createObjectURL(blob);
178
+
179
+ // 创建一个a标签用于下载
180
+ let link = document.createElement('a');
181
+ link.href = url;
182
+ link.download = fileName + '.jpg';
183
+ document.body.appendChild(link);
184
+
185
+ // 触发下载
186
+ link.click();
187
+
188
+ // 清理并移除元素和对象URL
189
+ document.body.removeChild(link);
190
+ URL.revokeObjectURL(url);
191
+ }
192
+
118
193
  export {
119
194
  compressImage,
120
195
  debounce,
121
- isLight
196
+ isLight,
197
+ combineBase64Images,
198
+ saveBase64Image
122
199
  }