react_hsbc_teller 0.8.6 → 0.9.0

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.6",
3
+ "version": "0.9.0",
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';
@@ -1531,6 +1540,15 @@ class Video extends Component {
1531
1540
  // 加入房间成功
1532
1541
  this.test_controller.OnJoinRoomSucc = () => {
1533
1542
  console.log('加入房间成功')
1543
+ let publish_config = {}
1544
+ publish_config.media_type = 1
1545
+ publish_config.publish_device = 1
1546
+ publish_config.need_volume_analyser = true
1547
+ publish_config.video_profile_type = 3
1548
+ publish_config.publish_video_id = 'publish_video1'
1549
+ publish_config.publish_streamId_id = 'publish_streamId1'
1550
+ publish_config.publish_tag = 'tag1'
1551
+ this.test_controller.Publish(publish_config)
1534
1552
  this.roomCallBack(1, '',0)
1535
1553
  };
1536
1554
  // 加入房间失败
@@ -1574,6 +1592,7 @@ class Video extends Component {
1574
1592
  });
1575
1593
  }
1576
1594
  if(sid == document.getElementById('publish_video1').name) {
1595
+ this.enterRoom()
1577
1596
  this.timer = setInterval(
1578
1597
  () => {
1579
1598
  if(!this.state.voiceStatue) {
@@ -2448,6 +2467,23 @@ class Video extends Component {
2448
2467
  }
2449
2468
  }
2450
2469
  }
2470
+ enterRoom = async () =>{
2471
+ try {
2472
+ let result = await API.enterRoom({
2473
+ appAccount: this.props.tellerAccount,
2474
+ sessionId: this.state.sessionId,
2475
+ username: this.props.meetingInfo.host == '--' ? '' : this.props.meetingInfo.host,
2476
+ type: '2'
2477
+ });
2478
+ console.log(result);
2479
+ this.appGetUsername(document.getElementById('publish_video1').name)
2480
+ } catch (err) {
2481
+ console.error(err);
2482
+ if(err.status == 502 || err.status== 404) {
2483
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
2484
+ }
2485
+ }
2486
+ }
2451
2487
  contrastFaceVerify = async data => {
2452
2488
  console.log(data);
2453
2489
  try {
@@ -2475,14 +2511,13 @@ class Video extends Component {
2475
2511
  }
2476
2512
  };
2477
2513
  componentWillUnmount() {
2514
+ this.clearData()
2515
+
2516
+
2517
+ }
2518
+ clearData=()=>{
2478
2519
  if (this.state.roomCustomerList.length == 0 && this.state.sessionType) {
2479
- try {
2480
- let result = await API.finishSession({
2481
- sessionId: this.state.sessionId,
2482
- tellerId: this.props.tellerAccount
2483
- });
2484
- } catch (err) {
2485
- }
2520
+ this.finishSessionClick()
2486
2521
  }
2487
2522
  if (this.test_controller&&this.state.sessionType) {
2488
2523
  this.test_controller.LeaveRoom()
@@ -2499,22 +2534,45 @@ class Video extends Component {
2499
2534
  imJoinRoom: false,
2500
2535
  sessionType: false
2501
2536
  });
2537
+ this.timer && clearInterval(this.timer);
2502
2538
  this.setState = (state, callback) => {
2503
2539
  return
2504
2540
  }
2505
2541
  this.cancel = ''
2506
- this.timer && clearInterval(this.timer);
2507
2542
  }
2508
- finishSession = async () => {
2509
-
2510
-
2543
+ finishSessionClick= async () => {
2544
+ try {
2545
+ let result = await API.finishSession({
2546
+ sessionId: this.state.sessionId,
2547
+ tellerId: this.props.tellerAccount
2548
+ });
2549
+ } catch (err) {
2550
+ }
2551
+ }
2552
+ finishSession = () => {
2511
2553
  if(this.state.isSharedScreen) {
2512
- this.sharedScreen()
2554
+ this.test_controller.UnPublish(document.getElementById('video20').name)
2555
+ this.setState({
2556
+ publishDevic: 1,
2557
+ isSharedScreen: false,
2558
+ screenName: '投屏'
2559
+ });
2560
+ console.log(pictureInPictureVideo)
2561
+ this.tabTitlesClick('RMScreen', 'delect')
2562
+ if (this.state.isPictureInPicture) {
2563
+ document.exitPictureInPicture()
2564
+ }
2565
+ this.props.onLeaveRoom({
2566
+ code: LEAVE_TYPE.TELLER_EXIT,
2567
+ errMsg: '坐席退出'
2568
+ })
2569
+ } else {
2570
+ this.props.onLeaveRoom({
2571
+ code: LEAVE_TYPE.TELLER_EXIT,
2572
+ errMsg: '坐席退出'
2573
+ })
2513
2574
  }
2514
- this.props.onLeaveRoom({
2515
- code: LEAVE_TYPE.TELLER_EXIT,
2516
- errMsg: '坐席退出'
2517
- })
2575
+
2518
2576
  }
2519
2577
  getRoomStatus = async data => {
2520
2578
  try {
@@ -3080,9 +3138,13 @@ class Video extends Component {
3080
3138
  if (document.getElementById('video12').name == sid) {
3081
3139
  userId = this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById("feedId12").innerText).uid
3082
3140
  }
3141
+ if (document.getElementById('publish_video1').name == sid) {
3142
+ userId = this.props.tellerAccount
3143
+ }
3083
3144
  try {
3084
3145
  let result = await API.appGetUsername({
3085
- userId: userId
3146
+ userId: userId,
3147
+ sessionId: this.state.sessionId
3086
3148
  });
3087
3149
  console.log(result)
3088
3150
  let data
@@ -3091,6 +3153,11 @@ class Video extends Component {
3091
3153
  } else {
3092
3154
  this.messageClick('查询失败','error')
3093
3155
  }
3156
+ if (document.getElementById('publish_video1').name == sid) {
3157
+ this.setState({
3158
+ titleNameRm: data
3159
+ })
3160
+ }
3094
3161
  if (document.getElementById('video1').name == sid) {
3095
3162
 
3096
3163
  this.setState({
@@ -3482,7 +3549,7 @@ class Video extends Component {
3482
3549
  />
3483
3550
  }
3484
3551
  <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 : '客户经理1'}</div>
3552
+ <div className='titleName' style={{ color: this.props.titleColor, fontSize: this.props.fontSize + 'px', fontFamily: this.props.fontFamily }}>{this.state.titleNameRm}</div>
3486
3553
  </div>
3487
3554
  </div>
3488
3555
 
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>,