react_hsbc_teller 0.3.3 → 0.3.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.3.3",
3
+ "version": "0.3.7",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -3,10 +3,6 @@ import './foot.less'
3
3
  import Popover from "antd/lib/popover";
4
4
  import 'antd/lib/popover/style'
5
5
  export default class foot extends Component {
6
- state = {
7
- clicked: false,
8
- clickedOcr: false
9
- }
10
6
  voice = () => {
11
7
  this.props.voice()
12
8
  }
@@ -26,15 +22,9 @@ export default class foot extends Component {
26
22
  this.props.endSession()
27
23
  }
28
24
  facialRecognition=()=>{
29
- this.setState({
30
- clicked: true
31
- })
32
25
  this.props.facialRecognition()
33
26
  }
34
27
  ocrClick=()=>{
35
- this.setState({
36
- clickedOcr: true
37
- })
38
28
  this.props.ocrClick()
39
29
  }
40
30
  pictureInPicture=()=>{
@@ -44,17 +34,21 @@ export default class foot extends Component {
44
34
  this.props.invitationClick()
45
35
  }
46
36
  customerFaceClick=(item)=>{
47
- this.setState({
48
- clicked: false,
49
- clickedOcr: false
50
- })
51
37
  this.props.customerFaceClick(item)
52
38
  }
53
39
  switchExternal=()=>{
54
40
  this.props.switchExternal()
55
41
  }
42
+ facialHandleVisibleChange = visible => {
43
+ console.log(visible)
44
+ this.props.facialHandleVisibleChange(visible)
45
+ };
46
+ ocrHandleVisibleChange = visible => {
47
+ console.log(visible)
48
+ this.props.ocrHandleVisibleChange(visible)
49
+ };
56
50
  render() {
57
- const {isTranscribing,img,cameraImg,screenName,suspendName,customerList} = this.props
51
+ const {clickedOcr,clickedFacial,isTranscribing,img,cameraImg,screenName,suspendName,customerList} = this.props
58
52
  const content = (
59
53
  <div>
60
54
  {customerList.map((item)=>{
@@ -111,7 +105,7 @@ export default class foot extends Component {
111
105
  {suspendName}
112
106
  </div>
113
107
  </div> */}
114
- <Popover content={content} trigger="click" visible={this.state.clicked}>
108
+ <Popover content={content} trigger="click" visible={clickedFacial} onVisibleChange={this.facialHandleVisibleChange}>
115
109
  <div className="one" onClick={this.facialRecognition.bind(this)}>
116
110
  <img className="imgClass" src={require("../../assets/img/Face_recognition.png").default} alt="" />
117
111
  <div className="text">
@@ -126,7 +120,7 @@ export default class foot extends Component {
126
120
  邀请
127
121
  </div>
128
122
  </div>
129
- <Popover content={content} trigger="click" visible={this.state.clickedOcr}>
123
+ <Popover content={content} trigger="click" visible={clickedOcr} onVisibleChange={this.ocrHandleVisibleChange}>
130
124
  <div className="one" onClick={this.ocrClick.bind(this)}>
131
125
  <img className="imgClass" src={require("../../assets/img/icon_ocr.png").default} alt="" />
132
126
  <div className="text">
@@ -1,11 +1,11 @@
1
1
  .foot{
2
2
  background: #fff;
3
- height: 80px;
3
+ height: 78px;
4
4
  display: inline-flex;
5
5
  width: 100%;
6
- position: absolute;
7
- bottom: 0;
8
- left: 0;
6
+ // position: absolute;
7
+ // bottom: 0;
8
+ // left: 0;
9
9
  }
10
10
  .total{
11
11
  display: inline-flex;
@@ -69,6 +69,8 @@ class Video extends Component {
69
69
  sessionId: this.props.sessionId,
70
70
  imRoomId: this.props.imRoomId,
71
71
  isPictureInPicture: false,
72
+ clickedFacial: false,
73
+ clickedOcr: false
72
74
  };
73
75
  // eslint-disable-next-line no-undef
74
76
  test_controller = '';
@@ -143,8 +145,8 @@ class Video extends Component {
143
145
  config_param.workspaceId = this.state.workSpaceId;
144
146
  config_param.uid = this.props.tellerAccount;
145
147
  config_param.biz_name = this.state.bizName; // 'demo'
146
- config_param.appId = this.state.appId;
147
-
148
+ config_param.sub_biz = this.state.appId;
149
+ config_param.sign = window.sessionStorage.getItem('alimpassSig')
148
150
  config_param.room_server_url = this.props.roomServerUrl;
149
151
  // 允许最大断网时间 (超过未重连, 直接关闭)
150
152
  config_param.network_check_timeout = 10000;
@@ -156,7 +158,7 @@ class Video extends Component {
156
158
  config_param.auto_publish_subscribe = 3;
157
159
  config_param.media_type = 1;
158
160
  config_param.publish_device = 1;
159
- config_param.video_profile_type = '5';
161
+ config_param.video_profile_type = '3';
160
162
  config_param.need_volume_analyser = true;
161
163
  // config_param.audioSource = that.microphone[0].actionid
162
164
  // config_param.videoSource = that.checkOne[0]
@@ -324,7 +326,7 @@ class Video extends Component {
324
326
  }
325
327
  }
326
328
  // 获取人员客户列表
327
- selectCustomer = () => {
329
+ selectCustomer = (val) => {
328
330
  const list = []
329
331
  if (document.getElementById('video1').name) {
330
332
  console.log(this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById("feedId1").innerText))
@@ -380,24 +382,41 @@ class Video extends Component {
380
382
  name: '客户6'
381
383
  })
382
384
  }
385
+ if(list.length > 0) {
386
+ if(val == 'ocr') {
387
+ this.setState({
388
+ clickedOcr: true
389
+ })
390
+ } else if(val == 'facial'){
391
+ this.setState({
392
+ clickedFacial: true
393
+ })
394
+ }
395
+ } else {
396
+ message.success('当前暂无客户')
397
+ }
383
398
  this.setState({
384
399
  customerList: list
385
400
  })
386
401
  }
387
402
  // 人脸识别
388
403
  facialRecognition = () => {
404
+ if (this.isFileSuccuse()) {
389
405
  this.setState({
390
406
  faceCustomerType: 1,
391
407
  titleModal: '人脸识别'
392
408
  })
393
- this.selectCustomer()
409
+ this.selectCustomer('facial')
410
+ }
394
411
  };
395
412
  ocrClick = () => {
413
+ if (this.isFileSuccuse()) {
396
414
  this.setState({
397
415
  faceCustomerType: 2,
398
416
  titleModal: 'OCR识别'
399
417
  })
400
- this.selectCustomer()
418
+ this.selectCustomer('ocr')
419
+ }
401
420
  };
402
421
  endSessionValue = () => {
403
422
  this.test_controller.LeaveRoom()
@@ -409,7 +428,7 @@ class Video extends Component {
409
428
  this.setState({ isBigVideo: 'video1' })
410
429
  }
411
430
  } else if (val == 'isLangPublishVideo1') {
412
- if (document.getElementById('publish_video1').name) {
431
+ if (document.getElementById('publish_video1').name && this.state.isCustomer) {
413
432
  this.setState({ isBigVideo: 'publish_video1' })
414
433
  }
415
434
  } else if (val == 'isLangVideo2') {
@@ -763,6 +782,7 @@ class Video extends Component {
763
782
  // 推送“新加⼊房间者”给与会者
764
783
  this.test_controller.OnNewJoinerIn = (participant) => {
765
784
  console.log('新加⼊房间者', participant);
785
+ this.test_controller.ChangeStreamSize(document.getElementById('publish_video1').name, 5)
766
786
  this.setState(
767
787
  {
768
788
  isCustomer: true
@@ -1040,6 +1060,8 @@ class Video extends Component {
1040
1060
  return;
1041
1061
  }
1042
1062
  let canvas = document.getElementById(volumeView);
1063
+ canvas.width = this.props.microphoneSize
1064
+ canvas.height = this.props.microphoneSize
1043
1065
  let ctx = canvas.getContext("2d");
1044
1066
 
1045
1067
  let outcanvas = document.createElement("canvas");
@@ -1048,44 +1070,100 @@ class Video extends Component {
1048
1070
  ctx.strokeStyle = "#db0011";
1049
1071
  ctx.lineWidth = 2;
1050
1072
  ctx.clearRect(0, 0, canvas.width, canvas.height); //清理画布
1073
+ // ctx.fillStyle ='rgba(0, 0, 0, 0.2)';
1074
+ // ctx.fillRect(0, 0, canvas.width, canvas.height, )
1051
1075
  let dataArray = new Uint8Array(analyser.frequencyBinCount);
1052
1076
  analyser.getByteFrequencyData(dataArray);
1053
1077
  let step = Math.round(dataArray.length / 60); //采样步长
1078
+ var img = document.getElementById("icon_huatong");
1079
+ ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
1080
+ // 以画布左上角为坐标原点
1081
+ let drawArea = {
1082
+ x1: 28/50*canvas.width, // 波动范围右下角的点坐标
1083
+ y1: 25/50*canvas.height,
1084
+ x2: 22/50*canvas.width, // 波动范围左上角的点坐标
1085
+ y2: 10/50*canvas.height,
1086
+ }
1087
+
1054
1088
  for (var i = 0; i < 40; i++) {
1055
1089
  let energy = (dataArray[step * i] / 256.0) * 80;
1056
- for (var j = 0; j < energy; j++) {
1057
- ctx.beginPath();
1058
- ctx.moveTo(20 * i + 2, 200 + 4 * j);
1059
- ctx.lineTo(20 * (i + 1) - 2, 200 + 4 * j);
1060
- ctx.stroke();
1061
- ctx.beginPath();
1062
- ctx.moveTo(20 * i + 2, 200 - 4 * j);
1063
- ctx.lineTo(20 * (i + 1) - 2, 200 - 4 * j);
1064
- ctx.stroke();
1065
- }
1066
1090
  ctx.beginPath();
1067
- ctx.moveTo(20 * i + 2, 200);
1068
- ctx.lineTo(20 * (i + 1) - 2, 200);
1069
- ctx.stroke();
1091
+ ctx.fillStyle = this.props.voiceColor;
1092
+ const { x1,y1,x2,y2} = drawArea
1093
+ let width = x1-x2;
1094
+ let height = (energy>20?(energy-20):0) * (y1 - y2 ) / 70
1095
+ let startX = x2 // 绘制起始点x
1096
+ let startY = y1 - height // 绘制起始点y
1097
+ ctx.fillRect(startX, startY, width, height )
1070
1098
  }
1071
1099
 
1072
1100
  //制造半透明投影
1073
1101
  function draw() {
1074
- ctx.drawImage(outcanvas, 0, 0);
1075
- ctx.save();
1076
- ctx.translate(canvas.width / 4, canvas.height / 2);
1077
- ctx.rotate(Math.PI);
1078
- ctx.scale(-1, 1);
1079
- ctx.drawImage(outcanvas, -canvas.width / 2, -canvas.height / 2);
1080
- ctx.restore();
1081
- ctx.fillStyle = 'rgba(192,192,192, .0)';
1082
- ctx.fillRect(0, 0, canvas.width, canvas.height);
1102
+ ctx.drawImage(outcanvas, 0, 0);
1103
+ ctx.save();
1104
+ ctx.translate(canvas.width / 2, canvas.height / 2);
1105
+ ctx.rotate(Math.PI);
1106
+ ctx.scale(-1, 1);
1107
+ ctx.drawImage(outcanvas, -canvas.width / 2, -canvas.height / 2);
1108
+ ctx.restore();
1109
+ ctx.fillStyle = 'rgba(192,192,192, .0)';
1110
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
1083
1111
  }
1084
1112
 
1085
1113
  draw();
1086
1114
  requestAnimationFrame(this.test_controller.OnVolumeAnalyser.bind(this, sid, analyser));
1087
- }
1115
+ // let canvas = document.getElementById(volumeView);
1116
+ // let ctx = canvas.getContext("2d");
1117
+
1118
+ // let outcanvas = document.createElement("canvas");
1119
+ // outcanvas.width = canvas.width;
1120
+ // outcanvas.height = canvas.height;
1121
+ // ctx.strokeStyle = this.props.voiceColor;
1122
+ // ctx.lineWidth = 2;
1123
+ // ctx.clearRect(0, 0, canvas.width, canvas.height); //清理画布
1124
+ // let dataArray = new Uint8Array(analyser.frequencyBinCount);
1125
+ // analyser.getByteFrequencyData(dataArray);
1126
+ // let step = Math.round(dataArray.length / 60); //采样步长
1127
+ // for (var i = 0; i < 40; i++) {
1128
+ // let energy = (dataArray[step * i] / 256.0) * 50;
1129
+ // for (var j = 0; j < energy; j++) {
1130
+ // ctx.beginPath();
1131
+ // ctx.moveTo(20 * i + 2, 200 + 4 * j);
1132
+ // ctx.lineTo(20 * (i + 1) - 2, 200 + 4 * j);
1133
+ // ctx.stroke();
1134
+ // ctx.beginPath();
1135
+ // ctx.moveTo(20 * i + 2, 200 - 4 * j);
1136
+ // ctx.lineTo(20 * (i + 1) - 2, 200 - 4 * j);
1137
+ // ctx.stroke();
1138
+ // }
1139
+ // ctx.beginPath();
1140
+ // ctx.moveTo(20 * i + 2, 200);
1141
+ // ctx.lineTo(20 * (i + 1) - 2, 200);
1142
+ // ctx.stroke();
1143
+ // }
1088
1144
 
1145
+ // //制造半透明投影
1146
+ // function draw() {
1147
+ // ctx.drawImage(outcanvas, 0, 0);
1148
+ // ctx.save();
1149
+ // ctx.translate(canvas.width / 4, canvas.height / 2);
1150
+ // ctx.rotate(Math.PI);
1151
+ // ctx.scale(-1, 1);
1152
+ // ctx.drawImage(outcanvas, -canvas.width / 2, -canvas.height / 2);
1153
+ // ctx.restore();
1154
+ // ctx.fillStyle = 'rgba(192,192,192, .0)';
1155
+ // ctx.fillRect(0, 0, canvas.width, canvas.height);
1156
+ // }
1157
+
1158
+ // draw();
1159
+ // requestAnimationFrame(this.test_controller.OnVolumeAnalyser.bind(this, sid, analyser));
1160
+ }
1161
+ // 停止共享
1162
+ this.test_controller.OnDesktopDisplayClosed = () => {
1163
+ if (this.state.isSharedScreen) {
1164
+ this.sharedScreen()
1165
+ }
1166
+ }
1089
1167
  }
1090
1168
  contrastFaceVerify = async data => {
1091
1169
  console.log(data);
@@ -1160,6 +1238,9 @@ class Video extends Component {
1160
1238
  })
1161
1239
  const _dependScripts = [
1162
1240
  // https://counter-web.leimondata.cn:7199
1241
+ this.props.resourcePath + "/beauty/beauty.js",
1242
+ this.props.resourcePath + "/beauty/meeting_beautify_stream.js",
1243
+ this.props.resourcePath + "/beauty/backgroundBlur.js",
1163
1244
  this.props.resourcePath + "/adapter.js",
1164
1245
  this.props.resourcePath + "/getMediaInfo.js",
1165
1246
  this.props.resourcePath + "/pdf.js",
@@ -1285,11 +1366,8 @@ class Video extends Component {
1285
1366
  }
1286
1367
  };
1287
1368
  isFileSuccuse = () => {
1288
- if (!this.state.sessionId) {
1289
- return false
1290
- } else if (this.state.isSuspend) {
1291
- return false
1292
- } else if (!this.state.isCustomer) {
1369
+ if (!this.state.sessionId || this.state.isSuspend || !this.state.isCustomer) {
1370
+ message.success(this.props.prohibitPrompt)
1293
1371
  return false
1294
1372
  } else {
1295
1373
  return true
@@ -1591,6 +1669,8 @@ class Video extends Component {
1591
1669
  }
1592
1670
  console.log(sid)
1593
1671
  this.setState({
1672
+ clickedFacial: false,
1673
+ clickedOcr: false,
1594
1674
  faceCustomerUid: item.customId,
1595
1675
  isModalVisibleFacial: true,
1596
1676
  facialImg: this.test_controller.TakePicture(1, undefined, undefined, sid, 'png')
@@ -1695,6 +1775,20 @@ class Video extends Component {
1695
1775
  })
1696
1776
  }
1697
1777
  }
1778
+ facialHandleVisibleChange=(value)=>{
1779
+ if(!value) {
1780
+ this.setState({
1781
+ clickedFacial: false
1782
+ })
1783
+ }
1784
+ }
1785
+ ocrHandleVisibleChange=(value)=>{
1786
+ if(!value) {
1787
+ this.setState({
1788
+ clickedOcr: false
1789
+ })
1790
+ }
1791
+ }
1698
1792
  render() {
1699
1793
  var pdfChildren
1700
1794
  if (this.props.children) {
@@ -1752,7 +1846,7 @@ class Video extends Component {
1752
1846
  />
1753
1847
  <audio id="audio1" autoPlay />
1754
1848
  <label style={{ display: 'none' }} id="feedId1" type="text" />
1755
- <div style={{ display: (this.state.isCustomer) ? '' : 'none', }} className='customerTitle'>客户</div>
1849
+ <div style={{ display: (this.state.isCustomer) ? '' : 'none', background: this.props.titleBackground,color: this.props.titleColor,'font-size': this.props.fontSize + 'px','font-family' : this.props.fontFamily }} className={`customerTitle ${this.state.isBigVideo == 'video1' ? 'titleBig' : "titleSamlle"}`}>客户</div>
1756
1850
  <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClassOne" id="subscribe_volumeView1" width="40" height="70"></canvas>
1757
1851
  </div>
1758
1852
  </div>
@@ -1792,7 +1886,7 @@ class Video extends Component {
1792
1886
  />
1793
1887
  <audio id="audio1" autoPlay />
1794
1888
  <label style={{ display: 'none' }} id="publish_streamId1" type="text" />
1795
- <div style={{ display: (this.state.isCustomer) ? '' : 'none', }} className='tellerTitle'>坐席</div>
1889
+ <div style={{ display: (this.state.isCustomer) ? '' : 'none', background: this.props.titleBackground,color: this.props.titleColor,'font-size': this.props.fontSize + 'px','font-family' : this.props.fontFamily}} className={`tellerTitle ${this.state.isBigVideo == 'publish_video1' ? 'titleBig' : "titleSamlle"}`}>坐席</div>
1796
1890
  <canvas style={{ display: (this.state.isCustomer) ? '' : 'none', }} className="canvasClass" id="publish_volumeView" width="40" height="70"></canvas>
1797
1891
  </div>
1798
1892
 
@@ -1865,7 +1959,7 @@ class Video extends Component {
1865
1959
 
1866
1960
  </div>
1867
1961
  </div>
1868
-
1962
+ <img id="icon_huatong" style={{display:'none'}} src={require("../../assets/img/icon_huatong.png").default}></img>
1869
1963
  </div>
1870
1964
  <Foot
1871
1965
  img={this.state.voiceImg}
@@ -1873,7 +1967,11 @@ class Video extends Component {
1873
1967
  suspendName={this.state.suspendName}
1874
1968
  cameraImg={this.state.cameraImg}
1875
1969
  customerList={this.state.customerList}
1970
+ clickedOcr={this.state.clickedOcr}
1971
+ clickedFacial={this.state.clickedFacial}
1876
1972
  suspend={this.suspend}
1973
+ facialHandleVisibleChange={this.facialHandleVisibleChange}
1974
+ ocrHandleVisibleChange={this.ocrHandleVisibleChange}
1877
1975
  voice={this.voice}
1878
1976
  cameraClick={this.cameraClick}
1879
1977
  sharedScreen={this.sharedScreen}
@@ -1951,5 +2049,12 @@ Video.defaultProps = {
1951
2049
  callbackUrl: 'http://47.102.126.132:8720/hsbc/callback',
1952
2050
  roomServerUrl: 'wss://mrtc.mpaas.cn-hangzhou.aliyuncs.com/ws',
1953
2051
  resourcePath: 'https://counter-web.leimondata.cn:7199',
2052
+ prohibitPrompt: '当前无客户',
2053
+ voiceColor: '#0AE544',
2054
+ titleBackground: 'rgba(219, 0, 17, 0.1)',
2055
+ titleColor: '#DB0011',
2056
+ microphoneSize: '50',
2057
+ fontSize: '14',
2058
+ fontFamily: 'auto'
1954
2059
  }
1955
2060
  export default Video
@@ -52,7 +52,7 @@
52
52
  z-index: 2000;
53
53
  }
54
54
  .videoFit{
55
- object-fit: cover;
55
+ object-fit: contain !important;
56
56
  }
57
57
  .itemPublic {
58
58
  grid-column-start: 1;
@@ -150,11 +150,11 @@
150
150
  // background: #fff;
151
151
  .button{
152
152
  display: inline-flex;
153
- width: 100%;
153
+ // width: 100%;
154
154
  position: absolute;
155
155
  z-index: 1;
156
156
  top: 0;
157
- left: 80px;
157
+ left: 0;
158
158
  .selectSee{
159
159
  background: #00847F;
160
160
  border-radius: 0px 0px 2px 2px;
@@ -183,27 +183,35 @@ border-radius: 0px 0px 2px 2px;
183
183
  }
184
184
  .customerTitle{
185
185
  position: absolute;
186
- top: 0;
186
+ // top: 0;
187
+ bottom: 0;
187
188
  left: 0px;
188
- width: 80px;
189
+ width: 30%;
189
190
  line-height: 30px;
190
191
  height: 30px;
191
- background: rgba(219, 0, 17, 0.1);
192
+ // background: rgba(219, 0, 17, 0.1);
192
193
  border-radius: 4px 0px 2px 0px;
193
- color: #DB0011;
194
- font-size: 14px;
194
+ // color: #DB0011;
195
+ // font-size: 14px;
195
196
  }
196
197
  .tellerTitle{
197
198
  position: absolute;
198
- top: 0;
199
+ // top: 0;
199
200
  right: 0px;
200
- width: 80px;
201
+ // width: 80px;
201
202
  line-height: 30px;
203
+
204
+ bottom: 0;
202
205
  height: 30px;
203
- background: rgba(219, 0, 17, 0.1);
206
+ // background: rgba(219, 0, 17, 0.1);
204
207
  border-radius: 4px 0px 2px 0px;
205
- transform: rotateY(
206
- 180deg);
207
- color: #DB0011;
208
+ transform: rotateY(180deg);
209
+ // color: #DB0011;
208
210
  font-size: 14px;
211
+ }
212
+ .titleBig{
213
+ width: 30%;
214
+ }
215
+ .titleSamlle{
216
+ width: 70%;
209
217
  }