react_hsbc_teller 1.5.3 → 1.5.6

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": "1.5.3",
3
+ "version": "1.5.6",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -358,16 +358,16 @@ class API extends Server{
358
358
  async contrastFaceVerify(params = {}){
359
359
  try{
360
360
  let result = await this.axios('post', '/hsbc/contrastFaceVerify', params);
361
- if(result && result.code === 200){
361
+ // if(result && result.code === 200){
362
362
  return result;
363
- }else{
364
- let err = {
365
- tip: '上传图片失败',
366
- response: result,
367
- data: params,
368
- }
369
- throw err;
370
- }
363
+ // }else{
364
+ // let err = {
365
+ // tip: '人脸识别失败',
366
+ // response: result,
367
+ // data: params,
368
+ // }
369
+ // throw err;
370
+ // }
371
371
  }catch(err){
372
372
  throw err;
373
373
  }
@@ -38,23 +38,6 @@ let muteJson = new Map()
38
38
  let dateTime = 0
39
39
  let messageValue = ''
40
40
  let rateList = []
41
- var os = function() {
42
- var ua = navigator.userAgent,
43
- isWindowsPhone = /(?:Windows Phone)/.test(ua),
44
- isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone,
45
- isAndroid = /(?:Android)/.test(ua),
46
- isFireFox = /(?:Firefox)/.test(ua),
47
- isChrome = /(?:Chrome|CriOS)/.test(ua),
48
- isTablet = /(?:iPad|PlayBook)/.test(ua) || (isAndroid && !/(?:Mobile)/.test(ua)) || (isFireFox && /(?:Tablet)/.test(ua)),
49
- isPhone = /(?:iPhone)/.test(ua) && !isTablet,
50
- isPc = !isPhone && !isAndroid && !isSymbian;
51
- return {
52
- isTablet: isTablet,
53
- isPhone: isPhone,
54
- isAndroid: isAndroid,
55
- isPc: isPc
56
- };
57
- }();
58
41
  message.config({
59
42
  getContainer: ()=>document.getElementById('allHSBC')
60
43
  })
@@ -62,10 +45,8 @@ message.config({
62
45
  class Video extends Component {
63
46
  constructor(props) {
64
47
  super(props)
65
- // this.cancel = axios.CancelToken.source()
66
48
  }
67
49
  cancel = axios.CancelToken.source()
68
- // signCanvas = React.createRef();
69
50
  state = {
70
51
  signNoClick: false,
71
52
  listVideoPicture: [],
@@ -525,6 +506,7 @@ class Video extends Component {
525
506
  // height: 180
526
507
  // }
527
508
  ]
509
+ Array.isArray(res) ?
528
510
  res.map((item)=>{
529
511
  list.push({
530
512
  tag: item.tag,
@@ -533,6 +515,12 @@ class Video extends Component {
533
515
  width: item.width,
534
516
  height: item.height
535
517
  })
518
+ }) : list.push({
519
+ tag: 'VIDEO_SOURCE_SCREEN',
520
+ xPosition: 1290,
521
+ yPosition: 640,
522
+ width: 630,
523
+ height: 350
536
524
  })
537
525
  const filePath = 'recordId_' + new Date().valueOf();
538
526
  const recordParam = {};
@@ -574,13 +562,12 @@ class Video extends Component {
574
562
  })
575
563
  }
576
564
  };
577
- contrastFaceVerify = async data => {
578
- console.log(data);
565
+ contrastFaceVerify = async () => {
579
566
  try {
580
567
  let result = await API.contrastFaceVerify({
581
568
  appAccount: this.state.faceCustomerUid,
582
569
  sessionId: this.state.sessionId,
583
- imagePath: data
570
+ fileBase64: this.state.facialImg.replace(/^data:image\/\w+;base64,/,"")
584
571
  });
585
572
  console.log(result);
586
573
  if (result.code == 200) {
@@ -1711,11 +1698,10 @@ class Video extends Component {
1711
1698
  errorType: -1
1712
1699
  })
1713
1700
  }
1714
- } else if (Mival.typeId == 4100 && Mival.data.sessionId == this.state.sessionId) {
1701
+ } else if (Mival.typeId == 4001) {
1715
1702
  // 手机端停止投屏
1716
- if (!document.getElementById("video21").name) {
1717
- this.tabTitlesClick('customerScreen', 'delect')
1718
- }
1703
+ this.tabTitlesClick('customerScreen', 'delect')
1704
+
1719
1705
  }
1720
1706
  };
1721
1707
  window.IMOpenfire = msg =>{
@@ -1752,9 +1738,9 @@ class Video extends Component {
1752
1738
  this.workerClick()
1753
1739
  rateList = []
1754
1740
  this.rateAll().then((res)=>{
1755
- res.map((item)=>{
1741
+ Array.isArray(res) ? res.map((item)=>{
1756
1742
  rateList.push(item.tag)
1757
- })
1743
+ }) : rateList = []
1758
1744
  console.log('rateList',rateList)
1759
1745
  })
1760
1746
  this.test_controller.GetDevices();
@@ -3192,32 +3178,6 @@ class Video extends Component {
3192
3178
  }
3193
3179
  }
3194
3180
  }
3195
- contrastFaceVerify = async data => {
3196
- console.log(data);
3197
- try {
3198
- let result = await API.contrastFaceVerify({
3199
- appAccount: this.state.faceCustomerUid,
3200
- sessionId: this.state.sessionId,
3201
- imagePath: data
3202
- });
3203
- console.log(result);
3204
- if (result.code == 200) {
3205
- this.messageClick('人脸识别成功','success')
3206
- this.setState({
3207
- isModalVisibleFacial: false
3208
- })
3209
- } else {
3210
- this.messageClick('人脸识别失败','error')
3211
- }
3212
-
3213
-
3214
- } catch (err) {
3215
- console.error(err);
3216
- if(err.status == 502 || err.status== 404) {
3217
- this.roomCallBack(2, '连接服务器失败','SYS-02')
3218
- }
3219
- }
3220
- };
3221
3181
  componentWillUnmount() {
3222
3182
 
3223
3183
  if (this.state.roomCustomerList.length == 0 && this.state.sessionType) {
@@ -3739,11 +3699,12 @@ class Video extends Component {
3739
3699
  this.ocrCallback()
3740
3700
 
3741
3701
  } else {
3742
- const frontIdcard = new File([this.dataURLtoFile(this.state.facialImg, 'image/jpeg')], new Date() + '.png'); // 重命名了
3743
- const formData = new FormData();
3744
- formData.append('file', frontIdcard);
3745
- formData.append('sessionId', this.state.sessionId);
3746
- this.uploadImg(formData)
3702
+ this.contrastFaceVerify()
3703
+ // const frontIdcard = new File([this.dataURLtoFile(this.state.facialImg, 'image/jpeg')], new Date() + '.png'); // 重命名了
3704
+ // const formData = new FormData();
3705
+ // formData.append('file', frontIdcard);
3706
+ // formData.append('sessionId', this.state.sessionId);
3707
+ // this.uploadImg(formData)
3747
3708
  }
3748
3709
 
3749
3710
  };
@@ -4105,13 +4066,6 @@ class Video extends Component {
4105
4066
  }
4106
4067
  }
4107
4068
  navigatorClick=()=>{
4108
- if(os.isAndroid || os.isPhone) {
4109
- console.log("手机")
4110
- } else if(os.isTablet) {
4111
- console.log("平板")
4112
- } else if(os.isPc) {
4113
- console.log("电脑")
4114
- }
4115
4069
  const that = this
4116
4070
  const publish_config = {};
4117
4071
  const canvas = document.createElement('canvas');
@@ -4125,23 +4079,17 @@ class Video extends Component {
4125
4079
  let height = 0
4126
4080
  let x = 0
4127
4081
  let y = 0
4128
- // if(os.isTablet){
4129
- width = ((right - left)* window.screen.width / document.body.clientWidth) - 10
4130
- height = ((bottom - top)* window.screen.width / document.body.clientWidth) - 30
4131
- x = (left * window.screen.width / document.body.clientWidth)
4132
- y = (top* window.screen.width / document.body.clientWidth) + 8
4133
- // }
4134
- // if(os.isPc) {
4135
- // width = right - left
4136
- // height = bottom - top
4137
- // x = left
4138
- // y = top
4139
- // }
4082
+ // width = ((right - left)* window.screen.width / document.body.clientWidth) - 5
4083
+ // height = ((bottom - top)* window.screen.width / document.body.clientWidth) - 30
4084
+ // x = (left * window.screen.width / document.body.clientWidth)
4085
+ // y = (top* window.screen.width / document.body.clientWidth) + 8
4086
+ width = ((right - left)* 1280 / document.body.clientWidth) - 5
4087
+ height = ((bottom - top)* 1280 / document.body.clientWidth) - 30
4088
+ x = (left* 1280 / document.body.clientWidth)
4089
+ y = (top* 1280 / document.body.clientWidth) + 8
4140
4090
  canvas.width = 960;
4141
4091
  canvas.height = 540;
4142
- // cobj.fillStyle = 'rgb(255 255 255)'
4143
- // cobj.fillRect(0,0,1280,720)
4144
- // const height1 = document.getElementById("whiteboardDIV").getBoundingClientRect().height* window.screen.height / (document.body.clientHeight + 280)
4092
+
4145
4093
 
4146
4094
  videoMedia.addEventListener('play', (event) =>{
4147
4095
  var $this = this; //cache
@@ -4149,8 +4097,14 @@ class Video extends Component {
4149
4097
  loop()
4150
4098
  function loop() {
4151
4099
  if (!$this.paused && !$this.ended) {
4152
- cobj.drawImage(videoMedia, x, y, width, height, 0, 0,960, 540);
4153
- setTimeout(loop, 1000 / 10); // drawing at 30fps
4100
+ // if(!that.state.tabTitles.find(el=>el.value == 'customerScreen')) {
4101
+ cobj.drawImage(videoMedia, x, y, width, height, 0, 0,960, 540);
4102
+ // } else {
4103
+ // cobj.fillStyle = 'rgb(0 0 0)'
4104
+ // cobj.fillRect(0,0,960,540)
4105
+ // }
4106
+
4107
+ setTimeout(loop, 1000 / 20); // drawing at 30fps
4154
4108
  }
4155
4109
  }
4156
4110
 
@@ -4162,7 +4116,6 @@ class Video extends Component {
4162
4116
  publish_config.sid = document.getElementById('video20').name
4163
4117
  publish_config.stream = canvas.captureStream(10)
4164
4118
  publish_config.video_profile_type=1
4165
- // publish_config.video_profile_diy={width:1280, height:720, frameRate:8, bitrate:1500}
4166
4119
  this.test_controller.ChangeMediaStream(publish_config);
4167
4120
  } else {
4168
4121
 
@@ -4170,7 +4123,6 @@ class Video extends Component {
4170
4123
  publish_config.publish_device = 5
4171
4124
  publish_config.need_volume_analyser = true
4172
4125
  publish_config.video_profile_type=1
4173
- // publish_config.video_profile_diy={width:1280, height:720, frameRate:8, bitrate:1500}
4174
4126
  publish_config.degradationType=2
4175
4127
  publish_config.stream = canvas.captureStream(10)
4176
4128
  publish_config.publish_video_id = 'video20'
@@ -4182,6 +4134,10 @@ class Video extends Component {
4182
4134
  navigator.mediaDevices.getDisplayMedia({
4183
4135
  video: true,
4184
4136
  preferCurrentTab:true,
4137
+ video: {
4138
+ width: 1280,
4139
+ height: 720
4140
+ }
4185
4141
  })
4186
4142
  .then((stream) => {
4187
4143
  if(streamShare) {
@@ -4189,18 +4145,12 @@ class Video extends Component {
4189
4145
  streamShare = ''
4190
4146
  }
4191
4147
  videoMedia.srcObject = stream;
4192
- // if(os.isTablet){
4193
- stream.getVideoTracks()[0].applyConstraints({
4194
- width: window.screen.width,
4195
- height: window.screen.height
4196
- })
4197
- // }
4198
- // if(os.isPc) {
4199
- // stream.getVideoTracks()[0].applyConstraints({
4200
- // width: document.body.clientWidth,
4201
- // height: document.body.clientHeight - 50
4202
- // })
4203
- // }
4148
+ // stream.getVideoTracks()[0].applyConstraints({
4149
+ // width: 1280,
4150
+ // height: 720
4151
+ // // width: window.screen.width,
4152
+ // // height: window.screen.height
4153
+ // })
4204
4154
 
4205
4155
  streamShare = stream
4206
4156
  stream.getVideoTracks()[0].onended = async ()=>{
@@ -4425,7 +4375,7 @@ class Video extends Component {
4425
4375
  sendNotification = () =>{
4426
4376
  console.log(this.props.shareMask,this.state.shareMaskState)
4427
4377
  this.state.shareMaskState = this.props.shareMask
4428
- setTimeout(() => {
4378
+ // setTimeout(() => {
4429
4379
  callNimIM('sendCustomCmdMsg', {
4430
4380
  customId: this.state.imRoomId,
4431
4381
  content: JSON.stringify({
@@ -4434,7 +4384,7 @@ class Video extends Component {
4434
4384
  'type': this.state.shareMaskState ? 1 : 2
4435
4385
  })
4436
4386
  });
4437
- },100)
4387
+ // },100)
4438
4388
 
4439
4389
  }
4440
4390
  componentDidUpdate(prevProps){