react_hsbc_teller 0.7.1 → 0.7.2

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.7.1",
3
+ "version": "0.7.2",
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
 
@@ -30,6 +30,10 @@ 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
+ }
33
37
  signCanvas = React.createRef();
34
38
  state = {
35
39
  isWhiteboard: false,
@@ -106,7 +110,8 @@ class Video extends Component {
106
110
  cameraValue: '',
107
111
  microphoneValue: '',
108
112
  imStatus: false,
109
- imJoinRoom: false
113
+ imJoinRoom: false,
114
+ analyserData: new Map(),
110
115
  };
111
116
  // eslint-disable-next-line no-undef
112
117
  test_controller = '';
@@ -546,80 +551,93 @@ class Video extends Component {
546
551
  if (document.getElementById('video1').name) {
547
552
  list.push({
548
553
  name: 'video1',
549
- title: this.state.videoOneName
554
+ title: this.state.videoOneName,
555
+ voice: 'voiceVideoOne'
550
556
  })
551
557
  }
552
558
  if (document.getElementById('publish_video1').name) {
553
559
  list.push({
554
560
  name: 'publish_video1',
555
- title: '坐席'
561
+ title: this.props.meetingInfo.host ? this.props.meetingInfo.host : '坐席',
562
+ voice: 'voiceStatue'
556
563
  })
557
564
  }
558
565
  if (document.getElementById('video2').name) {
559
566
  list.push({
560
567
  name: 'video2',
561
- title: this.state.videoTwoName
568
+ title: this.state.videoTwoName,
569
+ voice: 'voiceVideoTwo'
562
570
  })
563
571
  }
564
572
  if (document.getElementById('video3').name) {
565
573
  list.push({
566
574
  name: 'video3',
567
- title: this.state.videoThreeName
575
+ title: this.state.videoThreeName,
576
+ voice: 'voiceVideoThree'
568
577
  })
569
578
  }
570
579
  if (document.getElementById('video4').name) {
571
580
  list.push({
572
581
  name: 'video4',
573
- title: this.state.videoFourName
582
+ title: this.state.videoFourName,
583
+ voice: 'voiceVideoFour'
574
584
  })
575
585
  }
576
586
  if (document.getElementById('video5').name) {
577
587
  list.push({
578
588
  name: 'video5',
579
- title: this.state.videoFiveName
589
+ title: this.state.videoFiveName,
590
+ voice: 'voiceVideoFive'
580
591
  })
581
592
  }
582
593
  if (document.getElementById('video6').name) {
583
594
  list.push({
584
595
  name: 'video6',
585
- title: this.state.videoSixName
596
+ title: this.state.videoSixName,
597
+ voice: 'voiceVideoSix'
586
598
  })
587
599
  }
588
600
 
589
601
  if (document.getElementById('video7').name) {
590
602
  list.push({
591
603
  name: 'video7',
592
- title: this.state.videoSevenName
604
+ title: this.state.videoSevenName,
605
+ voice: 'voiceVideoSeven'
593
606
  })
594
607
  }
595
608
  if (document.getElementById('video8').name) {
596
609
  list.push({
597
610
  name: 'video8',
598
- title: this.state.videoEightName
611
+ title: this.state.videoEightName,
612
+ voice: 'voiceVideoEight'
599
613
  })
600
614
  }
601
615
  if (document.getElementById('video9').name) {
602
616
  list.push({
603
617
  name: 'video9',
604
- title: this.state.videoNineName
618
+ title: this.state.videoNineName,
619
+ voice: 'voiceVideoNine'
605
620
  })
606
621
  }
607
622
  if (document.getElementById('video10').name) {
608
623
  list.push({
609
624
  name: 'video10',
610
- title: this.state.videoTenName
625
+ title: this.state.videoTenName,
626
+ voice: 'voiceVideoTen'
611
627
  })
612
628
  }
613
629
  if (document.getElementById('video11').name) {
614
630
  list.push({
615
631
  name: 'video11',
616
- title: this.state.videoElevenName
632
+ title: this.state.videoElevenName,
633
+ voice: 'voiceVideoEleven'
617
634
  })
618
635
  }
619
636
  if (document.getElementById('video12').name) {
620
637
  list.push({
621
638
  name: 'video12',
622
- title: this.state.videoTwelveName
639
+ title: this.state.videoTwelveName,
640
+ voice: 'voiceVideoTwelve'
623
641
  })
624
642
  }
625
643
  console.log(list)
@@ -631,7 +649,7 @@ class Video extends Component {
631
649
  canvas.height = height;
632
650
 
633
651
  interval = setInterval(() => {
634
- cobj.clearRect(0, 0, width, height);
652
+ // cobj.clearRect(0, 0, width, height);
635
653
  for (let i = 0; i < list.length; i++) {
636
654
 
637
655
  let videoId = list[i].name;
@@ -655,20 +673,20 @@ class Video extends Component {
655
673
  cobj.stroke();
656
674
  cobj.beginPath();
657
675
  cobj.font = "28px auto";
658
- cobj.textAlign = 'center';
676
+ cobj.textAlign = 'left';
659
677
  cobj.lineWidth = 1;
660
678
  // 文字
661
679
  let str = list[i].title
662
680
  for (let k = 0; k < str.length; k++){
663
681
  // console.log(str.substring(0,k+1))
664
682
  // console.log(cobj.measureText(str.substring(0,k+1)).width)
665
- if (cobj.measureText(str.substring(0,k+1)).width>300){
683
+ if (cobj.measureText(str.substring(0,k+1)).width>240){
666
684
  str = str.substring(0,k-2)
667
685
  str += '...'
668
686
  break;
669
687
  }
670
688
  }
671
- cobj.strokeText(str, 150, 360 * (i + 1) - 20);
689
+ cobj.strokeText(str, 70, 360 * (i + 1) - 20);
672
690
  cobj.stroke();
673
691
  //左边框
674
692
  cobj.beginPath();
@@ -706,44 +724,60 @@ class Video extends Component {
706
724
  cobj.lineWidth = 5; //线的边框为10像素
707
725
  cobj.strokeStyle = '#d9363e';
708
726
  cobj.stroke(); //绘制定义的图形
727
+
728
+ // 绘制话筒图标
729
+ let microphoneSize = 50
730
+ var img = document.getElementById("icon_huatong");
731
+ var img1 = document.getElementById("icon_huatong_close");
732
+ if(this.state[list[i].voice]) {
733
+ cobj.drawImage(img1, 10, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
734
+ } else {
735
+ cobj.drawImage(img, 10, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
736
+
737
+ // 绘制实时音量
738
+ let sid = document.getElementById(list[i].name).name
739
+ let analyser = this.state.analyserData.get(sid)
740
+ aou(analyser)
741
+ // let sid = document.getElementById(list[i].name).name
742
+ // let stream = this.test_controller.GetMediaInfo(sid).audio_
743
+ // let acc = new AudioContext()
744
+ // let mic = acc.createMediaStreamSource(stream)
745
+ // let analyser = acc.createAnalyser()
746
+ // analyser.fftSize = 256
747
+ // mic.connect(analyser)
748
+ // aou(analyser)
749
+ // let microphoneSize = 50
750
+ // var img = document.getElementById("icon_huatong");
751
+ // cobj.drawImage(img, 600, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
752
+ function aou(analyser){
753
+ let dataArray = new Uint8Array(analyser.frequencyBinCount);
754
+ analyser.getByteFrequencyData(dataArray);
755
+ let step = Math.round(dataArray.length / 60); //采样步长
756
+ // 以画布左上角为坐标原点
757
+ let drawArea = {
758
+ x1: 28/50 * microphoneSize + 10, // 波动范围右下角的点坐标
759
+ y1: 25/50 * microphoneSize + 360 * (i + 1) - 60,
760
+ x2: 22/50 * microphoneSize + 10, // 波动范围左上角的点坐标
761
+ y2: 10/50 * microphoneSize + 360 * (i + 1) - 60,
762
+ }
763
+
764
+
765
+ for (var j = 0; j < 40; j++) {
766
+ let energy = (dataArray[step * j] / 256.0) * 80;
767
+ cobj.beginPath();
768
+ cobj.fillStyle = "#0AE544";
769
+ const { x1,y1,x2,y2} = drawArea
770
+ let width = x1-x2;
771
+ let height = (energy>20?(energy-20):0) * (y1 - y2 ) / 70
772
+ let startX = x2 // 绘制起始点x
773
+ let startY = y1 - height // 绘制起始点y
774
+ cobj.fillRect(startX, startY, width, height )
775
+ }
776
+ requestAnimationFrame(aou.bind(this, analyser));
709
777
 
710
- // let sid = document.getElementById(list[i].name).name
711
- // let stream = this.test_controller.GetMediaInfo(sid).audio_
712
- // let acc = new AudioContext()
713
- // let mic = acc.createMediaStreamSource(stream)
714
- // let analyser = acc.createAnalyser()
715
- // analyser.fftSize = 256
716
- // mic.connect(analyser)
717
- // aou(analyser)
718
- // let microphoneSize = this.props.microphoneSize
719
- // var img = document.getElementById("icon_huatong");
720
- // cobj.drawImage(img, 600, 360 * (i + 1) - 60, microphoneSize, microphoneSize);
721
- // function aou(analyser){
722
- // let dataArray = new Uint8Array(analyser.frequencyBinCount);
723
- // analyser.getByteFrequencyData(dataArray);
724
- // let step = Math.round(dataArray.length / 60); //采样步长
725
- // // 以画布左上角为坐标原点
726
- // let drawArea = {
727
- // x1: 28/50 * microphoneSize + 600, // 波动范围右下角的点坐标
728
- // y1: 25/50 * microphoneSize + 360 * (i + 1) - 60,
729
- // x2: 22/50 * microphoneSize + 600, // 波动范围左上角的点坐标
730
- // y2: 10/50 * microphoneSize + 360 * (i + 1) - 60,
731
- // }
732
-
733
- // for (var j = 0; j < 40; j++) {
734
- // let energy = (dataArray[step * j] / 256.0) * 80;
735
- // cobj.beginPath();
736
- // cobj.fillStyle = "#0AE544";
737
- // const { x1,y1,x2,y2} = drawArea
738
- // let width = x1-x2;
739
- // let height = (energy>20?(energy-20):0) * (y1 - y2 ) / 70
740
- // let startX = x2 // 绘制起始点x
741
- // let startY = y1 - height // 绘制起始点y
742
- // cobj.fillRect(startX, startY, width, height )
743
- // }
744
- // requestAnimationFrame(aou.bind(this, analyser));
745
-
746
- // }
778
+ }
779
+ }
780
+
747
781
  }
748
782
  }, 100);
749
783
  const captureStream = canvas.captureStream();
@@ -1080,6 +1114,7 @@ class Video extends Component {
1080
1114
  console.log('deviceId' + devicesInfo[i].deviceId);
1081
1115
 
1082
1116
  b.actionid = devicesInfo[i].deviceId;
1117
+ b.groupId = devicesInfo[i].groupId;
1083
1118
  if (
1084
1119
  devicesInfo[i].label === '' ||
1085
1120
  devicesInfo[i].label === undefined ||
@@ -1093,6 +1128,7 @@ class Video extends Component {
1093
1128
  } else if (devicesInfo[i].kind === 'audioinput') {
1094
1129
  // 麦克风
1095
1130
  b.actionid = devicesInfo[i].deviceId;
1131
+ b.groupId = devicesInfo[i].groupId;
1096
1132
  if (
1097
1133
  devicesInfo[i].label === '' ||
1098
1134
  devicesInfo[i].label === undefined ||
@@ -1106,6 +1142,7 @@ class Video extends Component {
1106
1142
  } else if (devicesInfo[i].kind === 'audiooutput') {
1107
1143
  // 喇叭
1108
1144
  b.actionid = devicesInfo[i].deviceId;
1145
+ b.groupId = devicesInfo[i].groupId;
1109
1146
  if (
1110
1147
  devicesInfo[i].label === '' ||
1111
1148
  devicesInfo[i].label === undefined ||
@@ -1118,10 +1155,34 @@ class Video extends Component {
1118
1155
  obj2.push(b)
1119
1156
  }
1120
1157
  }
1158
+ const objList = []
1159
+ const arr = {}
1160
+ const objList1 = []
1161
+ const arr1 = {}
1162
+ const objList2 = []
1163
+ const arr2 = {}
1164
+ for(var i =0; i<obj.length; i++){
1165
+ if(!arr[obj[i].groupId]){
1166
+ objList.push(obj[i]);
1167
+ arr[obj[i].groupId] = true;
1168
+ }
1169
+ }
1170
+ for(var i =0; i<obj1.length; i++){
1171
+ if(!arr1[obj1[i].groupId]){
1172
+ objList1.push(obj1[i]);
1173
+ arr1[obj1[i].groupId] = true;
1174
+ }
1175
+ }
1176
+ for(var i =0; i<obj2.length; i++){
1177
+ if(!arr2[obj2[i].groupId]){
1178
+ objList2.push(obj2[i]);
1179
+ arr2[obj2[i].groupId] = true;
1180
+ }
1181
+ }
1121
1182
  this.setState({
1122
- cameraList: obj,
1123
- microphoneList: obj1,
1124
- speakerList: obj2
1183
+ cameraList: objList,
1184
+ microphoneList: objList1,
1185
+ speakerList: [objList2[0]]
1125
1186
  })
1126
1187
  if (!this.state.appId) {
1127
1188
  this.mpaasSig(data);
@@ -1412,6 +1473,21 @@ class Video extends Component {
1412
1473
  // 推送“有新发布”给与会者
1413
1474
  this.test_controller.OnNewPublish = (feed) => {
1414
1475
  console.log('有新发布者', feed);
1476
+ // callNimIM('sendChatMsg', {
1477
+ // customId: feed.uid,
1478
+ // content: JSON.stringify({
1479
+ // 'typeId': 1014,
1480
+ // 'sessionId': this.state.sessionId,
1481
+ // 'meetingInfo': {
1482
+ // 'title': this.props.meetingInfo.title,
1483
+ // 'host': this.props.meetingInfo.host,
1484
+ // 'customers': this.props.meetingInfo.customers
1485
+ // }
1486
+
1487
+ // })
1488
+ // }, function (code, message, data) {
1489
+ // })
1490
+
1415
1491
  callNimIM('sendCustomCmdMsg', {
1416
1492
  customId: this.state.imRoomId,
1417
1493
  content: JSON.stringify({
@@ -2038,6 +2114,11 @@ class Video extends Component {
2038
2114
  ctx.fillRect(startX, startY, width, height)
2039
2115
  }
2040
2116
  requestAnimationFrame(this.test_controller.OnVolumeAnalyser.bind(this, sid, analyser));
2117
+
2118
+ this.state.analyserData.set(sid, analyser)
2119
+ this.setState({
2120
+ analyserData: this.state.analyserData
2121
+ })
2041
2122
  }
2042
2123
  // 停止共享
2043
2124
  this.test_controller.OnDesktopDisplayClosed = () => {
@@ -2195,6 +2276,12 @@ class Video extends Component {
2195
2276
  }
2196
2277
  }
2197
2278
  }
2279
+ componentWillUnmount() {
2280
+ this.setState = (state, callback) => {
2281
+ return
2282
+ }
2283
+ this.cancel('')
2284
+ }
2198
2285
  componentWillMount() {
2199
2286
  if (this.props.sessionId) {
2200
2287
  this.getRoomStatus({
@@ -2976,11 +3063,11 @@ class Video extends Component {
2976
3063
  <label className='labelClass'>{meetingInfo.title}</label>
2977
3064
  </li>
2978
3065
  <li>
2979
- <span>客户:</span>
3066
+ <span>客户经理:</span>
2980
3067
  <label className='labelClass'>{meetingInfo.host}</label>
2981
3068
  </li>
2982
3069
  <li>
2983
- <span>参会人:</span>
3070
+ <span>参会者:</span>
2984
3071
  {customerNameList}
2985
3072
  </li>
2986
3073
  </ul>
@@ -3014,7 +3101,7 @@ class Video extends Component {
3014
3101
  />
3015
3102
  }
3016
3103
  <canvas style={{ display: (!this.state.voiceStatue) ? '' : 'none',width: '25px',height:'25px',marginTop: '4px' }} className="canvasClass" id="publish_volumeView" width="40" height="70"></canvas>
3017
- <div className='titleName' style={{ color: this.props.titleColor, fontSize: this.props.fontSize + 'px', fontFamily: this.props.fontFamily }}>坐席</div>
3104
+ <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>
3018
3105
  </div>
3019
3106
  </div>
3020
3107
 
@@ -3357,6 +3444,7 @@ class Video extends Component {
3357
3444
 
3358
3445
  </div>
3359
3446
  <img id="icon_huatong" style={{ display: 'none' }} src={require("../../assets/img/icon_huatong.png").default}></img>
3447
+ <img id="icon_huatong_close" style={{ display: 'none' }} src={require("../../assets/img/jingyin.png").default}></img>
3360
3448
  </div>
3361
3449
  </div>
3362
3450
  <Foot
@@ -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') {
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>,