react_hsbc_teller 2.0.9 → 2.0.11

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.9",
3
+ "version": "2.0.11",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -53,7 +53,7 @@ import Step from '../components/step/step.jsx'
53
53
  import axios from 'axios';
54
54
  import CryptoJS from "crypto-js";
55
55
 
56
- const SDK_VERISON = '2.0.9'
56
+ const SDK_VERISON = '2.0.11'
57
57
  const IDtypeFront = '请客户在其设备后置摄像头下展示证件正面(如:身份证照片页面)'
58
58
  const IDtypeBack = '请在后置摄像头下展示证件反面(如:身份证国徽页)'
59
59
  const { Option } = Select;
@@ -81,8 +81,9 @@ let streamShare
81
81
  let streamRecord
82
82
  let videoName
83
83
  let muteJson = new Map()
84
- let dateTime = 0
84
+ // let dateTime = 0
85
85
  let messageValue = ''
86
+ let messageValueMap = new Map()
86
87
  // let beautyType = false
87
88
  // let beautyNum = 0 // 0-关闭 1--弱 2--中 5---高
88
89
  let rateList = []
@@ -655,13 +656,13 @@ class Video extends Component {
655
656
  width: 213,
656
657
  height: 175
657
658
  },
658
- {
659
- tag: 'sharedScreen', // 一期暂时不需要录制
660
- xPosition: 960,
661
- yPosition: 180,
662
- width: 320,
663
- height: 180
664
- }
659
+ // {
660
+ // tag: 'sharedScreen', // 一期暂时不需要录制
661
+ // xPosition: 960,
662
+ // yPosition: 180,
663
+ // width: 320,
664
+ // height: 180
665
+ // }
665
666
  ]
666
667
  Array.isArray(res) ?
667
668
  res.map((item) => {
@@ -934,47 +935,38 @@ class Video extends Component {
934
935
  this.messageClick('当前暂无客户', 'error')
935
936
  }
936
937
  }
937
- messageClick = (value, valueOne) => {
938
- console.log(value, valueOne)
939
- if (messageValue != value) {
938
+ messageClick = (value, tipType) => {
939
+ console.log('messageClick', value, tipType)
940
+ const intervalSec = 15 // 相同提示触发间隔
941
+ const durationSec = 10 // 提示持续时间
942
+ if (messageValueMap.get(value) == undefined) {
943
+ // map中没有相同消息
940
944
  messageValue = value
941
- dateTime = new Date().getTime()
942
- if (valueOne == 'error') {
943
- message.error({
944
- content: value,
945
- icon: <img src={require("../../assets/img/tooltips2_fail.png").default} alt="" ></img>,
946
- className: 'errorClassName',
947
- top: 200,
948
- duration: 10
949
- })
950
- } else if (valueOne == 'success') {
951
- message.success({
952
- content: value,
953
- icon: <img src={require("../../assets/img/tooltips1_pass.png").default} alt="" ></img>,
954
- className: 'successClassName',
955
- top: 200,
956
- duration: 10
957
- })
958
- }
959
- } else if (((new Date().getTime()) - dateTime) / 1000 > 30) {
960
- dateTime = new Date().getTime()
961
- if (valueOne == 'error') {
945
+ messageValueMap.set(value, setTimeout(() => {
946
+ messageValueMap.delete(value)
947
+ }, intervalSec * 1000))
948
+
949
+ if (tipType == 'error') {
962
950
  message.error({
963
951
  content: value,
964
952
  icon: <img src={require("../../assets/img/tooltips2_fail.png").default} alt="" ></img>,
965
953
  className: 'errorClassName',
966
954
  top: 200,
967
- duration: 10
955
+ duration: durationSec
968
956
  })
969
- } else if (valueOne == 'success') {
957
+ } else if (tipType == 'success') {
970
958
  message.success({
971
959
  content: value,
972
960
  icon: <img src={require("../../assets/img/tooltips1_pass.png").default} alt="" ></img>,
973
961
  className: 'successClassName',
974
962
  top: 200,
975
- duration: 10
963
+ duration: durationSec
976
964
  })
977
965
  }
966
+ clearTimeout(this.messageClearTimer)
967
+ this.messageClearTimer = setTimeout(() => {
968
+ messageValue = ''
969
+ }, durationSec * 1000);
978
970
  }
979
971
 
980
972
  }
@@ -1188,11 +1180,14 @@ class Video extends Component {
1188
1180
  worker = new Worker(url);
1189
1181
  window.URL.revokeObjectURL(blob);
1190
1182
 
1191
-
1192
1183
  worker.onmessage = () => {
1193
- cobj.clearRect(0, 0, 640, 360 * this.state.listVideoPicture.length);
1184
+ const messageBoxHeight = 50;
1185
+ const recordBoxHeight = 50; // this.state.businessRecordId ? 50 : 0;
1186
+ const baseStartHeight = messageBoxHeight + recordBoxHeight
1187
+
1188
+ cobj.clearRect(0, 0, 640, 360 * this.state.listVideoPicture.length + baseStartHeight);
1194
1189
  canvas.width = 640;
1195
- canvas.height = 360 * this.state.listVideoPicture.length;
1190
+ canvas.height = 360 * this.state.listVideoPicture.length + baseStartHeight;
1196
1191
  for (let i = 0; i < this.state.listVideoPicture.length; i++) {
1197
1192
 
1198
1193
  let videoId = this.state.listVideoPicture[i].name;
@@ -1208,15 +1203,15 @@ class Video extends Component {
1208
1203
  }
1209
1204
  if (this.state.listVideoPicture[i].noVideo) {
1210
1205
  cobj.fillStyle = '#333';
1211
- cobj.fillRect((640 - newVideoWidth) / 2, 360 * i, newVideoWidth, newVideoHeight)
1206
+ cobj.fillRect((640 - newVideoWidth) / 2, 360 * i + baseStartHeight, newVideoWidth, newVideoHeight)
1212
1207
  } else {
1213
- cobj.drawImage(videoDiv, (640 - newVideoWidth) / 2, 360 * i, 640, 360);
1208
+ cobj.drawImage(videoDiv, (640 - newVideoWidth) / 2, 360 * i + baseStartHeight, 640, 360);
1214
1209
 
1215
1210
  }
1216
1211
  cobj.beginPath();
1217
1212
  cobj.strokeStyle = this.props.titleColor;
1218
1213
  cobj.fillStyle = this.props.titleBackground;
1219
- cobj.fillRect(0, 360 * (i + 1) - 60, 300, 60)
1214
+ cobj.fillRect(0, 360 * (i + 1) - 60 + baseStartHeight, 300, 60)
1220
1215
  cobj.fill();
1221
1216
  cobj.stroke();
1222
1217
  cobj.beginPath();
@@ -1234,12 +1229,12 @@ class Video extends Component {
1234
1229
  break;
1235
1230
  }
1236
1231
  }
1237
- cobj.strokeText(str, 70, 360 * (i + 1) - 20);
1232
+ cobj.strokeText(str, 70, 360 * (i + 1) - 20 + baseStartHeight);
1238
1233
  cobj.stroke();
1239
1234
  //左边框
1240
1235
  cobj.beginPath();
1241
- cobj.moveTo(0, 0);
1242
- cobj.lineTo(0, 360 * this.state.listVideoPicture.length);
1236
+ cobj.moveTo(0, 0 + baseStartHeight);
1237
+ cobj.lineTo(0, 360 * this.state.listVideoPicture.length + baseStartHeight);
1243
1238
  cobj.closePath(); //闭合路径
1244
1239
  cobj.lineWidth = 5; //线的边框为10像素
1245
1240
  cobj.strokeStyle = '#d9363e';
@@ -1247,8 +1242,8 @@ class Video extends Component {
1247
1242
 
1248
1243
  //下边框
1249
1244
  cobj.beginPath();
1250
- cobj.moveTo(0, 0);
1251
- cobj.lineTo(640, 0);
1245
+ cobj.moveTo(0, 0 + baseStartHeight);
1246
+ cobj.lineTo(640, 0 + baseStartHeight);
1252
1247
  cobj.closePath(); //闭合路径
1253
1248
  cobj.lineWidth = 5; //线的边框为10像素
1254
1249
  cobj.strokeStyle = '#d9363e';
@@ -1256,8 +1251,8 @@ class Video extends Component {
1256
1251
 
1257
1252
  //右边框
1258
1253
  cobj.beginPath();
1259
- cobj.moveTo(640, 360 * this.state.listVideoPicture.length);
1260
- cobj.lineTo(640, 0);
1254
+ cobj.moveTo(640, 360 * this.state.listVideoPicture.length + baseStartHeight);
1255
+ cobj.lineTo(640, 0 + baseStartHeight);
1261
1256
  cobj.closePath(); //闭合路径
1262
1257
  cobj.lineWidth = 5; //线的边框为10像素
1263
1258
  cobj.strokeStyle = '#d9363e';
@@ -1266,8 +1261,8 @@ class Video extends Component {
1266
1261
 
1267
1262
  //上边框
1268
1263
  cobj.beginPath();
1269
- cobj.moveTo(0, 360 * this.state.listVideoPicture.length);
1270
- cobj.lineTo(640, 360 * this.state.listVideoPicture.length);
1264
+ cobj.moveTo(0, 360 * this.state.listVideoPicture.length + baseStartHeight);
1265
+ cobj.lineTo(640, 360 * this.state.listVideoPicture.length + baseStartHeight);
1271
1266
  cobj.closePath(); //闭合路径
1272
1267
  cobj.lineWidth = 5; //线的边框为10像素
1273
1268
  cobj.strokeStyle = '#d9363e';
@@ -1278,9 +1273,9 @@ class Video extends Component {
1278
1273
  var img = document.getElementById("icon_huatong");
1279
1274
  var img1 = document.getElementById("icon_huatong_close");
1280
1275
  if (this.state.listVideoPicture[i].mute) {
1281
- cobj.drawImage(img1, 10, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
1276
+ cobj.drawImage(img1, 10, 360 * (i + 1) - 60 + baseStartHeight, microphoneSize, microphoneSize);
1282
1277
  } else {
1283
- cobj.drawImage(img, 10, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
1278
+ cobj.drawImage(img, 10, 360 * (i + 1) - 60 + baseStartHeight, microphoneSize, microphoneSize);
1284
1279
 
1285
1280
  // 绘制实时音量
1286
1281
  let sid = document.getElementById(this.state.listVideoPicture[i].name).name
@@ -1297,9 +1292,9 @@ class Video extends Component {
1297
1292
  // 以画布左上角为坐标原点
1298
1293
  let drawArea = {
1299
1294
  x1: 28 / 50 * microphoneSize + 10, // 波动范围右下角的点坐标
1300
- y1: 25 / 50 * microphoneSize + 360 * (i + 1) - 60,
1295
+ y1: 25 / 50 * microphoneSize + 360 * (i + 1) - 60 + baseStartHeight,
1301
1296
  x2: 22 / 50 * microphoneSize + 10, // 波动范围左上角的点坐标
1302
- y2: 10 / 50 * microphoneSize + 360 * (i + 1) - 60,
1297
+ y2: 10 / 50 * microphoneSize + 360 * (i + 1) - 60 + baseStartHeight,
1303
1298
  }
1304
1299
 
1305
1300
 
@@ -1329,26 +1324,51 @@ class Video extends Component {
1329
1324
  }
1330
1325
 
1331
1326
  }
1332
-
1333
- // 敏感词提示
1334
- let str = this.state.sensitiveTitle || ''
1335
- if (str)
1336
- cobj.fillStyle = 'red';
1337
- cobj.font = "normal lighter 32px sans-serif";
1338
- const textWidth = Math.min(cobj.measureText(str).width, 610)
1339
- cobj.fillRect(320 - textWidth/ 2, 24, textWidth, 32)
1327
+ // 录制中状态
1328
+ if (this.state.businessRecordId) {
1329
+ let str = 录制中'
1330
+ cobj.fillStyle = '#F8F2F3';
1331
+ cobj.font = "normal lighter 30px sans-serif";
1332
+ // cobj.fillRect(0, 0, 640, recordBoxHeight)
1340
1333
  cobj.textAlign = 'center';
1341
- cobj.strokeStyle = 'white';
1334
+ cobj.strokeStyle = 'red';
1342
1335
  cobj.lineWidth = 2
1343
- for (let k = 0; k < str.length; k++) {
1344
- if (cobj.measureText(str.substring(0, k + 1)).width > 610) {
1345
- str = str.substring(0, k - 2)
1346
- str += '...'
1347
- break;
1348
- }
1349
- }
1350
- cobj.strokeText(str, 320, 50);
1336
+ cobj.strokeText(str, 320, recordBoxHeight - 15);
1351
1337
  cobj.stroke();
1338
+ }
1339
+ // 消息提示
1340
+ if (messageValue) {
1341
+ let str = messageValue
1342
+ cobj.fillStyle = '#F8F2F3';
1343
+ cobj.font = "normal lighter 30px sans-serif";
1344
+ // const textWidth = Math.min(cobj.measureText(str).width, 610)
1345
+ cobj.fillRect(0, recordBoxHeight, 640, messageBoxHeight)
1346
+ cobj.textAlign = 'center';
1347
+ cobj.strokeStyle = 'black';
1348
+ cobj.lineWidth = 2
1349
+ cobj.strokeText(str, 320, recordBoxHeight + messageBoxHeight - 15);
1350
+ cobj.stroke();
1351
+ }
1352
+
1353
+ // 敏感词提示
1354
+ // let str = this.state.sensitiveTitle || ''
1355
+ // if (str)
1356
+ // cobj.fillStyle = 'red';
1357
+ // cobj.font = "normal lighter 32px sans-serif";
1358
+ // const textWidth = Math.min(cobj.measureText(str).width, 610)
1359
+ // cobj.fillRect(320 - textWidth/ 2, 24, textWidth, 32)
1360
+ // cobj.textAlign = 'center';
1361
+ // cobj.strokeStyle = 'white';
1362
+ // cobj.lineWidth = 2
1363
+ // for (let k = 0; k < str.length; k++) {
1364
+ // if (cobj.measureText(str.substring(0, k + 1)).width > 610) {
1365
+ // str = str.substring(0, k - 2)
1366
+ // str += '...'
1367
+ // break;
1368
+ // }
1369
+ // }
1370
+ // cobj.strokeText(str, 320, 50);
1371
+ // cobj.stroke();
1352
1372
  };
1353
1373
 
1354
1374
  const captureStream = canvas.captureStream();
@@ -1365,6 +1385,7 @@ class Video extends Component {
1365
1385
  pictureInPictureVideo.style.display = 'block';
1366
1386
  pictureInPictureVideo.play();
1367
1387
  this.state.isPictureInPicture = true
1388
+ clearTimeout(this.loopPlay)
1368
1389
  });
1369
1390
 
1370
1391
  pictureInPictureVideo.addEventListener('leavepictureinpicture', (event) => {
@@ -1374,20 +1395,23 @@ class Video extends Component {
1374
1395
  this.state.listVideoPicture = []
1375
1396
  worker.postMessage(false);
1376
1397
  this.state.isPictureInPicture = false
1377
-
1398
+
1399
+ clearTimeout(this.loopPlay)
1378
1400
  // 画中画循环播放逻辑
1379
- this.setState({
1380
- isPictureConfirmModalVisible: true
1381
- })
1382
- const loopPlay = () => {
1383
- console.log('loopPlay status', this.state.isPictureInPicture);
1384
- if(!this.state.isPictureInPicture && document.getElementById("publish_video1")){
1385
- let audio = new Audio(PIPictureClosedAudio)
1386
- audio.play()
1387
- setTimeout(loopPlay, 3000);
1401
+ if (document.hidden) {
1402
+ this.setState({
1403
+ isPictureConfirmModalVisible: true
1404
+ })
1405
+ this.loopPlay = () => {
1406
+ console.log('loopPlay status', this.state.isPictureInPicture);
1407
+ if(!this.state.isPictureInPicture && document.getElementById("publish_video1")){
1408
+ let audio = new Audio(PIPictureClosedAudio)
1409
+ audio.play()
1410
+ setTimeout(this.loopPlay, 3000);
1411
+ }
1388
1412
  }
1413
+ setTimeout(this.loopPlay, 0);
1389
1414
  }
1390
- setTimeout(loopPlay, 0);
1391
1415
  });
1392
1416
 
1393
1417
  }
@@ -3580,6 +3604,10 @@ class Video extends Component {
3580
3604
  // console.log('detectNetworkWeak')
3581
3605
  // this.test_controller.detectNetworkWeak()
3582
3606
  // }
3607
+ // window.document.start = () => {
3608
+ // this.startFaceDetection();
3609
+ // this.startImageDetection();
3610
+ // }
3583
3611
  let arr = []
3584
3612
  for(let i=1;i<=12;i++){
3585
3613
  arr.push({
@@ -5918,6 +5946,14 @@ class Video extends Component {
5918
5946
  </div>
5919
5947
  )
5920
5948
 
5949
+ const isEnvironmentOK = !this.state.loading &&
5950
+ this.state.envInfo.networkResult=='合格' &&
5951
+ this.state.envInfo.batteryResult=='合格' &&
5952
+ this.state.envInfo.memoryResult=='合格' &&
5953
+ this.state.envInfo.cameraResult=='合格' &&
5954
+ this.state.envInfo.microResult=='合格' &&
5955
+ this.state.envInfo.lightResult=='合格'
5956
+
5921
5957
  const sectionStyle = this.state.tabTitles.length > 0 ? {
5922
5958
  zIndex: '-1',
5923
5959
  width: '100%',
@@ -6588,7 +6624,7 @@ class Video extends Component {
6588
6624
  <Modal title="环境检测" maskClosable={false} width={650} closable={false} centered={true} visible={this.state.isModalVisibleEnvironment} footer={[
6589
6625
  <div key='env'>
6590
6626
  {/* <Button className="modelButtonCancel" onClick={this.handleCancelEnvDetection}>取消</Button> */}
6591
- <Button className="modelButtonOk" type="primary" disabled={this.state.loading} danger onClick={this.handleOkEnvDetection}>确定</Button>
6627
+ <Button className={isEnvironmentOK ?"modelButtonOk": "modelButtonNo"} type="primary" disabled={!isEnvironmentOK } danger onClick={this.handleOkEnvDetection}>确定</Button>
6592
6628
  </div>
6593
6629
  ]}>
6594
6630
  <Collapse defaultActiveKey={['1', '2', '3', '4', '5', '6']} ghost>