react_hsbc_teller 0.8.2 → 0.8.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": "0.8.2",
3
+ "version": "0.8.6",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -3,7 +3,7 @@
3
3
  /* eslint-disable eqeqeq */
4
4
  import React, { Component, useState } from 'react';
5
5
  import API from '../../api/api';
6
- import { initWebSocket, joinRoom } from '../../common/websocket';
6
+ import { initWebSocket, joinRoom, disconnect } from '../../common/websocket';
7
7
  import './video.less'
8
8
  import Header from '../header/header.jsx'
9
9
  import Foot from '../foot/foot.jsx'
@@ -188,7 +188,7 @@ class Video extends Component {
188
188
  sessionType: false
189
189
  })
190
190
  if(err.status == 502 || err.status== 404) {
191
- this.roomCallBack(2, '连接服务器失败',-11)
191
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
192
192
  } else {
193
193
  this.props.createRoomCallback({
194
194
  type: 2,
@@ -228,9 +228,9 @@ class Video extends Component {
228
228
  } catch (err) {
229
229
  console.error(err);
230
230
  if(err.status == 502 || err.status== 404) {
231
- this.roomCallBack(2, '连接服务器失败',-11)
231
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
232
232
  } else {
233
- this.roomCallBack(2, '签名失败',-8)
233
+ this.roomCallBack(2, '签名失败',6)
234
234
  }
235
235
 
236
236
  }
@@ -387,7 +387,7 @@ class Video extends Component {
387
387
 
388
388
  } catch (err) {
389
389
  if(err.status == 502 || err.status== 404) {
390
- this.roomCallBack(2, '连接服务器失败',-11)
390
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
391
391
  }
392
392
  console.error(err);
393
393
  }
@@ -409,7 +409,7 @@ class Video extends Component {
409
409
  } catch (err) {
410
410
  console.error(err);
411
411
  if(err.status == 502 || err.status== 404) {
412
- this.roomCallBack(2, '连接服务器失败',-11)
412
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
413
413
  }
414
414
  }
415
415
  };
@@ -582,11 +582,7 @@ class Video extends Component {
582
582
  }
583
583
  };
584
584
  endSessionValue = () => {
585
- if(this.state.sessionType) {
586
- this.test_controller.LeaveRoom()
587
- } else {
588
585
  this.finishSession()
589
- }
590
586
 
591
587
  };
592
588
  // 画中画
@@ -619,7 +615,7 @@ class Video extends Component {
619
615
  if (document.getElementById('publish_video1').name) {
620
616
  list.push({
621
617
  name: 'publish_video1',
622
- title: this.props.meetingInfo.host ? this.props.meetingInfo.host : '坐席',
618
+ title: this.props.meetingInfo.host ? this.props.meetingInfo.host : '客户经理1',
623
619
  voice: 'voiceStatue',
624
620
  noVideo: false
625
621
  })
@@ -722,7 +718,7 @@ class Video extends Component {
722
718
  canvas.height = height;
723
719
 
724
720
  interval = setInterval(() => {
725
- // cobj.clearRect(0, 0, width, height);
721
+ cobj.clearRect(0, 0, width, height);
726
722
  for (let i = 0; i < list.length; i++) {
727
723
 
728
724
  let videoId = list[i].name;
@@ -892,7 +888,25 @@ class Video extends Component {
892
888
  loading: false,
893
889
  })
894
890
  if (this.state.sessionId) {
895
- this.props.joinRoomCallback({
891
+ if(code == 'SYS-01' || code == 'SYS-02') {
892
+ this.props.joinRoomCallback({
893
+ type: type,
894
+ errorManage: manege,
895
+ errorCode: code,
896
+ data: {}
897
+ })
898
+ } else {
899
+ this.props.joinRoomCallback({
900
+ type: type,
901
+ errorManage: manege,
902
+ errorCode: 'Join-0' + code,
903
+ data: {}
904
+ })
905
+ }
906
+
907
+ } else {
908
+ if(code == 'SYS-01' || code == 'SYS-02') {
909
+ this.props.createRoomCallback({
896
910
  type: type,
897
911
  errorManage: manege,
898
912
  errorCode: code,
@@ -902,10 +916,11 @@ class Video extends Component {
902
916
  this.props.createRoomCallback({
903
917
  type: type,
904
918
  errorManage: manege,
905
- errorCode: code,
919
+ errorCode: 'Create-0' + code,
906
920
  data: {}
907
921
  })
908
922
  }
923
+ }
909
924
  }
910
925
  tabTitlesClick = (value, type) => {
911
926
  const { tabTitles } = this.state;
@@ -1315,7 +1330,7 @@ class Video extends Component {
1315
1330
  this.setState({
1316
1331
  sessionType: false
1317
1332
  })
1318
- this.roomCallBack(2, 'im建立连接失败',-7)
1333
+ this.roomCallBack(2, 'im建立连接失败',5)
1319
1334
  } else {
1320
1335
  this.setState({
1321
1336
  imStatus: msg
@@ -1419,7 +1434,7 @@ class Video extends Component {
1419
1434
  this.setState({
1420
1435
  cameraList: objList,
1421
1436
  microphoneList: objList1,
1422
- speakerList: [objList2.length>0? objList2[0]: []]
1437
+ speakerList: objList2.length>0? [objList2[0]]: []
1423
1438
  })
1424
1439
  if (!this.state.appId && !this.state.sessionType) {
1425
1440
  this.mpaasSig(data);
@@ -1441,7 +1456,7 @@ class Video extends Component {
1441
1456
  sessionType: false
1442
1457
  })
1443
1458
  this.messageClick('获取设备失败,请检查摄像头设备是否可用或是否禁用摄像头','error')
1444
- this.roomCallBack(2, '获取设备失败',-1)
1459
+ this.roomCallBack(2, '获取设备失败',1)
1445
1460
  };
1446
1461
  // 建立连接成功
1447
1462
  this.test_controller.OnConnectOK = () => {
@@ -1453,7 +1468,7 @@ class Video extends Component {
1453
1468
  this.setState({
1454
1469
  sessionType: false
1455
1470
  })
1456
- this.roomCallBack(2, '连接失败',-2)
1471
+ this.roomCallBack(2, '连接失败',2)
1457
1472
  };
1458
1473
  // 断开连接回调
1459
1474
  this.test_controller.OnConnectClose = (code, msg) => {
@@ -1470,7 +1485,7 @@ class Video extends Component {
1470
1485
  this.setState({
1471
1486
  sessionType: false
1472
1487
  })
1473
- this.roomCallBack(2, '初始化失败',-3)
1488
+ this.roomCallBack(2, '初始化失败',3)
1474
1489
  };
1475
1490
  // 初始化成功回调
1476
1491
  this.test_controller.OnInitRoomConfigOK = () => {
@@ -1499,7 +1514,7 @@ class Video extends Component {
1499
1514
  this.setState({
1500
1515
  sessionType: false
1501
1516
  })
1502
- this.roomCallBack(2, '创建房间失败',-4)
1517
+ this.roomCallBack(2, '创建房间失败',7)
1503
1518
  };
1504
1519
  // 初始化⾳视频成功
1505
1520
  this.test_controller.OnMediaCallSucc = (sid) => {
@@ -1521,11 +1536,25 @@ class Video extends Component {
1521
1536
  // 加入房间失败
1522
1537
  this.test_controller.OnJoinRoomFailed = (err_code, err_msg) => {
1523
1538
  console.log('加入房间失败', err_code, err_msg)
1539
+ // this.setState({
1540
+ // sessionType: false,
1541
+ // isJoinRoom: true
1542
+ // })
1543
+ // this.roomCallBack(2, '加入失败',-5)
1524
1544
  this.setState({
1525
- sessionType: false,
1526
- isJoinRoom: true
1527
- })
1528
- this.roomCallBack(2, '加入失败',-5)
1545
+ channelId: '',
1546
+ rtoken: '',
1547
+ sessionId: '',
1548
+ imRoomId: ''
1549
+ });
1550
+
1551
+ this.test_controller.Disconnect()
1552
+ let data = {
1553
+ account: this.props.tellerAccount,
1554
+ type: '2',
1555
+ sigType: 1
1556
+ };
1557
+ this.mpaasSig(data);
1529
1558
  };
1530
1559
  // 发布媒体流成功
1531
1560
  this.test_controller.OnPublishSucc = (sid) => {
@@ -1572,7 +1601,7 @@ class Video extends Component {
1572
1601
  this.setState({
1573
1602
  sessionType: false
1574
1603
  })
1575
- this.roomCallBack(2, '发布失败',-6)
1604
+ this.roomCallBack(2, '发布失败',4)
1576
1605
  };
1577
1606
  // 订阅媒体流成功
1578
1607
  this.test_controller.OnSubscribeSucc = (feed, sid) => {
@@ -2119,9 +2148,6 @@ class Video extends Component {
2119
2148
  // 退出房间回调
2120
2149
  this.test_controller.OnLeaveRoom = (leaveType) => {
2121
2150
  console.log('退出房间回调', leaveType);
2122
- if(!this.state.isJoinRoom) {
2123
- this.finishSession()
2124
- }
2125
2151
 
2126
2152
  };
2127
2153
  // 推送“退出房间者”给与会者
@@ -2444,13 +2470,11 @@ class Video extends Component {
2444
2470
  } catch (err) {
2445
2471
  console.error(err);
2446
2472
  if(err.status == 502 || err.status== 404) {
2447
- this.roomCallBack(2, '连接服务器失败',-11)
2473
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
2448
2474
  }
2449
2475
  }
2450
2476
  };
2451
- finishSession = async () => {
2452
-
2453
-
2477
+ componentWillUnmount() {
2454
2478
  if (this.state.roomCustomerList.length == 0 && this.state.sessionType) {
2455
2479
  try {
2456
2480
  let result = await API.finishSession({
@@ -2458,11 +2482,15 @@ class Video extends Component {
2458
2482
  tellerId: this.props.tellerAccount
2459
2483
  });
2460
2484
  } catch (err) {
2461
- if(err.status == 502 || err.status== 404) {
2462
- this.roomCallBack(2, '连接服务器失败',-11)
2463
- }
2464
2485
  }
2465
2486
  }
2487
+ if (this.test_controller&&this.state.sessionType) {
2488
+ this.test_controller.LeaveRoom()
2489
+ this.test_controller.Disconnect()
2490
+ }
2491
+ if(this.state.imStatus) {
2492
+ disconnect();
2493
+ }
2466
2494
  this.setState({
2467
2495
  isCustomer: false,
2468
2496
  isWhiteboard: false,
@@ -2471,11 +2499,22 @@ class Video extends Component {
2471
2499
  imJoinRoom: false,
2472
2500
  sessionType: false
2473
2501
  });
2502
+ this.setState = (state, callback) => {
2503
+ return
2504
+ }
2505
+ this.cancel = ''
2506
+ this.timer && clearInterval(this.timer);
2507
+ }
2508
+ finishSession = async () => {
2509
+
2510
+
2511
+ if(this.state.isSharedScreen) {
2512
+ this.sharedScreen()
2513
+ }
2474
2514
  this.props.onLeaveRoom({
2475
2515
  code: LEAVE_TYPE.TELLER_EXIT,
2476
2516
  errMsg: '坐席退出'
2477
2517
  })
2478
-
2479
2518
  }
2480
2519
  getRoomStatus = async data => {
2481
2520
  try {
@@ -2523,13 +2562,15 @@ class Video extends Component {
2523
2562
  this.setState({
2524
2563
  loading: true,
2525
2564
  })
2565
+ const that = this
2526
2566
  axios.get(this.props.resourcePath + "/beauty/beauty.js")
2527
2567
  .then(response => this.addToScriptClick()).catch(function (error) {
2528
2568
  console.log(error);
2529
- this.setState({
2530
- sessionType: false
2569
+ that.setState({
2570
+ sessionType: false,
2571
+ loading: false
2531
2572
  })
2532
- this.roomCallBack(2, '加载资源失败',-10)
2573
+ that.roomCallBack(2, '加载资源失败','SYS-01')
2533
2574
 
2534
2575
 
2535
2576
  })
@@ -2599,13 +2640,6 @@ class Video extends Component {
2599
2640
  }
2600
2641
  }
2601
2642
  }
2602
- componentWillUnmount() {
2603
- this.setState = (state, callback) => {
2604
- return
2605
- }
2606
- this.cancel = ''
2607
- this.timer && clearInterval(this.timer);
2608
- }
2609
2643
  componentWillMount() {
2610
2644
  if (this.props.sessionId) {
2611
2645
  this.getRoomStatus({
@@ -2949,7 +2983,7 @@ class Video extends Component {
2949
2983
  }
2950
2984
  } catch (err) {
2951
2985
  if(err.status == 502 || err.status== 404) {
2952
- this.roomCallBack(2, '连接服务器失败',-11)
2986
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
2953
2987
  }
2954
2988
  }
2955
2989
  }
@@ -3001,6 +3035,7 @@ class Video extends Component {
3001
3035
  })
3002
3036
  }
3003
3037
  componentWillReceiveProps(props) {
3038
+ console.log('componentWillReceiveProps',props)
3004
3039
  this.setState({
3005
3040
  channelId: props.roomId,
3006
3041
  rtoken: props.mtoken,
@@ -3111,7 +3146,7 @@ class Video extends Component {
3111
3146
  this.pictureInPicture('Refresh')
3112
3147
  } catch (err) {
3113
3148
  if(err.status == 502 || err.status== 404) {
3114
- this.roomCallBack(2, '连接服务器失败',-11)
3149
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
3115
3150
  }
3116
3151
  }
3117
3152
  }
@@ -3168,7 +3203,7 @@ class Video extends Component {
3168
3203
  }
3169
3204
  } catch (err) {
3170
3205
  if(err.status == 502 || err.status== 404) {
3171
- this.roomCallBack(2, '连接服务器失败',-11)
3206
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
3172
3207
  }
3173
3208
  }
3174
3209
  }
@@ -3447,7 +3482,7 @@ class Video extends Component {
3447
3482
  />
3448
3483
  }
3449
3484
  <canvas style={{ display: (!this.state.voiceStatue) ? '' : 'none',width: '25px',height:'25px',marginTop: '4px' }} className="canvasClass" id="publish_volumeView" width="40" height="70"></canvas>
3450
- <div className='titleName' style={{ color: this.props.titleColor, fontSize: this.props.fontSize + 'px', fontFamily: this.props.fontFamily }}>{this.props.meetingInfo.host ? this.props.meetingInfo.host : '坐席'}</div>
3485
+ <div className='titleName' style={{ color: this.props.titleColor, fontSize: this.props.fontSize + 'px', fontFamily: this.props.fontFamily }}>{this.props.meetingInfo.host ? this.props.meetingInfo.host : '客户经理1'}</div>
3451
3486
  </div>
3452
3487
  </div>
3453
3488
 
@@ -3934,6 +3969,10 @@ class Video extends Component {
3934
3969
  }
3935
3970
  }
3936
3971
  Video.defaultProps = {
3972
+ mtoken: "26364ded9b83",
3973
+ roomId: "645157287240850",
3974
+ imRoomId: "Fwua8kGB6@conference.openfire2.leimondata.cn",
3975
+ sessionId: "Fwua8kGB6",
3937
3976
  tellerAccount: 't001',
3938
3977
  businessNumber: '123',
3939
3978
  callbackUrl: 'http://47.102.126.132:8720/hsbc/callback',