react_hsbc_teller 0.8.4 → 0.8.8

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.4",
3
+ "version": "0.8.8",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -1,6 +1,27 @@
1
1
  import Server from './server';
2
2
 
3
3
  class API extends Server{
4
+
5
+ async enterRoom(params = {}){
6
+ // return this.axios('get', '/lang/select/2', params);
7
+ try{
8
+ let result = await this.axios('post', '/hsbc/enterRoom', params);
9
+ console.log(result)
10
+ if(result && (result.data instanceof Object) && result.code === 200){
11
+ return result||[];
12
+ }else{
13
+ let err = {
14
+ tip: '服务异常',
15
+ response: result,
16
+ data: params,
17
+ // url: 'https://api.cangdu.org/shopro/data/products',
18
+ }
19
+ throw err;
20
+ }
21
+ }catch(err){
22
+ throw err;
23
+ }
24
+ }
4
25
  async sendEmail(params = {}){
5
26
  // return this.axios('get', '/lang/select/2', params);
6
27
  try{
@@ -24,7 +45,7 @@ class API extends Server{
24
45
  async appGetUsername(params = {}){
25
46
  // return this.axios('get', '/lang/select/2', params);
26
47
  try{
27
- let result = await this.axios('get', '/app/getUsername?userId=' + params.userId, params);
48
+ let result = await this.axios('get', '/app/getUsername?userId=' + params.userId+ '&sessionId=' + params.sessionId, params);
28
49
  console.log(result)
29
50
  if(result && (result.data instanceof Object) && result.code === 200){
30
51
  return result||[];
@@ -162,6 +162,15 @@ class Video extends Component {
162
162
  sessionId: result.sessionId,
163
163
  loading: false,
164
164
  });
165
+ let publish_config = {}
166
+ publish_config.media_type = 1
167
+ publish_config.publish_device = 1
168
+ publish_config.need_volume_analyser = true
169
+ publish_config.video_profile_type = 3
170
+ publish_config.publish_video_id = 'publish_video1'
171
+ publish_config.publish_streamId_id = 'publish_streamId1'
172
+ publish_config.publish_tag = 'tag1'
173
+ this.test_controller.Publish(publish_config)
165
174
  // eslint-disable-next-line no-undef
166
175
  if(this.state.imStatus) {
167
176
  joinRoom((this.props.tellerAccount + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), this.state.imRoomId)
@@ -230,7 +239,7 @@ class Video extends Component {
230
239
  if(err.status == 502 || err.status== 404) {
231
240
  this.roomCallBack(2, '连接服务器失败','SYS-02')
232
241
  } else {
233
- this.roomCallBack(2, '签名失败',8)
242
+ this.roomCallBack(2, '签名失败',6)
234
243
  }
235
244
 
236
245
  }
@@ -256,7 +265,7 @@ class Video extends Component {
256
265
  // 初始化视频
257
266
  ConnectMRTC = () => {
258
267
  const config_param = {};
259
- config_param.auto_publish_subscribe = 2;
268
+ config_param.auto_publish_subscribe = 4;
260
269
  config_param.media_type = 1;
261
270
  config_param.publish_device = 1;
262
271
  config_param.video_profile_type = '3';
@@ -615,7 +624,7 @@ class Video extends Component {
615
624
  if (document.getElementById('publish_video1').name) {
616
625
  list.push({
617
626
  name: 'publish_video1',
618
- title: this.props.meetingInfo.host ? this.props.meetingInfo.host : '坐席',
627
+ title: this.props.meetingInfo.host ? this.props.meetingInfo.host : '客户经理1',
619
628
  voice: 'voiceStatue',
620
629
  noVideo: false
621
630
  })
@@ -1330,7 +1339,7 @@ class Video extends Component {
1330
1339
  this.setState({
1331
1340
  sessionType: false
1332
1341
  })
1333
- this.roomCallBack(2, 'im建立连接失败',7)
1342
+ this.roomCallBack(2, 'im建立连接失败',5)
1334
1343
  } else {
1335
1344
  this.setState({
1336
1345
  imStatus: msg
@@ -1514,7 +1523,7 @@ class Video extends Component {
1514
1523
  this.setState({
1515
1524
  sessionType: false
1516
1525
  })
1517
- this.roomCallBack(2, '创建房间失败',4)
1526
+ this.roomCallBack(2, '创建房间失败',7)
1518
1527
  };
1519
1528
  // 初始化⾳视频成功
1520
1529
  this.test_controller.OnMediaCallSucc = (sid) => {
@@ -1547,7 +1556,14 @@ class Video extends Component {
1547
1556
  sessionId: '',
1548
1557
  imRoomId: ''
1549
1558
  });
1550
- this.addToScript()
1559
+
1560
+ this.test_controller.Disconnect()
1561
+ let data = {
1562
+ account: this.props.tellerAccount,
1563
+ type: '2',
1564
+ sigType: 1
1565
+ };
1566
+ this.mpaasSig(data);
1551
1567
  };
1552
1568
  // 发布媒体流成功
1553
1569
  this.test_controller.OnPublishSucc = (sid) => {
@@ -1567,6 +1583,7 @@ class Video extends Component {
1567
1583
  });
1568
1584
  }
1569
1585
  if(sid == document.getElementById('publish_video1').name) {
1586
+ this.enterRoom()
1570
1587
  this.timer = setInterval(
1571
1588
  () => {
1572
1589
  if(!this.state.voiceStatue) {
@@ -1594,7 +1611,7 @@ class Video extends Component {
1594
1611
  this.setState({
1595
1612
  sessionType: false
1596
1613
  })
1597
- this.roomCallBack(2, '发布失败',6)
1614
+ this.roomCallBack(2, '发布失败',4)
1598
1615
  };
1599
1616
  // 订阅媒体流成功
1600
1617
  this.test_controller.OnSubscribeSucc = (feed, sid) => {
@@ -2441,6 +2458,23 @@ class Video extends Component {
2441
2458
  }
2442
2459
  }
2443
2460
  }
2461
+ enterRoom = async () =>{
2462
+ try {
2463
+ let result = await API.enterRoom({
2464
+ appAccount: this.props.tellerAccount,
2465
+ sessionId: this.state.sessionId,
2466
+ username: this.props.meetingInfo.host == '--' ? '' : this.props.meetingInfo.host,
2467
+ type: '2'
2468
+ });
2469
+ console.log(result);
2470
+ this.appGetUsername(document.getElementById('publish_video1').name)
2471
+ } catch (err) {
2472
+ console.error(err);
2473
+ if(err.status == 502 || err.status== 404) {
2474
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
2475
+ }
2476
+ }
2477
+ }
2444
2478
  contrastFaceVerify = async data => {
2445
2479
  console.log(data);
2446
2480
  try {
@@ -2467,20 +2501,21 @@ class Video extends Component {
2467
2501
  }
2468
2502
  }
2469
2503
  };
2470
- finishSession = async () => {
2471
-
2472
-
2504
+ componentWillUnmount() {
2505
+ this.clearData()
2506
+
2507
+
2508
+ }
2509
+ clearData=()=>{
2473
2510
  if (this.state.roomCustomerList.length == 0 && this.state.sessionType) {
2474
- try {
2475
- let result = await API.finishSession({
2476
- sessionId: this.state.sessionId,
2477
- tellerId: this.props.tellerAccount
2478
- });
2479
- } catch (err) {
2480
- if(err.status == 502 || err.status== 404) {
2481
- this.roomCallBack(2, '连接服务器失败','SYS-02')
2482
- }
2483
- }
2511
+ this.finishSessionClick()
2512
+ }
2513
+ if (this.test_controller&&this.state.sessionType) {
2514
+ this.test_controller.LeaveRoom()
2515
+ this.test_controller.Disconnect()
2516
+ }
2517
+ if(this.state.imStatus) {
2518
+ disconnect();
2484
2519
  }
2485
2520
  this.setState({
2486
2521
  isCustomer: false,
@@ -2490,17 +2525,45 @@ class Video extends Component {
2490
2525
  imJoinRoom: false,
2491
2526
  sessionType: false
2492
2527
  });
2493
- this.props.onLeaveRoom({
2494
- code: LEAVE_TYPE.TELLER_EXIT,
2495
- errMsg: '坐席退出'
2496
- })
2497
- if(this.state.sessionType) {
2498
- this.test_controller.LeaveRoom()
2499
- this.test_controller.Disconnect()
2500
- disconnect();
2528
+ this.timer && clearInterval(this.timer);
2529
+ this.setState = (state, callback) => {
2530
+ return
2531
+ }
2532
+ this.cancel = ''
2533
+ }
2534
+ finishSessionClick= async () => {
2535
+ try {
2536
+ let result = await API.finishSession({
2537
+ sessionId: this.state.sessionId,
2538
+ tellerId: this.props.tellerAccount
2539
+ });
2540
+ } catch (err) {
2541
+ }
2542
+ }
2543
+ finishSession = () => {
2544
+ if(this.state.isSharedScreen) {
2545
+ this.test_controller.UnPublish(document.getElementById('video20').name)
2546
+ this.setState({
2547
+ publishDevic: 1,
2548
+ isSharedScreen: false,
2549
+ screenName: '投屏'
2550
+ });
2551
+ console.log(pictureInPictureVideo)
2552
+ this.tabTitlesClick('RMScreen', 'delect')
2553
+ if (this.state.isPictureInPicture) {
2554
+ document.exitPictureInPicture()
2555
+ }
2556
+ this.props.onLeaveRoom({
2557
+ code: LEAVE_TYPE.TELLER_EXIT,
2558
+ errMsg: '坐席退出'
2559
+ })
2560
+ } else {
2561
+ this.props.onLeaveRoom({
2562
+ code: LEAVE_TYPE.TELLER_EXIT,
2563
+ errMsg: '坐席退出'
2564
+ })
2501
2565
  }
2502
2566
 
2503
-
2504
2567
  }
2505
2568
  getRoomStatus = async data => {
2506
2569
  try {
@@ -2626,13 +2689,6 @@ class Video extends Component {
2626
2689
  }
2627
2690
  }
2628
2691
  }
2629
- componentWillUnmount() {
2630
- this.setState = (state, callback) => {
2631
- return
2632
- }
2633
- this.cancel = ''
2634
- this.timer && clearInterval(this.timer);
2635
- }
2636
2692
  componentWillMount() {
2637
2693
  if (this.props.sessionId) {
2638
2694
  this.getRoomStatus({
@@ -3028,6 +3084,7 @@ class Video extends Component {
3028
3084
  })
3029
3085
  }
3030
3086
  componentWillReceiveProps(props) {
3087
+ console.log('componentWillReceiveProps',props)
3031
3088
  this.setState({
3032
3089
  channelId: props.roomId,
3033
3090
  rtoken: props.mtoken,
@@ -3072,9 +3129,13 @@ class Video extends Component {
3072
3129
  if (document.getElementById('video12').name == sid) {
3073
3130
  userId = this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById("feedId12").innerText).uid
3074
3131
  }
3132
+ if (document.getElementById('publish_video1').name == sid) {
3133
+ userId = this.props.tellerAccount
3134
+ }
3075
3135
  try {
3076
3136
  let result = await API.appGetUsername({
3077
- userId: userId
3137
+ userId: userId,
3138
+ sessionId: this.state.sessionId
3078
3139
  });
3079
3140
  console.log(result)
3080
3141
  let data
@@ -3083,6 +3144,11 @@ class Video extends Component {
3083
3144
  } else {
3084
3145
  this.messageClick('查询失败','error')
3085
3146
  }
3147
+ if (document.getElementById('publish_video1').name == sid) {
3148
+ this.setState({
3149
+ titleNameRm: data
3150
+ })
3151
+ }
3086
3152
  if (document.getElementById('video1').name == sid) {
3087
3153
 
3088
3154
  this.setState({
@@ -3474,7 +3540,7 @@ class Video extends Component {
3474
3540
  />
3475
3541
  }
3476
3542
  <canvas style={{ display: (!this.state.voiceStatue) ? '' : 'none',width: '25px',height:'25px',marginTop: '4px' }} className="canvasClass" id="publish_volumeView" width="40" height="70"></canvas>
3477
- <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>
3543
+ <div className='titleName' style={{ color: this.props.titleColor, fontSize: this.props.fontSize + 'px', fontFamily: this.props.fontFamily }}>{this.state.titleNameRm}</div>
3478
3544
  </div>
3479
3545
  </div>
3480
3546
 
@@ -3961,6 +4027,10 @@ class Video extends Component {
3961
4027
  }
3962
4028
  }
3963
4029
  Video.defaultProps = {
4030
+ mtoken: "26364ded9b83",
4031
+ roomId: "645157287240850",
4032
+ imRoomId: "Fwua8kGB6@conference.openfire2.leimondata.cn",
4033
+ sessionId: "Fwua8kGB6",
3964
4034
  tellerAccount: 't001',
3965
4035
  businessNumber: '123',
3966
4036
  callbackUrl: 'http://47.102.126.132:8720/hsbc/callback',
package/src/index.js CHANGED
@@ -2,8 +2,8 @@ import React from "react";
2
2
  import ReactDOM from "react-dom";
3
3
  import "./index.less";
4
4
  import '@babel/polyfill';
5
- import { HSBC } from "../lib/hsbc";
6
- // import {HSBC} from "../packages";
5
+ // import { HSBC } from "../lib/hsbc";
6
+ import {HSBC} from "../packages";
7
7
 
8
8
  ReactDOM.render(
9
9
  <div className="hsbc"><HSBC></HSBC></div>,