react_hsbc_teller 1.2.0 → 1.2.1

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.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -1,7 +1,26 @@
1
1
  import Server from './server';
2
2
 
3
3
  class API extends Server{
4
-
4
+ async ocrCallback(params = {}){
5
+ // return this.axios('get', '/lang/select/2', params);
6
+ try{
7
+ let result = await this.axios('post', '/hsbc/identify/ocr/callback', params);
8
+ console.log(result)
9
+ if(result && (result.data instanceof Object) && result.code === 200){
10
+ return result||[];
11
+ }else{
12
+ let err = {
13
+ tip: '服务异常',
14
+ response: result,
15
+ data: params,
16
+ // url: 'https://api.cangdu.org/shopro/data/products',
17
+ }
18
+ throw err;
19
+ }
20
+ }catch(err){
21
+ throw err;
22
+ }
23
+ }
5
24
  async enterRoom(params = {}){
6
25
  // return this.axios('get', '/lang/select/2', params);
7
26
  try{
@@ -54,17 +54,17 @@ function websocketonerror() { // 连接建立失败重连
54
54
  // initWebSocket()
55
55
  }
56
56
  function websocketonmessage(e) {
57
- console.log('收到消息', e);
58
- console.log('收到消息', e.data);
57
+ // console.log('收到消息', e);
58
+ // console.log('收到消息', e.data);
59
59
  const jsondata = xml2json(e.data);
60
60
  console.log('jsondata', jsondata);
61
61
  if (undefined != jsondata.message) {
62
62
  if (undefined != jsondata.message.body) {
63
- console.log('收到的消息:', jsondata.message.body);
63
+ // console.log('收到的消息:', jsondata.message.body);
64
64
  const from = jsondata.message['-from'];
65
- console.log('from', from);
65
+ // console.log('from', from);
66
66
  const type = jsondata.message['-type'];
67
- console.log('type', type);
67
+ // console.log('type', type);
68
68
  if ((from.split('/').length > 0) && (from.split('/')[from.split('/').length - 1] == JSON.parse(window.sessionStorage.getItem('sigData')).account)) {
69
69
  // 自己的消息不做处理
70
70
  } else if ((type == 'chat' || type == 'groupchat') && jsondata.message.body.length > 0) {
@@ -217,7 +217,7 @@ function websocketclose(e) { // 关闭
217
217
  // 发消息
218
218
  // // 发送消息 to---接收者id,from---发送者id,type---消息类型(chat--单聊,groupchat--群聊)。message--发送的消息
219
219
  function sendMessage(to, from, type, message) {
220
- console.log('发送聊天信息', to, from, type, message);
220
+ // console.log('发送聊天信息', to, from, type, message);
221
221
  if (islogin) {
222
222
  const temp = {
223
223
  message: {
@@ -19,10 +19,14 @@ import message from "antd/lib/message";
19
19
  import 'antd/lib/message/style'
20
20
  import Spin from "antd/lib/spin";
21
21
  import 'antd/lib/spin/style'
22
+ import Select from "antd/lib/select";
23
+ import 'antd/lib/select/style'
24
+
22
25
  import { Button } from '../../../node_modules/antd/lib/index';
23
26
  import CanvasDraw from "react-canvas-draw";
24
27
  import { FormattedMessage, injectIntl } from 'react-intl';
25
28
  import axios from 'axios';
29
+ const { Option } = Select;
26
30
  const LEAVE_TYPE = {
27
31
  TELLER_EXIT: 1, // 坐席退出
28
32
  ROOM_DESTROYED: -1, // 房间异常
@@ -141,6 +145,8 @@ class Video extends Component {
141
145
  noVideoEleven: false,
142
146
  noVideoTwelve: false,
143
147
  manualClose: false,
148
+ defaultValue: '1',
149
+ customOcrSid: ''
144
150
  };
145
151
  // eslint-disable-next-line no-undef
146
152
  test_controller = '';
@@ -164,6 +170,8 @@ class Video extends Component {
164
170
  let publish_config = {}
165
171
  publish_config.media_type = 1
166
172
  publish_config.publish_device = 1
173
+ publish_config.videoSource = this.state.cameraValue
174
+ publish_config.audioSource = this.state.microphoneValue
167
175
  publish_config.need_volume_analyser = true
168
176
  // publish_config.video_profile_type = 3
169
177
  publish_config.video_profile_type=100
@@ -267,7 +275,6 @@ class Video extends Component {
267
275
  const config_param = {};
268
276
  config_param.auto_publish_subscribe = 4;
269
277
  config_param.media_type = 1;
270
- config_param.publish_device = 1;
271
278
  config_param.video_profile_type = '3';
272
279
  config_param.need_volume_analyser = true;
273
280
  config_param.initPublish = [
@@ -360,6 +367,106 @@ class Video extends Component {
360
367
  url: '' // ⽔印图⽚ HTTP 地址
361
368
  }
362
369
  ];
370
+ recordParam.tagPositions = [
371
+ {
372
+ tag: 'projectionWhiteboard',
373
+ xPosition: '0',
374
+ yPosition: '360',
375
+ width: '640',
376
+ height: '360'
377
+ },
378
+ {
379
+ tag: 'VIDEO_SOURCE_SCREEN',
380
+ xPosition: '0',
381
+ yPosition: '144',
382
+ width: '256',
383
+ height: '144'
384
+ },
385
+ {
386
+ tag: 'tag1',
387
+ xPosition: '0',
388
+ yPosition: '0',
389
+ width: '160',
390
+ height: '144'
391
+ },
392
+ {
393
+ tag: 'customer1',
394
+ xPosition: '160',
395
+ yPosition: '0',
396
+ width: '160',
397
+ height: '144'
398
+ },
399
+ {
400
+ tag: 'customer2',
401
+ xPosition: '320',
402
+ yPosition: '0',
403
+ width: '160',
404
+ height: '144'
405
+ },
406
+ {
407
+ tag: 'customer3',
408
+ xPosition: '480',
409
+ yPosition: '0',
410
+ width: '160',
411
+ height: '144'
412
+ },
413
+ {
414
+ tag: 'customer4',
415
+ xPosition: '640',
416
+ yPosition: '0',
417
+ width: '160',
418
+ height: '144'
419
+ },
420
+ {
421
+ tag: 'customer5',
422
+ xPosition: '800',
423
+ yPosition: '0',
424
+ width: '160',
425
+ height: '144'
426
+ },
427
+ {
428
+ tag: 'customer6',
429
+ xPosition: '960',
430
+ yPosition: '0',
431
+ width: '160',
432
+ height: '144'
433
+ },
434
+ {
435
+ tag: 'customer7',
436
+ xPosition: '1120',
437
+ yPosition: '0',
438
+ width: '160',
439
+ height: '144'
440
+ },
441
+ {
442
+ tag: 'customer8',
443
+ xPosition: '1120',
444
+ yPosition: '144',
445
+ width: '160',
446
+ height: '144'
447
+ },
448
+ {
449
+ tag: 'customer9',
450
+ xPosition: '1120',
451
+ yPosition: '288',
452
+ width: '160',
453
+ height: '144'
454
+ },
455
+ {
456
+ tag: 'customer10',
457
+ xPosition: '1120',
458
+ yPosition: '432',
459
+ width: '160',
460
+ height: '144'
461
+ },
462
+ {
463
+ tag: 'customer11',
464
+ xPosition: '1120',
465
+ yPosition: '576',
466
+ width: '160',
467
+ height: '144'
468
+ }
469
+ ]
363
470
  console.log('recordParam', recordParam);
364
471
  this.test_controller.StartRemoteRecord(filePath, recordParam, '')
365
472
 
@@ -408,11 +515,6 @@ class Video extends Component {
408
515
  console.log(result);
409
516
  if (this.state.faceCustomerType == 1) {
410
517
  this.contrastFaceVerify(result.data)
411
- } else if (this.state.faceCustomerType == 2) {
412
- // ocr
413
- this.setState({
414
- isModalVisibleFacial: false
415
- })
416
518
  }
417
519
 
418
520
  } catch (err) {
@@ -1491,8 +1593,14 @@ class Video extends Component {
1491
1593
  })
1492
1594
  if (!this.state.appId && !this.state.sessionType) {
1493
1595
  this.mpaasSig(data);
1596
+ let indexId = 0
1597
+ obj.map((item,index)=>{
1598
+ if(item.actionname.indexOf('Integrated Camera' != -1)) {
1599
+ indexId = index
1600
+ }
1601
+ })
1494
1602
  this.setState({
1495
- cameraValue: obj[0].actionid,
1603
+ cameraValue: obj[indexId].actionid,
1496
1604
  microphoneValue: obj1[0].actionid
1497
1605
  })
1498
1606
  } else {
@@ -1585,6 +1693,8 @@ class Video extends Component {
1585
1693
  publish_config.media_type = 1
1586
1694
  publish_config.publish_device = 1
1587
1695
  publish_config.need_volume_analyser = true
1696
+ publish_config.videoSource = this.state.cameraValue
1697
+ publish_config.audioSource = this.state.microphoneValue
1588
1698
  // publish_config.video_profile_type = 3
1589
1699
  publish_config.video_profile_type=100
1590
1700
  publish_config.video_profile_diy={width:640, height:360, frameRate:15, bitrate:400}
@@ -2494,7 +2604,7 @@ class Video extends Component {
2494
2604
  }
2495
2605
 
2496
2606
  for (var i = 0; i < 40; i++) {
2497
- let energy = (dataArray[step * i] / 256.0) * 100;
2607
+ let energy = (dataArray[step * i] / 256.0) * 80;
2498
2608
  ctx.beginPath();
2499
2609
  ctx.fillStyle = this.props.voiceColor;
2500
2610
  const { x1, y1, x2, y2 } = drawArea
@@ -2535,9 +2645,9 @@ class Video extends Component {
2535
2645
  // this.setState({
2536
2646
  // isPDF: true,
2537
2647
  // })
2538
- // } else {
2648
+ // } else {
2539
2649
  document.getElementById('video20') && document.getElementById('video20').name ? this.test_controller.UnPublish(document.getElementById('video20').name) : ''
2540
- // }
2650
+ // }
2541
2651
  this.state.isSharedScreen = false
2542
2652
  this.state.isScreenSwitching = false
2543
2653
  this.setState({
@@ -2550,11 +2660,11 @@ class Video extends Component {
2550
2660
  }
2551
2661
  // if (!this.state.laveRoomSharedScreen && this.state.isSharedScreen) {
2552
2662
  // this.sharedScreen()
2553
- // }
2663
+ // }
2554
2664
  }
2555
2665
 
2556
2666
 
2557
- }
2667
+ };
2558
2668
  }
2559
2669
  enterRoom = async () =>{
2560
2670
  try {
@@ -3084,12 +3194,41 @@ class Video extends Component {
3084
3194
  isModalVisibleEnd: false
3085
3195
  })
3086
3196
  };
3197
+ ocrCallback= async () => {
3198
+ try {
3199
+ let result = await API.ocrCallback({
3200
+ sessionId: this.state.sessionId,
3201
+ staffId: this.props.tellerAccount,
3202
+ activityId: this.props.businessNumber,
3203
+ appAccount: this.state.faceCustomerUid,
3204
+ fileBase64: this.state.facialImg.replace(/^data:image\/\w+;base64,/,""),
3205
+ type: this.state.defaultValue
3206
+ });
3207
+ if (result.code == 200) {
3208
+ this.messageClick('识别成功','success')
3209
+ this.setState({
3210
+ isModalVisibleFacial: false
3211
+ })
3212
+ } else {
3213
+ this.messageClick('识别失败','error')
3214
+ }
3215
+ } catch (err) {
3216
+ this.messageClick('识别失败','error')
3217
+ }
3218
+ }
3087
3219
  handleOkFacial = () => {
3088
- const frontIdcard = new File([this.dataURLtoFile(this.state.facialImg, 'image/jpeg')], new Date() + '.png'); // 重命名了
3220
+ if (this.state.faceCustomerType == 2) {
3221
+ // ocr
3222
+ this.ocrCallback()
3223
+
3224
+ } else {
3225
+ const frontIdcard = new File([this.dataURLtoFile(this.state.facialImg, 'image/jpeg')], new Date() + '.png'); // 重命名了
3089
3226
  const formData = new FormData();
3090
3227
  formData.append('file', frontIdcard);
3091
3228
  formData.append('sessionId', this.state.sessionId);
3092
3229
  this.uploadImg(formData)
3230
+ }
3231
+
3093
3232
  };
3094
3233
  handleCancelFacial = () => {
3095
3234
  this.setState({
@@ -3174,6 +3313,7 @@ class Video extends Component {
3174
3313
  sid = document.getElementById('video12').name;
3175
3314
  }
3176
3315
  console.log(sid)
3316
+ this.state.customOcrSid = sid
3177
3317
  this.state.faceCustomerUid = item.customId,
3178
3318
  this.setState({
3179
3319
  clickedFacial: false,
@@ -3183,6 +3323,13 @@ class Video extends Component {
3183
3323
  facialImg: this.test_controller.TakePicture(1, undefined, undefined, sid, 'png')
3184
3324
  })
3185
3325
  }
3326
+ handleChangeOcr =(val)=> {
3327
+ console.log(val)
3328
+ this.setState({
3329
+ defaultValue: val,
3330
+ facialImg: this.test_controller.TakePicture(1, undefined, undefined, this.state.customOcrSid, 'png')
3331
+ })
3332
+ }
3186
3333
  componentWillReceiveProps(props) {
3187
3334
  this.state.channelId = props.roomId,
3188
3335
  this.state.rtoken = props.mtoken,
@@ -3524,6 +3671,7 @@ class Video extends Component {
3524
3671
  console.log('whiteboardDIV', this.state.whiteboardHeight,box.clientHeight,this.state.whiteboardWidth)
3525
3672
  }
3526
3673
  }
3674
+
3527
3675
  render() {
3528
3676
  const { meetingInfo,isTranscribing } = this.props
3529
3677
  var pdfChildren
@@ -4132,7 +4280,16 @@ class Video extends Component {
4132
4280
  </div>
4133
4281
  ]}>
4134
4282
  <div className="faceBody">
4135
- <img className="faceImg" src={this.state.facialImg} alt=""></img>
4283
+ {this.state.faceCustomerType == 2 &&
4284
+ <Select defaultValue={this.state.defaultValue} style={{ width: 120,marginBottom: '20px' }} onChange={this.handleChangeOcr}>
4285
+ <Option value="1">正面</Option>
4286
+ <Option value="2">反面</Option>
4287
+ </Select>
4288
+ }
4289
+ <div>
4290
+ <img className="faceImg" src={this.state.facialImg} alt=""></img>
4291
+ </div>
4292
+
4136
4293
  </div>
4137
4294
  </Modal>
4138
4295
  {/* <Modal title={this.state.titleModal} cancelText="取消" okText="确定" visible={this.state.isModalVisibleFacial}
@@ -151,8 +151,7 @@
151
151
  }
152
152
  }
153
153
  .faceImg{
154
- width: 200px;
155
- height: 300px;
154
+ width: 70%;
156
155
  }
157
156
  .faceBody{
158
157
  text-align: center;