react_hsbc_teller 0.6.9 → 0.7.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.6.9",
3
+ "version": "0.7.3",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -10,7 +10,7 @@ class Main extends Component {
10
10
  zh: {},
11
11
  }
12
12
  };
13
-
13
+
14
14
  // 获取语言包
15
15
  updateLanguage = async () => {
16
16
  let res = await API.selectLang()
@@ -32,7 +32,6 @@ class Main extends Component {
32
32
  // console.log(JSON.parse(localStorage.getItem("langData")))
33
33
  this.updateLanguage()
34
34
  }
35
-
36
35
  render() {
37
36
  const lang = this.props.lang
38
37
 
@@ -46,8 +45,8 @@ class Main extends Component {
46
45
  }
47
46
  Main.defaultProps = {
48
47
  lang: 'zh',
49
- baseURL: 'https://zuul.uat.dsp.hsbcfts.com.cn/wealth/zuul/api/leimon-counter-api',
50
- // baseURL:'https://counter-web.leimondata.cn:18082/api/leimon-counter-api',
48
+ // baseURL: 'https://zuul.uat.dsp.hsbcfts.com.cn/wealth/zuul/api/leimon-counter-api',
49
+ baseURL:'https://counter-web.leimondata.cn:18082/api/leimon-counter-api',
51
50
 
52
51
  }
53
52
  export default Main
@@ -30,6 +30,11 @@ const LEAVE_TYPE = {
30
30
  let pictureInPictureVideo = ''
31
31
  @injectIntl
32
32
  class Video extends Component {
33
+ constructor(props) {
34
+ super(props)
35
+ // this.cancel = axios.CancelToken.source()
36
+ }
37
+ cancel = axios.CancelToken.source()
33
38
  signCanvas = React.createRef();
34
39
  state = {
35
40
  isWhiteboard: false,
@@ -106,7 +111,8 @@ class Video extends Component {
106
111
  cameraValue: '',
107
112
  microphoneValue: '',
108
113
  imStatus: false,
109
- imJoinRoom: false
114
+ imJoinRoom: false,
115
+ analyserData: new Map(),
110
116
  };
111
117
  // eslint-disable-next-line no-undef
112
118
  test_controller = '';
@@ -179,6 +185,12 @@ class Video extends Component {
179
185
  appId: result.appId,
180
186
  bizName: result.bizName
181
187
  });
188
+ // const data1={
189
+ // hostname: 'im.uat.dsp.hsbcfts.com.cn',
190
+ // webPort: '443',
191
+ // account: 'web',
192
+ // openfireToken: '123'
193
+ // }
182
194
  window.sessionStorage.setItem('sigData', JSON.stringify(result));
183
195
  if (data.sigType == 1) {
184
196
  this.handleEdit()
@@ -191,6 +203,9 @@ class Video extends Component {
191
203
  handleEdit = () => {
192
204
  console.log(JSON.parse(window.sessionStorage.getItem('sigData')));
193
205
  // eslint-disable-next-line no-undef
206
+ // initWebSocket('wss://im.uat.dsp.hsbcfts.com.cn:443/wealth/im/ws/')
207
+ // initWebSocket('wss://' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname + ':' + '15603' + '/ws/');
208
+
194
209
  initWebSocket('wss://' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname + ':' + JSON.parse(window.sessionStorage.getItem('sigData')).webPort + '/ws/');
195
210
  const config_param = {};
196
211
  config_param.workspaceId = this.state.workSpaceId;
@@ -537,80 +552,93 @@ class Video extends Component {
537
552
  if (document.getElementById('video1').name) {
538
553
  list.push({
539
554
  name: 'video1',
540
- title: this.state.videoOneName
555
+ title: this.state.videoOneName,
556
+ voice: 'voiceVideoOne'
541
557
  })
542
558
  }
543
559
  if (document.getElementById('publish_video1').name) {
544
560
  list.push({
545
561
  name: 'publish_video1',
546
- title: '坐席'
562
+ title: this.props.meetingInfo.host ? this.props.meetingInfo.host : '坐席',
563
+ voice: 'voiceStatue'
547
564
  })
548
565
  }
549
566
  if (document.getElementById('video2').name) {
550
567
  list.push({
551
568
  name: 'video2',
552
- title: this.state.videoTwoName
569
+ title: this.state.videoTwoName,
570
+ voice: 'voiceVideoTwo'
553
571
  })
554
572
  }
555
573
  if (document.getElementById('video3').name) {
556
574
  list.push({
557
575
  name: 'video3',
558
- title: this.state.videoThreeName
576
+ title: this.state.videoThreeName,
577
+ voice: 'voiceVideoThree'
559
578
  })
560
579
  }
561
580
  if (document.getElementById('video4').name) {
562
581
  list.push({
563
582
  name: 'video4',
564
- title: this.state.videoFourName
583
+ title: this.state.videoFourName,
584
+ voice: 'voiceVideoFour'
565
585
  })
566
586
  }
567
587
  if (document.getElementById('video5').name) {
568
588
  list.push({
569
589
  name: 'video5',
570
- title: this.state.videoFiveName
590
+ title: this.state.videoFiveName,
591
+ voice: 'voiceVideoFive'
571
592
  })
572
593
  }
573
594
  if (document.getElementById('video6').name) {
574
595
  list.push({
575
596
  name: 'video6',
576
- title: this.state.videoSixName
597
+ title: this.state.videoSixName,
598
+ voice: 'voiceVideoSix'
577
599
  })
578
600
  }
579
601
 
580
602
  if (document.getElementById('video7').name) {
581
603
  list.push({
582
604
  name: 'video7',
583
- title: this.state.videoSevenName
605
+ title: this.state.videoSevenName,
606
+ voice: 'voiceVideoSeven'
584
607
  })
585
608
  }
586
609
  if (document.getElementById('video8').name) {
587
610
  list.push({
588
611
  name: 'video8',
589
- title: this.state.videoEightName
612
+ title: this.state.videoEightName,
613
+ voice: 'voiceVideoEight'
590
614
  })
591
615
  }
592
616
  if (document.getElementById('video9').name) {
593
617
  list.push({
594
618
  name: 'video9',
595
- title: this.state.videoNineName
619
+ title: this.state.videoNineName,
620
+ voice: 'voiceVideoNine'
596
621
  })
597
622
  }
598
623
  if (document.getElementById('video10').name) {
599
624
  list.push({
600
625
  name: 'video10',
601
- title: this.state.videoTenName
626
+ title: this.state.videoTenName,
627
+ voice: 'voiceVideoTen'
602
628
  })
603
629
  }
604
630
  if (document.getElementById('video11').name) {
605
631
  list.push({
606
632
  name: 'video11',
607
- title: this.state.videoElevenName
633
+ title: this.state.videoElevenName,
634
+ voice: 'voiceVideoEleven'
608
635
  })
609
636
  }
610
637
  if (document.getElementById('video12').name) {
611
638
  list.push({
612
639
  name: 'video12',
613
- title: this.state.videoTwelveName
640
+ title: this.state.videoTwelveName,
641
+ voice: 'voiceVideoTwelve'
614
642
  })
615
643
  }
616
644
  console.log(list)
@@ -622,7 +650,7 @@ class Video extends Component {
622
650
  canvas.height = height;
623
651
 
624
652
  interval = setInterval(() => {
625
- cobj.clearRect(0, 0, width, height);
653
+ // cobj.clearRect(0, 0, width, height);
626
654
  for (let i = 0; i < list.length; i++) {
627
655
 
628
656
  let videoId = list[i].name;
@@ -646,20 +674,20 @@ class Video extends Component {
646
674
  cobj.stroke();
647
675
  cobj.beginPath();
648
676
  cobj.font = "28px auto";
649
- cobj.textAlign = 'center';
677
+ cobj.textAlign = 'left';
650
678
  cobj.lineWidth = 1;
651
679
  // 文字
652
680
  let str = list[i].title
653
681
  for (let k = 0; k < str.length; k++){
654
682
  // console.log(str.substring(0,k+1))
655
683
  // console.log(cobj.measureText(str.substring(0,k+1)).width)
656
- if (cobj.measureText(str.substring(0,k+1)).width>300){
684
+ if (cobj.measureText(str.substring(0,k+1)).width>240){
657
685
  str = str.substring(0,k-2)
658
686
  str += '...'
659
687
  break;
660
688
  }
661
689
  }
662
- cobj.strokeText(str, 150, 360 * (i + 1) - 20);
690
+ cobj.strokeText(str, 70, 360 * (i + 1) - 20);
663
691
  cobj.stroke();
664
692
  //左边框
665
693
  cobj.beginPath();
@@ -697,44 +725,60 @@ class Video extends Component {
697
725
  cobj.lineWidth = 5; //线的边框为10像素
698
726
  cobj.strokeStyle = '#d9363e';
699
727
  cobj.stroke(); //绘制定义的图形
728
+
729
+ // 绘制话筒图标
730
+ let microphoneSize = 50
731
+ var img = document.getElementById("icon_huatong");
732
+ var img1 = document.getElementById("icon_huatong_close");
733
+ if(this.state[list[i].voice]) {
734
+ cobj.drawImage(img1, 10, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
735
+ } else {
736
+ cobj.drawImage(img, 10, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
737
+
738
+ // 绘制实时音量
739
+ let sid = document.getElementById(list[i].name).name
740
+ let analyser = this.state.analyserData.get(sid)
741
+ aou(analyser)
742
+ // let sid = document.getElementById(list[i].name).name
743
+ // let stream = this.test_controller.GetMediaInfo(sid).audio_
744
+ // let acc = new AudioContext()
745
+ // let mic = acc.createMediaStreamSource(stream)
746
+ // let analyser = acc.createAnalyser()
747
+ // analyser.fftSize = 256
748
+ // mic.connect(analyser)
749
+ // aou(analyser)
750
+ // let microphoneSize = 50
751
+ // var img = document.getElementById("icon_huatong");
752
+ // cobj.drawImage(img, 600, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
753
+ function aou(analyser){
754
+ let dataArray = new Uint8Array(analyser.frequencyBinCount);
755
+ analyser.getByteFrequencyData(dataArray);
756
+ let step = Math.round(dataArray.length / 60); //采样步长
757
+ // 以画布左上角为坐标原点
758
+ let drawArea = {
759
+ x1: 28/50 * microphoneSize + 10, // 波动范围右下角的点坐标
760
+ y1: 25/50 * microphoneSize + 360 * (i + 1) - 60,
761
+ x2: 22/50 * microphoneSize + 10, // 波动范围左上角的点坐标
762
+ y2: 10/50 * microphoneSize + 360 * (i + 1) - 60,
763
+ }
764
+
765
+
766
+ for (var j = 0; j < 40; j++) {
767
+ let energy = (dataArray[step * j] / 256.0) * 80;
768
+ cobj.beginPath();
769
+ cobj.fillStyle = "#0AE544";
770
+ const { x1,y1,x2,y2} = drawArea
771
+ let width = x1-x2;
772
+ let height = (energy>20?(energy-20):0) * (y1 - y2 ) / 70
773
+ let startX = x2 // 绘制起始点x
774
+ let startY = y1 - height // 绘制起始点y
775
+ cobj.fillRect(startX, startY, width, height )
776
+ }
777
+ requestAnimationFrame(aou.bind(this, analyser));
700
778
 
701
- // let sid = document.getElementById(list[i].name).name
702
- // let stream = this.test_controller.GetMediaInfo(sid).audio_
703
- // let acc = new AudioContext()
704
- // let mic = acc.createMediaStreamSource(stream)
705
- // let analyser = acc.createAnalyser()
706
- // analyser.fftSize = 256
707
- // mic.connect(analyser)
708
- // aou(analyser)
709
- // let microphoneSize = this.props.microphoneSize
710
- // var img = document.getElementById("icon_huatong");
711
- // cobj.drawImage(img, 600, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
712
- // function aou(analyser){
713
- // let dataArray = new Uint8Array(analyser.frequencyBinCount);
714
- // analyser.getByteFrequencyData(dataArray);
715
- // let step = Math.round(dataArray.length / 60); //采样步长
716
- // // 以画布左上角为坐标原点
717
- // let drawArea = {
718
- // x1: 28/50 * microphoneSize + 600, // 波动范围右下角的点坐标
719
- // y1: 25/50 * microphoneSize + 360 * (i + 1) - 60,
720
- // x2: 22/50 * microphoneSize + 600, // 波动范围左上角的点坐标
721
- // y2: 10/50 * microphoneSize + 360 * (i + 1) - 60,
722
- // }
723
-
724
- // for (var j = 0; j < 40; j++) {
725
- // let energy = (dataArray[step * j] / 256.0) * 80;
726
- // cobj.beginPath();
727
- // cobj.fillStyle = "#0AE544";
728
- // const { x1,y1,x2,y2} = drawArea
729
- // let width = x1-x2;
730
- // let height = (energy>20?(energy-20):0) * (y1 - y2 ) / 70
731
- // let startX = x2 // 绘制起始点x
732
- // let startY = y1 - height // 绘制起始点y
733
- // cobj.fillRect(startX, startY, width, height )
734
- // }
735
- // requestAnimationFrame(aou.bind(this, analyser));
736
-
737
- // }
779
+ }
780
+ }
781
+
738
782
  }
739
783
  }, 100);
740
784
  const captureStream = canvas.captureStream();
@@ -1071,6 +1115,7 @@ class Video extends Component {
1071
1115
  console.log('deviceId' + devicesInfo[i].deviceId);
1072
1116
 
1073
1117
  b.actionid = devicesInfo[i].deviceId;
1118
+ b.groupId = devicesInfo[i].groupId;
1074
1119
  if (
1075
1120
  devicesInfo[i].label === '' ||
1076
1121
  devicesInfo[i].label === undefined ||
@@ -1084,6 +1129,7 @@ class Video extends Component {
1084
1129
  } else if (devicesInfo[i].kind === 'audioinput') {
1085
1130
  // 麦克风
1086
1131
  b.actionid = devicesInfo[i].deviceId;
1132
+ b.groupId = devicesInfo[i].groupId;
1087
1133
  if (
1088
1134
  devicesInfo[i].label === '' ||
1089
1135
  devicesInfo[i].label === undefined ||
@@ -1097,6 +1143,7 @@ class Video extends Component {
1097
1143
  } else if (devicesInfo[i].kind === 'audiooutput') {
1098
1144
  // 喇叭
1099
1145
  b.actionid = devicesInfo[i].deviceId;
1146
+ b.groupId = devicesInfo[i].groupId;
1100
1147
  if (
1101
1148
  devicesInfo[i].label === '' ||
1102
1149
  devicesInfo[i].label === undefined ||
@@ -1109,10 +1156,34 @@ class Video extends Component {
1109
1156
  obj2.push(b)
1110
1157
  }
1111
1158
  }
1159
+ const objList = []
1160
+ const arr = {}
1161
+ const objList1 = []
1162
+ const arr1 = {}
1163
+ const objList2 = []
1164
+ const arr2 = {}
1165
+ for(var i =0; i<obj.length; i++){
1166
+ if(!arr[obj[i].groupId]){
1167
+ objList.push(obj[i]);
1168
+ arr[obj[i].groupId] = true;
1169
+ }
1170
+ }
1171
+ for(var i =0; i<obj1.length; i++){
1172
+ if(!arr1[obj1[i].groupId]){
1173
+ objList1.push(obj1[i]);
1174
+ arr1[obj1[i].groupId] = true;
1175
+ }
1176
+ }
1177
+ for(var i =0; i<obj2.length; i++){
1178
+ if(!arr2[obj2[i].groupId]){
1179
+ objList2.push(obj2[i]);
1180
+ arr2[obj2[i].groupId] = true;
1181
+ }
1182
+ }
1112
1183
  this.setState({
1113
- cameraList: obj,
1114
- microphoneList: obj1,
1115
- speakerList: obj2
1184
+ cameraList: objList,
1185
+ microphoneList: objList1,
1186
+ speakerList: [objList2[0]]
1116
1187
  })
1117
1188
  if (!this.state.appId) {
1118
1189
  this.mpaasSig(data);
@@ -1403,6 +1474,21 @@ class Video extends Component {
1403
1474
  // 推送“有新发布”给与会者
1404
1475
  this.test_controller.OnNewPublish = (feed) => {
1405
1476
  console.log('有新发布者', feed);
1477
+ // callNimIM('sendChatMsg', {
1478
+ // customId: feed.uid,
1479
+ // content: JSON.stringify({
1480
+ // 'typeId': 1014,
1481
+ // 'sessionId': this.state.sessionId,
1482
+ // 'meetingInfo': {
1483
+ // 'title': this.props.meetingInfo.title,
1484
+ // 'host': this.props.meetingInfo.host,
1485
+ // 'customers': this.props.meetingInfo.customers
1486
+ // }
1487
+
1488
+ // })
1489
+ // }, function (code, message, data) {
1490
+ // })
1491
+
1406
1492
  callNimIM('sendCustomCmdMsg', {
1407
1493
  customId: this.state.imRoomId,
1408
1494
  content: JSON.stringify({
@@ -2029,6 +2115,11 @@ class Video extends Component {
2029
2115
  ctx.fillRect(startX, startY, width, height)
2030
2116
  }
2031
2117
  requestAnimationFrame(this.test_controller.OnVolumeAnalyser.bind(this, sid, analyser));
2118
+
2119
+ this.state.analyserData.set(sid, analyser)
2120
+ this.setState({
2121
+ analyserData: this.state.analyserData
2122
+ })
2032
2123
  }
2033
2124
  // 停止共享
2034
2125
  this.test_controller.OnDesktopDisplayClosed = () => {
@@ -2186,6 +2277,12 @@ class Video extends Component {
2186
2277
  }
2187
2278
  }
2188
2279
  }
2280
+ componentWillUnmount() {
2281
+ this.setState = (state, callback) => {
2282
+ return
2283
+ }
2284
+ this.cancel = ''
2285
+ }
2189
2286
  componentWillMount() {
2190
2287
  if (this.props.sessionId) {
2191
2288
  this.getRoomStatus({
@@ -2967,11 +3064,11 @@ class Video extends Component {
2967
3064
  <label className='labelClass'>{meetingInfo.title}</label>
2968
3065
  </li>
2969
3066
  <li>
2970
- <span>客户:</span>
3067
+ <span>客户经理:</span>
2971
3068
  <label className='labelClass'>{meetingInfo.host}</label>
2972
3069
  </li>
2973
3070
  <li>
2974
- <span>参会人:</span>
3071
+ <span>参会者:</span>
2975
3072
  {customerNameList}
2976
3073
  </li>
2977
3074
  </ul>
@@ -3005,7 +3102,7 @@ class Video extends Component {
3005
3102
  />
3006
3103
  }
3007
3104
  <canvas style={{ display: (!this.state.voiceStatue) ? '' : 'none',width: '25px',height:'25px',marginTop: '4px' }} className="canvasClass" id="publish_volumeView" width="40" height="70"></canvas>
3008
- <div className='titleName' style={{ color: this.props.titleColor, fontSize: this.props.fontSize + 'px', fontFamily: this.props.fontFamily }}>坐席</div>
3105
+ <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>
3009
3106
  </div>
3010
3107
  </div>
3011
3108
 
@@ -3348,6 +3445,7 @@ class Video extends Component {
3348
3445
 
3349
3446
  </div>
3350
3447
  <img id="icon_huatong" style={{ display: 'none' }} src={require("../../assets/img/icon_huatong.png").default}></img>
3448
+ <img id="icon_huatong_close" style={{ display: 'none' }} src={require("../../assets/img/jingyin.png").default}></img>
3351
3449
  </div>
3352
3450
  </div>
3353
3451
  <Foot
@@ -3477,11 +3575,11 @@ Video.defaultProps = {
3477
3575
  tellerAccount: 't001',
3478
3576
  businessNumber: '123',
3479
3577
  callbackUrl: 'http://47.102.126.132:8720/hsbc/callback',
3480
- roomServerUrl: 'wss://app.uat.dsp.hsbcfts.com.cn/mpaas/mrtc/ws',
3481
- // roomServerUrl: 'wss://mrtc.mpaas.cn-hangzhou.aliyuncs.com/ws',
3578
+ // roomServerUrl: 'wss://app.uat.dsp.hsbcfts.com.cn/mpaas/mrtc/ws',
3579
+ roomServerUrl: 'wss://mrtc.mpaas.cn-hangzhou.aliyuncs.com/ws',
3482
3580
 
3483
- // resourcePath: 'https://counter-web.leimondata.cn:7199',
3484
- resourcePath: 'https://zuul.uat.dsp.hsbcfts.com.cn/wealth/js/',
3581
+ resourcePath: 'https://counter-web.leimondata.cn:7199',
3582
+ // resourcePath: 'https://zuul.uat.dsp.hsbcfts.com.cn/wealth/js/',
3485
3583
  prohbiitPrompt: '当前无客户',
3486
3584
  voiceColor: '#0AE544',
3487
3585
  titleBackground: 'rgba(0,0,0,0.65)',
@@ -24,8 +24,8 @@ function callNimIM(method, json, callback) {
24
24
  const callId = _generateId()
25
25
 
26
26
  callbackRegister.set(callId, fn)
27
- if (method == 'sendGroupMsg') {
28
- sendMessage(json.groupId, (JSON.parse(window.sessionStorage.getItem('sigData')).account + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), 'groupchat', json.content)
27
+ if (method == 'sendChatMsg') {
28
+ sendMessage(json.customId, (JSON.parse(window.sessionStorage.getItem('sigData')).account + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), 'chat', json.content)
29
29
  } else if (method == 'sendCustomCmdMsg') {
30
30
  sendMessage(json.customId, (JSON.parse(window.sessionStorage.getItem('sigData')).account + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), 'groupchat', json.content)
31
31
  } else if (method == 'transfer' || method == 'transferreject' || method == 'transferagree') {