react_hsbc_teller 0.7.2 → 0.7.6

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.2",
3
+ "version": "0.7.6",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
Binary file
@@ -32,10 +32,12 @@ let pictureInPictureVideo = ''
32
32
  class Video extends Component {
33
33
  constructor(props) {
34
34
  super(props)
35
- this.cancel = axios.CancelToken.source()
35
+ // this.cancel = axios.CancelToken.source()
36
36
  }
37
+ cancel = axios.CancelToken.source()
37
38
  signCanvas = React.createRef();
38
39
  state = {
40
+ sessionType: true,
39
41
  isWhiteboard: false,
40
42
  isSelect: '',
41
43
  loading: false,
@@ -47,6 +49,7 @@ class Video extends Component {
47
49
  employeeNumber: '',
48
50
  employeeName: '',
49
51
  isModalVisibleInvitation: false,
52
+ linkData: '',
50
53
  roomCustomerList: [],
51
54
  facialImg: '',
52
55
  isModalVisibleFacial: false,
@@ -112,6 +115,7 @@ class Video extends Component {
112
115
  imStatus: false,
113
116
  imJoinRoom: false,
114
117
  analyserData: new Map(),
118
+ analyserHeight: new Map()
115
119
  };
116
120
  // eslint-disable-next-line no-undef
117
121
  test_controller = '';
@@ -161,6 +165,9 @@ class Video extends Component {
161
165
  })
162
166
  } catch (err) {
163
167
  console.error(err);
168
+ this.setState({
169
+ sessionType: false
170
+ })
164
171
  this.props.createRoomCallback({
165
172
  type: 2,
166
173
  errorManage: '保存房间信息失败',
@@ -538,7 +545,12 @@ class Video extends Component {
538
545
  }
539
546
  };
540
547
  endSessionValue = () => {
541
- this.test_controller.LeaveRoom()
548
+ if(this.state.sessionType) {
549
+ this.test_controller.LeaveRoom()
550
+ } else {
551
+ this.finishSession()
552
+ }
553
+
542
554
  };
543
555
  // 画中画
544
556
  pictureInPicture = () => {
@@ -680,7 +692,7 @@ class Video extends Component {
680
692
  for (let k = 0; k < str.length; k++){
681
693
  // console.log(str.substring(0,k+1))
682
694
  // console.log(cobj.measureText(str.substring(0,k+1)).width)
683
- if (cobj.measureText(str.substring(0,k+1)).width>240){
695
+ if (cobj.measureText(str.substring(0,k+1)).width>210){
684
696
  str = str.substring(0,k-2)
685
697
  str += '...'
686
698
  break;
@@ -1079,6 +1091,9 @@ class Video extends Component {
1079
1091
  window.IMOpenfire = msg =>{
1080
1092
  console.log('im登录', msg)
1081
1093
  if(!msg) {
1094
+ this.setState({
1095
+ sessionType: false
1096
+ })
1082
1097
  this.roomCallBack(2, 'im建立连接失败',-7)
1083
1098
  } else {
1084
1099
  this.setState({
@@ -1184,7 +1199,7 @@ class Video extends Component {
1184
1199
  microphoneList: objList1,
1185
1200
  speakerList: [objList2[0]]
1186
1201
  })
1187
- if (!this.state.appId) {
1202
+ if (!this.state.appId && this.state.sessionType) {
1188
1203
  this.mpaasSig(data);
1189
1204
  this.setState({
1190
1205
  cameraValue: obj[0].actionid,
@@ -1200,6 +1215,9 @@ class Video extends Component {
1200
1215
  // 获取设备失败
1201
1216
  this.test_controller.OnGetDevicesFailed = (code, msg) => {
1202
1217
  console.log('获取设备失败', code, msg)
1218
+ this.setState({
1219
+ sessionType: false
1220
+ })
1203
1221
  this.messageClick('获取设备失败,请检查摄像头设备是否可用或是否禁用摄像头','error')
1204
1222
  this.roomCallBack(2, '获取设备失败',-1)
1205
1223
  };
@@ -1210,6 +1228,9 @@ class Video extends Component {
1210
1228
  };
1211
1229
  this.test_controller.OnConnectFailed = (code, msg) => {
1212
1230
  console.log('建立连接失败', code, msg)
1231
+ this.setState({
1232
+ sessionType: false
1233
+ })
1213
1234
  this.roomCallBack(2, '连接失败',-2)
1214
1235
  };
1215
1236
  // 断开连接回调
@@ -1224,6 +1245,9 @@ class Video extends Component {
1224
1245
  // 初始化房间失败
1225
1246
  this.test_controller.OnInitRoomConfigFail = (err_code, err_msg) => {
1226
1247
  console.log('初始化房间失败', err_code, err_msg)
1248
+ this.setState({
1249
+ sessionType: false
1250
+ })
1227
1251
  this.roomCallBack(2, '初始化失败',-3)
1228
1252
  };
1229
1253
  // 初始化成功回调
@@ -1250,6 +1274,9 @@ class Video extends Component {
1250
1274
  // 创建房间失败
1251
1275
  this.test_controller.OnCreateRoomFailed = (err_code, err_msg) => {
1252
1276
  console.log('创建房间失败', err_code, err_msg)
1277
+ this.setState({
1278
+ sessionType: false
1279
+ })
1253
1280
  this.roomCallBack(2, '创建房间失败',-4)
1254
1281
  };
1255
1282
  // 初始化⾳视频成功
@@ -1272,6 +1299,9 @@ class Video extends Component {
1272
1299
  // 加入房间失败
1273
1300
  this.test_controller.OnJoinRoomFailed = (err_code, err_msg) => {
1274
1301
  console.log('加入房间失败', err_code, err_msg)
1302
+ this.setState({
1303
+ sessionType: false
1304
+ })
1275
1305
  this.roomCallBack(2, '加入失败',-5)
1276
1306
  };
1277
1307
  // 发布媒体流成功
@@ -1287,11 +1317,35 @@ class Video extends Component {
1287
1317
  'tellerId': this.props.tellerAccount
1288
1318
  })
1289
1319
  });
1320
+ }
1321
+ if(sid == document.getElementById('publish_video1').name) {
1322
+ this.timer = setInterval(
1323
+ () => {
1324
+ console.log('hhhhhh',this.state.analyserHeight.get(sid))
1325
+ if(this.state.analyserHeight.get(sid) > 0 && !this.state.voiceStatue) {
1326
+ callNimIM('sendCustomCmdMsg', {
1327
+ customId: this.state.imRoomId,
1328
+ content: JSON.stringify({
1329
+ 'typeId': 3200,
1330
+ "data": {
1331
+ 'sessionId': this.state.sessionId,
1332
+ 'userId': this.props.tellerAccount
1333
+ }
1334
+
1335
+ })
1336
+ });
1337
+ }
1338
+ },
1339
+ 3000
1340
+ );
1290
1341
  }
1291
1342
  };
1292
1343
  // 发布媒体流失败
1293
1344
  this.test_controller.OnPublishFailed = (sid, err_code, err_msg) => {
1294
1345
  console.log('发布媒体流失败', sid, err_code, err_msg)
1346
+ this.setState({
1347
+ sessionType: false
1348
+ })
1295
1349
  this.roomCallBack(2, '发布失败',-6)
1296
1350
  };
1297
1351
  // 订阅媒体流成功
@@ -1843,6 +1897,7 @@ class Video extends Component {
1843
1897
  exitType
1844
1898
  ) => {
1845
1899
  console.log('退出房间者', participant, exitType)
1900
+ this.messageClick(this.props.customLeaveRoom,'error')
1846
1901
  };
1847
1902
  // 弱网回调
1848
1903
  this.test_controller.OnNetworkWeak = (bpsSend, bpsRecv, sid) => {
@@ -2112,6 +2167,10 @@ class Video extends Component {
2112
2167
  let startX = x2 // 绘制起始点x
2113
2168
  let startY = y1 - height // 绘制起始点y
2114
2169
  ctx.fillRect(startX, startY, width, height)
2170
+ this.state.analyserHeight.set(sid,startY)
2171
+ this.setState({
2172
+ analyserHeight: this.state.analyserHeight
2173
+ })
2115
2174
  }
2116
2175
  requestAnimationFrame(this.test_controller.OnVolumeAnalyser.bind(this, sid, analyser));
2117
2176
 
@@ -2153,7 +2212,7 @@ class Video extends Component {
2153
2212
  finishSession = async () => {
2154
2213
 
2155
2214
 
2156
- if (this.state.roomCustomerList.length == 0) {
2215
+ if (this.state.roomCustomerList.length == 0 && this.state.sessionType) {
2157
2216
  try {
2158
2217
  let result = await API.finishSession({
2159
2218
  sessionId: this.state.sessionId,
@@ -2167,7 +2226,8 @@ class Video extends Component {
2167
2226
  isWhiteboard: false,
2168
2227
  isPictureInPicture: false,
2169
2228
  imStatus: false,
2170
- imJoinRoom: false
2229
+ imJoinRoom: false,
2230
+ sessionType: true
2171
2231
  });
2172
2232
  this.props.onLeaveRoom({
2173
2233
  code: LEAVE_TYPE.TELLER_EXIT,
@@ -2204,8 +2264,12 @@ class Video extends Component {
2204
2264
  axios.get(this.props.resourcePath + "/beauty/beauty.js")
2205
2265
  .then(response => this.addToScriptClick()).catch(function (error) {
2206
2266
  console.log(error);
2267
+ this.setState({
2268
+ sessionType: false
2269
+ })
2207
2270
  this.roomCallBack(2, '创建房间失败',-4)
2208
2271
 
2272
+
2209
2273
  })
2210
2274
 
2211
2275
  }
@@ -2280,7 +2344,8 @@ class Video extends Component {
2280
2344
  this.setState = (state, callback) => {
2281
2345
  return
2282
2346
  }
2283
- this.cancel('')
2347
+ this.cancel = ''
2348
+ this.timer && clearInterval(this.timer);
2284
2349
  }
2285
2350
  componentWillMount() {
2286
2351
  if (this.props.sessionId) {
@@ -2600,7 +2665,8 @@ class Video extends Component {
2600
2665
  isModalVisibleInvitation: true,
2601
2666
  employeeNumber: '',
2602
2667
  employeeName: '',
2603
- employeeError: ''
2668
+ employeeError: '',
2669
+ linkData: ''
2604
2670
  })
2605
2671
 
2606
2672
  }
@@ -2785,6 +2851,15 @@ class Video extends Component {
2785
2851
 
2786
2852
  }
2787
2853
  }
2854
+ linkClick=()=>{
2855
+ let inp = document.createElement('input')
2856
+ inp.value = this.state.linkData
2857
+ document.body.appendChild(inp)
2858
+ inp.select() // 选择对象;
2859
+ console.log(inp.value, '复制到的内容')
2860
+ document.execCommand('Copy') // 执行浏览器复制命令
2861
+ inp.remove()
2862
+ }
2788
2863
  queryStaff = async () => {
2789
2864
  if(!this.state.employeeNumber) return
2790
2865
  try {
@@ -2797,6 +2872,11 @@ class Video extends Component {
2797
2872
  employeeName: result.data.staffName,
2798
2873
  employeeError: result.data.staffName ? '' : '查无此人',
2799
2874
  })
2875
+ if(result.data.staffName){
2876
+ this.setState({
2877
+ linkData:'https://wp-staff-gateway.wealth-platform.uat.ali.cloud.cn.hsbc/meeting-ui/OHB/CN/HSBC?chnlID=OHB&locale=zh_CN&chnlCC=CN&chnlGMC=HSBC&targetFunc=supervisorMeeting&sourceFunc=rmMeeting&appointmentID='+ this.props.businessNumber + '&staffID='+this.state.employeeNumber+'&staffName='+ encodeURIComponent(result.data.staffName)
2878
+ })
2879
+ }
2800
2880
  } else {
2801
2881
  this.messageClick('查询失败','error')
2802
2882
  }
@@ -3510,7 +3590,12 @@ class Video extends Component {
3510
3590
  <Modal className="modelClass" title="新增预约" closable={false} centered={true} visible={this.state.isModalVisibleInvitation} footer={[
3511
3591
  <div key='invitation'>
3512
3592
  <Button className="modelButtonCancel" onClick={this.handleCancelInvitation}>取消</Button>
3513
- <Button className="modelButtonOk" type="primary" danger onClick={this.handleOkInvitation}>确定</Button>
3593
+ {
3594
+ this.state.employeeName &&<Button className='modelButtonOk'type="primary" danger onClick={this.handleOkInvitation}>发送邮件</Button>
3595
+ }
3596
+ {
3597
+ !this.state.employeeName &&<Button className='modelButtonCancelOne' type="primary" danger >发送邮件</Button>
3598
+ }
3514
3599
  </div>
3515
3600
  ]}>
3516
3601
  <div>
@@ -3522,6 +3607,12 @@ class Video extends Component {
3522
3607
  <div className="invitationDiv">
3523
3608
  <span className="modalSpan">&nbsp;&nbsp;&nbsp;姓名:</span><span>{this.state.employeeName}</span>
3524
3609
  </div>
3610
+ {
3611
+ this.state.employeeName &&<div className='invitationDiv'>
3612
+ <span className="modalSpan">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><Button className="invitationButton" onClick={this.linkClick}> <img className='invitationImg' src={require("../../assets/img/link.png").default} alt="" />复制链接</Button>
3613
+ </div>
3614
+ }
3615
+
3525
3616
  </div>
3526
3617
  {
3527
3618
  this.state.employeeError && <div className='errorClassInvitation'>
@@ -3587,6 +3678,7 @@ Video.defaultProps = {
3587
3678
  fontSize: '14',
3588
3679
  fontFamily: 'auto',
3589
3680
  menus: ['SHARE', 'FRIES', 'OCR', 'INVITE', 'PIP'],
3681
+ customLeaveRoom: '客户离开房间',
3590
3682
  meetingInfo: {
3591
3683
  title: '测试',
3592
3684
  host: 'wmz',
@@ -123,6 +123,15 @@
123
123
  font-size: 17px;
124
124
  color: #666666;
125
125
  }
126
+ .invitationImg{
127
+ width: 20px;
128
+ height: 20px;
129
+ }
130
+ .invitationButton{
131
+ color: #1a9adc !important;
132
+ border: none !important;
133
+ background: #fff !important;
134
+ }
126
135
  .invitationDiv{
127
136
  margin-left: 40px;
128
137
  margin-bottom: 15px;
@@ -312,6 +321,15 @@
312
321
  border: 1px #5C5C5C solid!important;
313
322
  border-spacing: 20px!important;
314
323
  }
324
+ .modelButtonCancelOne{
325
+ width: 100px!important;
326
+ height: 40px!important;
327
+ font-size: 16px!important;
328
+ color: #5C5C5C!important;
329
+ border: 1px #5C5C5C solid!important;
330
+ border-spacing: 20px!important;
331
+ background: #d9d9d9!important;
332
+ }
315
333
  .modelButtonOk{
316
334
  width: 100px!important;
317
335
  height: 40px!important;
@@ -434,4 +452,9 @@
434
452
  width: 18px;
435
453
  height: 18px;
436
454
  }
455
+ }
456
+ .linkClass{
457
+ margin: 20px 40px;
458
+ font-size: 14px;
459
+ word-break: break-all;
437
460
  }