react_hsbc_teller 1.5.4 → 1.5.7

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.4",
3
+ "version": "1.5.7",
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();
@@ -2259,7 +2245,8 @@ class Video extends Component {
2259
2245
  console.log(array, newArray, this.state.roomCustomerList);
2260
2246
  this.state.roomCustomerList = newArray
2261
2247
  let config_param
2262
- if (itemOne.tag == 'VIDEO_SOURCE_SCREEN') {
2248
+ if (rateList.indexOf(itemOne.tag) > -1) {
2249
+ // itemOne.tag == 'VIDEO_SOURCE_SCREEN'
2263
2250
  config_param = {
2264
2251
  subscribe_video_id: 'video21',
2265
2252
  subscribe_audio_id: 'audio21',
@@ -3192,32 +3179,6 @@ class Video extends Component {
3192
3179
  }
3193
3180
  }
3194
3181
  }
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
3182
  componentWillUnmount() {
3222
3183
 
3223
3184
  if (this.state.roomCustomerList.length == 0 && this.state.sessionType) {
@@ -3739,11 +3700,12 @@ class Video extends Component {
3739
3700
  this.ocrCallback()
3740
3701
 
3741
3702
  } 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)
3703
+ this.contrastFaceVerify()
3704
+ // const frontIdcard = new File([this.dataURLtoFile(this.state.facialImg, 'image/jpeg')], new Date() + '.png'); // 重命名了
3705
+ // const formData = new FormData();
3706
+ // formData.append('file', frontIdcard);
3707
+ // formData.append('sessionId', this.state.sessionId);
3708
+ // this.uploadImg(formData)
3747
3709
  }
3748
3710
 
3749
3711
  };
@@ -4105,13 +4067,6 @@ class Video extends Component {
4105
4067
  }
4106
4068
  }
4107
4069
  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
4070
  const that = this
4116
4071
  const publish_config = {};
4117
4072
  const canvas = document.createElement('canvas');
@@ -4125,23 +4080,21 @@ class Video extends Component {
4125
4080
  let height = 0
4126
4081
  let x = 0
4127
4082
  let y = 0
4128
- // if(os.isTablet){
4129
- width = ((right - left)* window.screen.width / document.body.clientWidth) - 5
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
- // }
4083
+ // width = ((right - left)* window.screen.width / document.body.clientWidth) - 5
4084
+ // height = ((bottom - top)* window.screen.width / document.body.clientWidth) - 30
4085
+ // x = (left * window.screen.width / document.body.clientWidth)
4086
+ // y = (top* window.screen.width / document.body.clientWidth) + 8
4087
+ // width = ((right - left)* 1280 / document.body.clientWidth) - 5
4088
+ // height = ((bottom - top)* 1280 / document.body.clientWidth) - 30
4089
+ // x = (left* 1280 / document.body.clientWidth)
4090
+ // y = (top* 1280 / document.body.clientWidth) + 8
4091
+ width = ((right - left)) - 5
4092
+ height = ((bottom - top)) - 30
4093
+ x = (left)
4094
+ y = (top) + 8
4140
4095
  canvas.width = 960;
4141
4096
  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)
4097
+
4145
4098
 
4146
4099
  videoMedia.addEventListener('play', (event) =>{
4147
4100
  var $this = this; //cache
@@ -4149,8 +4102,14 @@ class Video extends Component {
4149
4102
  loop()
4150
4103
  function loop() {
4151
4104
  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
4105
+ // if(!that.state.tabTitles.find(el=>el.value == 'customerScreen')) {
4106
+ cobj.drawImage(videoMedia, x, y, width, height, 0, 0,960, 540);
4107
+ // } else {
4108
+ // cobj.fillStyle = 'rgb(0 0 0)'
4109
+ // cobj.fillRect(0,0,960,540)
4110
+ // }
4111
+
4112
+ setTimeout(loop, 1000 / 20); // drawing at 30fps
4154
4113
  }
4155
4114
  }
4156
4115
 
@@ -4162,7 +4121,6 @@ class Video extends Component {
4162
4121
  publish_config.sid = document.getElementById('video20').name
4163
4122
  publish_config.stream = canvas.captureStream(10)
4164
4123
  publish_config.video_profile_type=1
4165
- // publish_config.video_profile_diy={width:1280, height:720, frameRate:8, bitrate:1500}
4166
4124
  this.test_controller.ChangeMediaStream(publish_config);
4167
4125
  } else {
4168
4126
 
@@ -4170,7 +4128,6 @@ class Video extends Component {
4170
4128
  publish_config.publish_device = 5
4171
4129
  publish_config.need_volume_analyser = true
4172
4130
  publish_config.video_profile_type=1
4173
- // publish_config.video_profile_diy={width:1280, height:720, frameRate:8, bitrate:1500}
4174
4131
  publish_config.degradationType=2
4175
4132
  publish_config.stream = canvas.captureStream(10)
4176
4133
  publish_config.publish_video_id = 'video20'
@@ -4182,6 +4139,10 @@ class Video extends Component {
4182
4139
  navigator.mediaDevices.getDisplayMedia({
4183
4140
  video: true,
4184
4141
  preferCurrentTab:true,
4142
+ video: {
4143
+ width: document.body.clientWidth,
4144
+ height: document.body.clientHeight
4145
+ }
4185
4146
  })
4186
4147
  .then((stream) => {
4187
4148
  if(streamShare) {
@@ -4189,18 +4150,12 @@ class Video extends Component {
4189
4150
  streamShare = ''
4190
4151
  }
4191
4152
  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
- // }
4153
+ // stream.getVideoTracks()[0].applyConstraints({
4154
+ // width: 1280,
4155
+ // height: 720
4156
+ // // width: window.screen.width,
4157
+ // // height: window.screen.height
4158
+ // })
4204
4159
 
4205
4160
  streamShare = stream
4206
4161
  stream.getVideoTracks()[0].onended = async ()=>{
@@ -4425,6 +4380,7 @@ class Video extends Component {
4425
4380
  sendNotification = () =>{
4426
4381
  console.log(this.props.shareMask,this.state.shareMaskState)
4427
4382
  this.state.shareMaskState = this.props.shareMask
4383
+ // 加延迟是因为在关闭的时候可以看到部分rm的操作
4428
4384
  setTimeout(() => {
4429
4385
  callNimIM('sendCustomCmdMsg', {
4430
4386
  customId: this.state.imRoomId,