react_hsbc_teller 2.0.51 → 2.0.52

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.52",
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.52'
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) => {
@@ -4920,6 +4922,16 @@ class Video extends Component {
4920
4922
  if (this.state.isPictureInPicture) {
4921
4923
  this.pictureInPicture('Refresh')
4922
4924
  }
4925
+ // console.log(this.state.facialImgFront)
4926
+ // console.log(`${data.idCardName}-${this.state.documentType}`)
4927
+ if (this.state.documentType == 'HK_MO_RESIDENCE_CARD' || this.state.documentType == 'TW_RESIDENCE_CARD') {
4928
+ // 居住证正反面需要拼接成一张图
4929
+ combineBase64Images(this.state.facialImgFront, this.state.facialImgBack, (base64Image)=>{
4930
+ saveBase64Image(base64Image, `${data.idCardName}-${this.state.documentType}`)
4931
+ })
4932
+ } else {
4933
+ saveBase64Image(this.state.facialImgFront, `${data.idCardName}-${this.state.documentType}`)
4934
+ }
4923
4935
  } else {
4924
4936
  console.log('1')
4925
4937
  this.messageClick('保持信息失败', 'error')
@@ -5211,6 +5223,11 @@ class Video extends Component {
5211
5223
  if (this.state.isPictureInPicture) {
5212
5224
  this.pictureInPicture('Refresh')
5213
5225
  }
5226
+ // console.log(this.state.facialImgFront)
5227
+ // console.log(`${data.idCardName}-${this.state.documentType}`)
5228
+ combineBase64Images(this.state.facialImgFront, this.state.facialImgBack, (base64Image)=>{
5229
+ saveBase64Image(base64Image, `${data.idCardName}-${this.state.documentType}`)
5230
+ })
5214
5231
  } else {
5215
5232
  console.log('1')
5216
5233
  this.messageClick('保持信息失败', 'error')
@@ -5448,7 +5465,12 @@ class Video extends Component {
5448
5465
 
5449
5466
  compressImage(imgBase64, (compressedImg)=>{
5450
5467
  // console.log(compressedImg)
5451
- if (this.state.IDtypeFrontOrBack == IDtypeFront) {
5468
+ if (this.state.titleModal == '身份验证') {
5469
+ this.setState({
5470
+ facialImg: compressedImg,
5471
+ isFaceImage: true,
5472
+ })
5473
+ } else if (this.state.IDtypeFrontOrBack == IDtypeFront) {
5452
5474
  this.setState({
5453
5475
  facialImg: compressedImg,
5454
5476
  isFaceImage: true,
@@ -7053,7 +7075,7 @@ class Video extends Component {
7053
7075
  <label style={{ display: 'none' }} id={'feedId'+(item.idIndex)} type="text" />
7054
7076
 
7055
7077
  <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>:<>
7078
+ { item.userId.includes(IPAD_SUFFIX) ? <span style={{paddingLeft: '8px'}}> </span>:<>
7057
7079
  {
7058
7080
  item.mute && <img
7059
7081
  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;
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
  }