react_hsbc_teller 2.0.10 → 2.0.12

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.10",
3
+ "version": "2.0.12",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -205,6 +205,8 @@ userExit =(val)=>{
205
205
  sessionId={this.state.sessionId}
206
206
  imRoomId={this.state.imRoomId}
207
207
  userSide={this.state.userSide}
208
+ whetherDetectFace={true}
209
+ whetherDetectLight={true}
208
210
  prohibitPrompt={this.state.prohibitPrompt}
209
211
  voiceColor={this.state.voiceColor}
210
212
  titleBackground={this.state.titleBackground}
@@ -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.10'
56
+ const SDK_VERISON = '2.0.12'
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 = []
@@ -348,6 +349,7 @@ class Video extends Component {
348
349
  try {
349
350
  let result = await API.createRoom({
350
351
  staffId: this.props.tellerAccount,
352
+ staffName: this.props.staffName,
351
353
  activityId: this.props.businessNumber,
352
354
  callbackUrl: this.props.callbackUrl,
353
355
  meetingDuration: this.props.meetingDuration,
@@ -934,47 +936,38 @@ class Video extends Component {
934
936
  this.messageClick('当前暂无客户', 'error')
935
937
  }
936
938
  }
937
- messageClick = (value, valueOne) => {
938
- console.log(value, valueOne)
939
- if (messageValue != value) {
939
+ messageClick = (value, tipType) => {
940
+ console.log('messageClick', value, tipType)
941
+ const intervalSec = 15 // 相同提示触发间隔
942
+ const durationSec = 10 // 提示持续时间
943
+ if (messageValueMap.get(value) == undefined) {
944
+ // map中没有相同消息
940
945
  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') {
946
+ messageValueMap.set(value, setTimeout(() => {
947
+ messageValueMap.delete(value)
948
+ }, intervalSec * 1000))
949
+
950
+ if (tipType == 'error') {
962
951
  message.error({
963
952
  content: value,
964
953
  icon: <img src={require("../../assets/img/tooltips2_fail.png").default} alt="" ></img>,
965
954
  className: 'errorClassName',
966
955
  top: 200,
967
- duration: 10
956
+ duration: durationSec
968
957
  })
969
- } else if (valueOne == 'success') {
958
+ } else if (tipType == 'success') {
970
959
  message.success({
971
960
  content: value,
972
961
  icon: <img src={require("../../assets/img/tooltips1_pass.png").default} alt="" ></img>,
973
962
  className: 'successClassName',
974
963
  top: 200,
975
- duration: 10
964
+ duration: durationSec
976
965
  })
977
966
  }
967
+ clearTimeout(this.messageClearTimer)
968
+ this.messageClearTimer = setTimeout(() => {
969
+ messageValue = ''
970
+ }, durationSec * 1000);
978
971
  }
979
972
 
980
973
  }
@@ -1188,11 +1181,14 @@ class Video extends Component {
1188
1181
  worker = new Worker(url);
1189
1182
  window.URL.revokeObjectURL(blob);
1190
1183
 
1191
-
1192
1184
  worker.onmessage = () => {
1193
- cobj.clearRect(0, 0, 640, 360 * this.state.listVideoPicture.length);
1185
+ const messageBoxHeight = 50;
1186
+ const recordBoxHeight = 50; // this.state.businessRecordId ? 50 : 0;
1187
+ const baseStartHeight = messageBoxHeight + recordBoxHeight
1188
+
1189
+ cobj.clearRect(0, 0, 640, 360 * this.state.listVideoPicture.length + baseStartHeight);
1194
1190
  canvas.width = 640;
1195
- canvas.height = 360 * this.state.listVideoPicture.length;
1191
+ canvas.height = 360 * this.state.listVideoPicture.length + baseStartHeight;
1196
1192
  for (let i = 0; i < this.state.listVideoPicture.length; i++) {
1197
1193
 
1198
1194
  let videoId = this.state.listVideoPicture[i].name;
@@ -1208,15 +1204,15 @@ class Video extends Component {
1208
1204
  }
1209
1205
  if (this.state.listVideoPicture[i].noVideo) {
1210
1206
  cobj.fillStyle = '#333';
1211
- cobj.fillRect((640 - newVideoWidth) / 2, 360 * i, newVideoWidth, newVideoHeight)
1207
+ cobj.fillRect((640 - newVideoWidth) / 2, 360 * i + baseStartHeight, newVideoWidth, newVideoHeight)
1212
1208
  } else {
1213
- cobj.drawImage(videoDiv, (640 - newVideoWidth) / 2, 360 * i, 640, 360);
1209
+ cobj.drawImage(videoDiv, (640 - newVideoWidth) / 2, 360 * i + baseStartHeight, 640, 360);
1214
1210
 
1215
1211
  }
1216
1212
  cobj.beginPath();
1217
1213
  cobj.strokeStyle = this.props.titleColor;
1218
1214
  cobj.fillStyle = this.props.titleBackground;
1219
- cobj.fillRect(0, 360 * (i + 1) - 60, 300, 60)
1215
+ cobj.fillRect(0, 360 * (i + 1) - 60 + baseStartHeight, 300, 60)
1220
1216
  cobj.fill();
1221
1217
  cobj.stroke();
1222
1218
  cobj.beginPath();
@@ -1234,12 +1230,12 @@ class Video extends Component {
1234
1230
  break;
1235
1231
  }
1236
1232
  }
1237
- cobj.strokeText(str, 70, 360 * (i + 1) - 20);
1233
+ cobj.strokeText(str, 70, 360 * (i + 1) - 20 + baseStartHeight);
1238
1234
  cobj.stroke();
1239
1235
  //左边框
1240
1236
  cobj.beginPath();
1241
- cobj.moveTo(0, 0);
1242
- cobj.lineTo(0, 360 * this.state.listVideoPicture.length);
1237
+ cobj.moveTo(0, 0 + baseStartHeight);
1238
+ cobj.lineTo(0, 360 * this.state.listVideoPicture.length + baseStartHeight);
1243
1239
  cobj.closePath(); //闭合路径
1244
1240
  cobj.lineWidth = 5; //线的边框为10像素
1245
1241
  cobj.strokeStyle = '#d9363e';
@@ -1247,8 +1243,8 @@ class Video extends Component {
1247
1243
 
1248
1244
  //下边框
1249
1245
  cobj.beginPath();
1250
- cobj.moveTo(0, 0);
1251
- cobj.lineTo(640, 0);
1246
+ cobj.moveTo(0, 0 + baseStartHeight);
1247
+ cobj.lineTo(640, 0 + baseStartHeight);
1252
1248
  cobj.closePath(); //闭合路径
1253
1249
  cobj.lineWidth = 5; //线的边框为10像素
1254
1250
  cobj.strokeStyle = '#d9363e';
@@ -1256,8 +1252,8 @@ class Video extends Component {
1256
1252
 
1257
1253
  //右边框
1258
1254
  cobj.beginPath();
1259
- cobj.moveTo(640, 360 * this.state.listVideoPicture.length);
1260
- cobj.lineTo(640, 0);
1255
+ cobj.moveTo(640, 360 * this.state.listVideoPicture.length + baseStartHeight);
1256
+ cobj.lineTo(640, 0 + baseStartHeight);
1261
1257
  cobj.closePath(); //闭合路径
1262
1258
  cobj.lineWidth = 5; //线的边框为10像素
1263
1259
  cobj.strokeStyle = '#d9363e';
@@ -1266,8 +1262,8 @@ class Video extends Component {
1266
1262
 
1267
1263
  //上边框
1268
1264
  cobj.beginPath();
1269
- cobj.moveTo(0, 360 * this.state.listVideoPicture.length);
1270
- cobj.lineTo(640, 360 * this.state.listVideoPicture.length);
1265
+ cobj.moveTo(0, 360 * this.state.listVideoPicture.length + baseStartHeight);
1266
+ cobj.lineTo(640, 360 * this.state.listVideoPicture.length + baseStartHeight);
1271
1267
  cobj.closePath(); //闭合路径
1272
1268
  cobj.lineWidth = 5; //线的边框为10像素
1273
1269
  cobj.strokeStyle = '#d9363e';
@@ -1278,9 +1274,9 @@ class Video extends Component {
1278
1274
  var img = document.getElementById("icon_huatong");
1279
1275
  var img1 = document.getElementById("icon_huatong_close");
1280
1276
  if (this.state.listVideoPicture[i].mute) {
1281
- cobj.drawImage(img1, 10, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
1277
+ cobj.drawImage(img1, 10, 360 * (i + 1) - 60 + baseStartHeight, microphoneSize, microphoneSize);
1282
1278
  } else {
1283
- cobj.drawImage(img, 10, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
1279
+ cobj.drawImage(img, 10, 360 * (i + 1) - 60 + baseStartHeight, microphoneSize, microphoneSize);
1284
1280
 
1285
1281
  // 绘制实时音量
1286
1282
  let sid = document.getElementById(this.state.listVideoPicture[i].name).name
@@ -1297,9 +1293,9 @@ class Video extends Component {
1297
1293
  // 以画布左上角为坐标原点
1298
1294
  let drawArea = {
1299
1295
  x1: 28 / 50 * microphoneSize + 10, // 波动范围右下角的点坐标
1300
- y1: 25 / 50 * microphoneSize + 360 * (i + 1) - 60,
1296
+ y1: 25 / 50 * microphoneSize + 360 * (i + 1) - 60 + baseStartHeight,
1301
1297
  x2: 22 / 50 * microphoneSize + 10, // 波动范围左上角的点坐标
1302
- y2: 10 / 50 * microphoneSize + 360 * (i + 1) - 60,
1298
+ y2: 10 / 50 * microphoneSize + 360 * (i + 1) - 60 + baseStartHeight,
1303
1299
  }
1304
1300
 
1305
1301
 
@@ -1329,26 +1325,51 @@ class Video extends Component {
1329
1325
  }
1330
1326
 
1331
1327
  }
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)
1328
+ // 录制中状态
1329
+ if (this.state.businessRecordId) {
1330
+ let str = 录制中'
1331
+ cobj.fillStyle = '#F8F2F3';
1332
+ cobj.font = "normal lighter 30px sans-serif";
1333
+ // cobj.fillRect(0, 0, 640, recordBoxHeight)
1340
1334
  cobj.textAlign = 'center';
1341
- cobj.strokeStyle = 'white';
1335
+ cobj.strokeStyle = 'red';
1342
1336
  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);
1337
+ cobj.strokeText(str, 320, recordBoxHeight - 15);
1338
+ cobj.stroke();
1339
+ }
1340
+ // 消息提示
1341
+ if (messageValue) {
1342
+ let str = messageValue
1343
+ cobj.fillStyle = '#F8F2F3';
1344
+ cobj.font = "normal lighter 30px sans-serif";
1345
+ // const textWidth = Math.min(cobj.measureText(str).width, 610)
1346
+ cobj.fillRect(0, recordBoxHeight, 640, messageBoxHeight)
1347
+ cobj.textAlign = 'center';
1348
+ cobj.strokeStyle = 'black';
1349
+ cobj.lineWidth = 2
1350
+ cobj.strokeText(str, 320, recordBoxHeight + messageBoxHeight - 15);
1351
1351
  cobj.stroke();
1352
+ }
1353
+
1354
+ // 敏感词提示
1355
+ // let str = this.state.sensitiveTitle || ''
1356
+ // if (str)
1357
+ // cobj.fillStyle = 'red';
1358
+ // cobj.font = "normal lighter 32px sans-serif";
1359
+ // const textWidth = Math.min(cobj.measureText(str).width, 610)
1360
+ // cobj.fillRect(320 - textWidth/ 2, 24, textWidth, 32)
1361
+ // cobj.textAlign = 'center';
1362
+ // cobj.strokeStyle = 'white';
1363
+ // cobj.lineWidth = 2
1364
+ // for (let k = 0; k < str.length; k++) {
1365
+ // if (cobj.measureText(str.substring(0, k + 1)).width > 610) {
1366
+ // str = str.substring(0, k - 2)
1367
+ // str += '...'
1368
+ // break;
1369
+ // }
1370
+ // }
1371
+ // cobj.strokeText(str, 320, 50);
1372
+ // cobj.stroke();
1352
1373
  };
1353
1374
 
1354
1375
  const captureStream = canvas.captureStream();
@@ -1365,6 +1386,7 @@ class Video extends Component {
1365
1386
  pictureInPictureVideo.style.display = 'block';
1366
1387
  pictureInPictureVideo.play();
1367
1388
  this.state.isPictureInPicture = true
1389
+ clearTimeout(this.loopPlay)
1368
1390
  });
1369
1391
 
1370
1392
  pictureInPictureVideo.addEventListener('leavepictureinpicture', (event) => {
@@ -1374,20 +1396,23 @@ class Video extends Component {
1374
1396
  this.state.listVideoPicture = []
1375
1397
  worker.postMessage(false);
1376
1398
  this.state.isPictureInPicture = false
1377
-
1399
+
1400
+ clearTimeout(this.loopPlay)
1378
1401
  // 画中画循环播放逻辑
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);
1402
+ if (document.hidden) {
1403
+ this.setState({
1404
+ isPictureConfirmModalVisible: true
1405
+ })
1406
+ this.loopPlay = () => {
1407
+ console.log('loopPlay status', this.state.isPictureInPicture);
1408
+ if(!this.state.isPictureInPicture && document.getElementById("publish_video1")){
1409
+ let audio = new Audio(PIPictureClosedAudio)
1410
+ audio.play()
1411
+ setTimeout(this.loopPlay, 3000);
1412
+ }
1388
1413
  }
1414
+ setTimeout(this.loopPlay, 0);
1389
1415
  }
1390
- setTimeout(loopPlay, 0);
1391
1416
  });
1392
1417
 
1393
1418
  }
@@ -1701,8 +1726,12 @@ class Video extends Component {
1701
1726
  this.saveLog('Start business recording')
1702
1727
  this.enableServerRecording( Mival.id)
1703
1728
 
1704
- this.startFaceDetection();
1705
- this.startImageDetection();
1729
+ if (this.props.whetherDetectFace){
1730
+ this.startFaceDetection();
1731
+ }
1732
+ if (this.props.whetherDetectLight){
1733
+ this.startImageDetection();
1734
+ }
1706
1735
  } else if (Mival.status == 2) {
1707
1736
  // 关闭了业务录制
1708
1737
  console.log('业务录制关闭')
@@ -3570,16 +3599,6 @@ class Video extends Component {
3570
3599
  }
3571
3600
  componentWillMount() {
3572
3601
  console.log('hsbc_teller_sdk', SDK_VERISON)
3573
- // window.document.startRecord = () => {
3574
- // this.enableServerRecording();
3575
- // }
3576
- // window.document.stopRecord = (recordId) => {
3577
- // this.test_controller.StopRemoteRecord(recordId || this.state.recordId)
3578
- // }
3579
- // window.document.detectNetworkWeak = () => {
3580
- // console.log('detectNetworkWeak')
3581
- // this.test_controller.detectNetworkWeak()
3582
- // }
3583
3602
  let arr = []
3584
3603
  for(let i=1;i<=12;i++){
3585
3604
  arr.push({
@@ -5918,6 +5937,14 @@ class Video extends Component {
5918
5937
  </div>
5919
5938
  )
5920
5939
 
5940
+ const isEnvironmentOK = !this.state.loading &&
5941
+ this.state.envInfo.networkResult=='合格' &&
5942
+ this.state.envInfo.batteryResult=='合格' &&
5943
+ this.state.envInfo.memoryResult=='合格' &&
5944
+ this.state.envInfo.cameraResult=='合格' &&
5945
+ this.state.envInfo.microResult=='合格' &&
5946
+ this.state.envInfo.lightResult=='合格'
5947
+
5921
5948
  const sectionStyle = this.state.tabTitles.length > 0 ? {
5922
5949
  zIndex: '-1',
5923
5950
  width: '100%',
@@ -6588,7 +6615,7 @@ class Video extends Component {
6588
6615
  <Modal title="环境检测" maskClosable={false} width={650} closable={false} centered={true} visible={this.state.isModalVisibleEnvironment} footer={[
6589
6616
  <div key='env'>
6590
6617
  {/* <Button className="modelButtonCancel" onClick={this.handleCancelEnvDetection}>取消</Button> */}
6591
- <Button className="modelButtonOk" type="primary" disabled={this.state.loading} danger onClick={this.handleOkEnvDetection}>确定</Button>
6618
+ <Button className={isEnvironmentOK ?"modelButtonOk": "modelButtonNo"} type="primary" disabled={!isEnvironmentOK } danger onClick={this.handleOkEnvDetection}>确定</Button>
6592
6619
  </div>
6593
6620
  ]}>
6594
6621
  <Collapse defaultActiveKey={['1', '2', '3', '4', '5', '6']} ghost>
@@ -6683,6 +6710,8 @@ Video.defaultProps = {
6683
6710
  shareMask: false,
6684
6711
  isOpenSound: false, // true开启进出音效 false不开启
6685
6712
  isWeakSound: false,
6713
+ whetherDetectFace: false, // 是否在双录时开启人脸检测
6714
+ whetherDetectLight: false, // 是否在双录时开启背光检测
6686
6715
  userSide: 2,
6687
6716
  meetingDuration: null, // 会议时长,单位小时
6688
6717
  recordMode: 1, // 录制模式 1远程录制 2网点录制
@@ -6690,6 +6719,7 @@ Video.defaultProps = {
6690
6719
  customerId: "", //客户号
6691
6720
  salesBranchCode: "", //网点编号(分行号)
6692
6721
  financialOffice: "", // 理财室
6722
+ staffName: '', // 坐席名称
6693
6723
  logUrl: 'http://hsbc.cn-shanghai.log.aliyuncs.com/logstores/hsbc/track?APIVersion=0.6.0&app=meeting-ui',
6694
6724
  internalUrl: 'https://wp-staff-gateway.wealth-platform.uat.ali.cloud.cn.hsbc/meeting-ui/OHB/CN/HSBC?chnlID=OHB&locale=zh_CN&chnlCC=CN&chnlGMC=HSBC&targetFunc=supervisorMeeting&sourceFunc=rmMeeting'
6695
6725
  }