react_hsbc_teller 0.8.2 → 0.8.3

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.3",
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, '签名失败',8)
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
  // 画中画
@@ -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建立连接失败',7)
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, '创建房间失败',4)
1503
1518
  };
1504
1519
  // 初始化⾳视频成功
1505
1520
  this.test_controller.OnMediaCallSucc = (sid) => {
@@ -1521,11 +1536,18 @@ 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
+ this.addToScript()
1529
1551
  };
1530
1552
  // 发布媒体流成功
1531
1553
  this.test_controller.OnPublishSucc = (sid) => {
@@ -1572,7 +1594,7 @@ class Video extends Component {
1572
1594
  this.setState({
1573
1595
  sessionType: false
1574
1596
  })
1575
- this.roomCallBack(2, '发布失败',-6)
1597
+ this.roomCallBack(2, '发布失败',6)
1576
1598
  };
1577
1599
  // 订阅媒体流成功
1578
1600
  this.test_controller.OnSubscribeSucc = (feed, sid) => {
@@ -2119,9 +2141,6 @@ class Video extends Component {
2119
2141
  // 退出房间回调
2120
2142
  this.test_controller.OnLeaveRoom = (leaveType) => {
2121
2143
  console.log('退出房间回调', leaveType);
2122
- if(!this.state.isJoinRoom) {
2123
- this.finishSession()
2124
- }
2125
2144
 
2126
2145
  };
2127
2146
  // 推送“退出房间者”给与会者
@@ -2444,7 +2463,7 @@ class Video extends Component {
2444
2463
  } catch (err) {
2445
2464
  console.error(err);
2446
2465
  if(err.status == 502 || err.status== 404) {
2447
- this.roomCallBack(2, '连接服务器失败',-11)
2466
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
2448
2467
  }
2449
2468
  }
2450
2469
  };
@@ -2459,7 +2478,7 @@ class Video extends Component {
2459
2478
  });
2460
2479
  } catch (err) {
2461
2480
  if(err.status == 502 || err.status== 404) {
2462
- this.roomCallBack(2, '连接服务器失败',-11)
2481
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
2463
2482
  }
2464
2483
  }
2465
2484
  }
@@ -2475,6 +2494,12 @@ class Video extends Component {
2475
2494
  code: LEAVE_TYPE.TELLER_EXIT,
2476
2495
  errMsg: '坐席退出'
2477
2496
  })
2497
+ if(this.state.sessionType) {
2498
+ this.test_controller.LeaveRoom()
2499
+ this.test_controller.Disconnect()
2500
+ disconnect();
2501
+ }
2502
+
2478
2503
 
2479
2504
  }
2480
2505
  getRoomStatus = async data => {
@@ -2529,7 +2554,7 @@ class Video extends Component {
2529
2554
  this.setState({
2530
2555
  sessionType: false
2531
2556
  })
2532
- this.roomCallBack(2, '加载资源失败',-10)
2557
+ this.roomCallBack(2, '加载资源失败','SYS-01')
2533
2558
 
2534
2559
 
2535
2560
  })
@@ -2949,7 +2974,7 @@ class Video extends Component {
2949
2974
  }
2950
2975
  } catch (err) {
2951
2976
  if(err.status == 502 || err.status== 404) {
2952
- this.roomCallBack(2, '连接服务器失败',-11)
2977
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
2953
2978
  }
2954
2979
  }
2955
2980
  }
@@ -3111,7 +3136,7 @@ class Video extends Component {
3111
3136
  this.pictureInPicture('Refresh')
3112
3137
  } catch (err) {
3113
3138
  if(err.status == 502 || err.status== 404) {
3114
- this.roomCallBack(2, '连接服务器失败',-11)
3139
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
3115
3140
  }
3116
3141
  }
3117
3142
  }
@@ -3168,7 +3193,7 @@ class Video extends Component {
3168
3193
  }
3169
3194
  } catch (err) {
3170
3195
  if(err.status == 502 || err.status== 404) {
3171
- this.roomCallBack(2, '连接服务器失败',-11)
3196
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
3172
3197
  }
3173
3198
  }
3174
3199
  }