react_hsbc_teller 0.8.5 → 0.8.9

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.5",
3
+ "version": "0.8.9",
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||[];
@@ -250,5 +250,6 @@ function joinRoom(from, to) {
250
250
  export {
251
251
  initWebSocket,
252
252
  sendMessage,
253
+ disconnect,
253
254
  joinRoom
254
255
  }
@@ -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)
@@ -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
  })
@@ -1574,6 +1583,7 @@ class Video extends Component {
1574
1583
  });
1575
1584
  }
1576
1585
  if(sid == document.getElementById('publish_video1').name) {
1586
+ this.enterRoom()
1577
1587
  this.timer = setInterval(
1578
1588
  () => {
1579
1589
  if(!this.state.voiceStatue) {
@@ -2448,6 +2458,23 @@ class Video extends Component {
2448
2458
  }
2449
2459
  }
2450
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
+ }
2451
2478
  contrastFaceVerify = async data => {
2452
2479
  console.log(data);
2453
2480
  try {
@@ -2474,20 +2501,21 @@ class Video extends Component {
2474
2501
  }
2475
2502
  }
2476
2503
  };
2477
- finishSession = async () => {
2478
-
2479
-
2504
+ componentWillUnmount() {
2505
+ this.clearData()
2506
+
2507
+
2508
+ }
2509
+ clearData=()=>{
2480
2510
  if (this.state.roomCustomerList.length == 0 && this.state.sessionType) {
2481
- try {
2482
- let result = await API.finishSession({
2483
- sessionId: this.state.sessionId,
2484
- tellerId: this.props.tellerAccount
2485
- });
2486
- } catch (err) {
2487
- if(err.status == 502 || err.status== 404) {
2488
- this.roomCallBack(2, '连接服务器失败','SYS-02')
2489
- }
2490
- }
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();
2491
2519
  }
2492
2520
  this.setState({
2493
2521
  isCustomer: false,
@@ -2497,17 +2525,45 @@ class Video extends Component {
2497
2525
  imJoinRoom: false,
2498
2526
  sessionType: false
2499
2527
  });
2500
- this.props.onLeaveRoom({
2501
- code: LEAVE_TYPE.TELLER_EXIT,
2502
- errMsg: '坐席退出'
2503
- })
2504
- if(this.state.sessionType) {
2505
- this.test_controller.LeaveRoom()
2506
- this.test_controller.Disconnect()
2507
- 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
+ })
2508
2565
  }
2509
2566
 
2510
-
2511
2567
  }
2512
2568
  getRoomStatus = async data => {
2513
2569
  try {
@@ -2633,13 +2689,6 @@ class Video extends Component {
2633
2689
  }
2634
2690
  }
2635
2691
  }
2636
- componentWillUnmount() {
2637
- this.setState = (state, callback) => {
2638
- return
2639
- }
2640
- this.cancel = ''
2641
- this.timer && clearInterval(this.timer);
2642
- }
2643
2692
  componentWillMount() {
2644
2693
  if (this.props.sessionId) {
2645
2694
  this.getRoomStatus({
@@ -3080,9 +3129,13 @@ class Video extends Component {
3080
3129
  if (document.getElementById('video12').name == sid) {
3081
3130
  userId = this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById("feedId12").innerText).uid
3082
3131
  }
3132
+ if (document.getElementById('publish_video1').name == sid) {
3133
+ userId = this.props.tellerAccount
3134
+ }
3083
3135
  try {
3084
3136
  let result = await API.appGetUsername({
3085
- userId: userId
3137
+ userId: userId,
3138
+ sessionId: this.state.sessionId
3086
3139
  });
3087
3140
  console.log(result)
3088
3141
  let data
@@ -3091,6 +3144,11 @@ class Video extends Component {
3091
3144
  } else {
3092
3145
  this.messageClick('查询失败','error')
3093
3146
  }
3147
+ if (document.getElementById('publish_video1').name == sid) {
3148
+ this.setState({
3149
+ titleNameRm: data
3150
+ })
3151
+ }
3094
3152
  if (document.getElementById('video1').name == sid) {
3095
3153
 
3096
3154
  this.setState({
@@ -3482,7 +3540,7 @@ class Video extends Component {
3482
3540
  />
3483
3541
  }
3484
3542
  <canvas style={{ display: (!this.state.voiceStatue) ? '' : 'none',width: '25px',height:'25px',marginTop: '4px' }} className="canvasClass" id="publish_volumeView" width="40" height="70"></canvas>
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 : '坐席'}</div>
3543
+ <div className='titleName' style={{ color: this.props.titleColor, fontSize: this.props.fontSize + 'px', fontFamily: this.props.fontFamily }}>{this.state.titleNameRm}</div>
3486
3544
  </div>
3487
3545
  </div>
3488
3546
 
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>,