react_hsbc_teller 0.8.3 → 0.8.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": "0.8.3",
3
+ "version": "0.8.7",
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,16 @@ class Video extends Component {
2467
2501
  }
2468
2502
  }
2469
2503
  };
2470
- finishSession = async () => {
2471
-
2472
-
2504
+ componentWillUnmount() {
2473
2505
  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
- }
2506
+ this.finishSessionClick()
2507
+ }
2508
+ if (this.test_controller&&this.state.sessionType) {
2509
+ this.test_controller.LeaveRoom()
2510
+ this.test_controller.Disconnect()
2511
+ }
2512
+ if(this.state.imStatus) {
2513
+ disconnect();
2484
2514
  }
2485
2515
  this.setState({
2486
2516
  isCustomer: false,
@@ -2490,17 +2520,47 @@ class Video extends Component {
2490
2520
  imJoinRoom: false,
2491
2521
  sessionType: false
2492
2522
  });
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();
2523
+ this.setState = (state, callback) => {
2524
+ return
2525
+ }
2526
+ this.cancel = ''
2527
+ this.timer && clearInterval(this.timer);
2528
+ }
2529
+ finishSessionClick= async () => {
2530
+ try {
2531
+ let result = await API.finishSession({
2532
+ sessionId: this.state.sessionId,
2533
+ tellerId: this.props.tellerAccount
2534
+ });
2535
+ } catch (err) {
2536
+ }
2537
+ }
2538
+ finishSession = () => {
2539
+
2540
+
2541
+ if(this.state.isSharedScreen) {
2542
+ this.test_controller.UnPublish(document.getElementById('video20').name)
2543
+ this.setState({
2544
+ publishDevic: 1,
2545
+ isSharedScreen: false,
2546
+ screenName: '投屏'
2547
+ });
2548
+ console.log(pictureInPictureVideo)
2549
+ this.tabTitlesClick('RMScreen', 'delect')
2550
+ if (this.state.isPictureInPicture) {
2551
+ document.exitPictureInPicture()
2552
+ }
2553
+ this.props.onLeaveRoom({
2554
+ code: LEAVE_TYPE.TELLER_EXIT,
2555
+ errMsg: '坐席退出'
2556
+ })
2557
+ } else {
2558
+ this.props.onLeaveRoom({
2559
+ code: LEAVE_TYPE.TELLER_EXIT,
2560
+ errMsg: '坐席退出'
2561
+ })
2501
2562
  }
2502
2563
 
2503
-
2504
2564
  }
2505
2565
  getRoomStatus = async data => {
2506
2566
  try {
@@ -2548,13 +2608,15 @@ class Video extends Component {
2548
2608
  this.setState({
2549
2609
  loading: true,
2550
2610
  })
2611
+ const that = this
2551
2612
  axios.get(this.props.resourcePath + "/beauty/beauty.js")
2552
2613
  .then(response => this.addToScriptClick()).catch(function (error) {
2553
2614
  console.log(error);
2554
- this.setState({
2555
- sessionType: false
2615
+ that.setState({
2616
+ sessionType: false,
2617
+ loading: false
2556
2618
  })
2557
- this.roomCallBack(2, '加载资源失败','SYS-01')
2619
+ that.roomCallBack(2, '加载资源失败','SYS-01')
2558
2620
 
2559
2621
 
2560
2622
  })
@@ -2624,13 +2686,6 @@ class Video extends Component {
2624
2686
  }
2625
2687
  }
2626
2688
  }
2627
- componentWillUnmount() {
2628
- this.setState = (state, callback) => {
2629
- return
2630
- }
2631
- this.cancel = ''
2632
- this.timer && clearInterval(this.timer);
2633
- }
2634
2689
  componentWillMount() {
2635
2690
  if (this.props.sessionId) {
2636
2691
  this.getRoomStatus({
@@ -3026,6 +3081,7 @@ class Video extends Component {
3026
3081
  })
3027
3082
  }
3028
3083
  componentWillReceiveProps(props) {
3084
+ console.log('componentWillReceiveProps',props)
3029
3085
  this.setState({
3030
3086
  channelId: props.roomId,
3031
3087
  rtoken: props.mtoken,
@@ -3070,9 +3126,13 @@ class Video extends Component {
3070
3126
  if (document.getElementById('video12').name == sid) {
3071
3127
  userId = this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById("feedId12").innerText).uid
3072
3128
  }
3129
+ if (document.getElementById('publish_video1').name == sid) {
3130
+ userId = this.props.tellerAccount
3131
+ }
3073
3132
  try {
3074
3133
  let result = await API.appGetUsername({
3075
- userId: userId
3134
+ userId: userId,
3135
+ sessionId: this.state.sessionId
3076
3136
  });
3077
3137
  console.log(result)
3078
3138
  let data
@@ -3081,6 +3141,11 @@ class Video extends Component {
3081
3141
  } else {
3082
3142
  this.messageClick('查询失败','error')
3083
3143
  }
3144
+ if (document.getElementById('publish_video1').name == sid) {
3145
+ this.setState({
3146
+ titleNameRm: data
3147
+ })
3148
+ }
3084
3149
  if (document.getElementById('video1').name == sid) {
3085
3150
 
3086
3151
  this.setState({
@@ -3472,7 +3537,7 @@ class Video extends Component {
3472
3537
  />
3473
3538
  }
3474
3539
  <canvas style={{ display: (!this.state.voiceStatue) ? '' : 'none',width: '25px',height:'25px',marginTop: '4px' }} className="canvasClass" id="publish_volumeView" width="40" height="70"></canvas>
3475
- <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>
3540
+ <div className='titleName' style={{ color: this.props.titleColor, fontSize: this.props.fontSize + 'px', fontFamily: this.props.fontFamily }}>{this.state.titleNameRm}</div>
3476
3541
  </div>
3477
3542
  </div>
3478
3543
 
@@ -3959,6 +4024,10 @@ class Video extends Component {
3959
4024
  }
3960
4025
  }
3961
4026
  Video.defaultProps = {
4027
+ mtoken: "26364ded9b83",
4028
+ roomId: "645157287240850",
4029
+ imRoomId: "Fwua8kGB6@conference.openfire2.leimondata.cn",
4030
+ sessionId: "Fwua8kGB6",
3962
4031
  tellerAccount: 't001',
3963
4032
  businessNumber: '123',
3964
4033
  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>,