react_hsbc_teller 2.0.6 → 2.0.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.
@@ -4,7 +4,6 @@
4
4
  import React, { Component, useState } from 'react';
5
5
  import QRCode from 'qrcode.react';
6
6
  import API from '../../api/api';
7
- import { initWebSocket, joinRoom, disconnect } from '../../common/websocket';
8
7
  import { BoardOperate } from '../../common/index.esm.js';
9
8
  import './video.less'
10
9
  import Header from '../header/header.jsx'
@@ -22,7 +21,6 @@ import internalJoin from '../../assets/mp3/internalJoin.mp3'
22
21
  import internalLeft from '../../assets/mp3/internalLeft.mp3'
23
22
  import leftMetting from '../../assets/mp3/leftmeeting.mp3'
24
23
  import errorPng from '../../assets/img/tooltips2_fail.png'
25
- import { callNimIM } from '../../utils/cell.js'
26
24
  import Modal from "antd/lib/modal";
27
25
  import 'antd/lib/modal/style'
28
26
  import message from "antd/lib/message";
@@ -251,11 +249,9 @@ class Video extends Component {
251
249
  cameraValue: '',
252
250
  microphoneValue: '',
253
251
  imStatus: false,
254
- imJoinRoom: false,
255
252
  analyserData: new Map(),
256
253
  analyserHeight: new Map(),
257
254
  OnVolumeAnalyserMap: new Map(),
258
- manualClose: false,
259
255
  defaultValue: '1',
260
256
  customOcrSid: '',
261
257
  shareMaskState: false,
@@ -303,7 +299,7 @@ class Video extends Component {
303
299
  saveLog = (val) => {
304
300
  axios({
305
301
  method: 'get',
306
- baseURL: this.props.logUrl + '&message=' + encodeURIComponent(val) + '&react_hsbc_teller=2.0.6&logTime=' + Date.now() + '&mtoken=' + encodeURIComponent(this.state.rtoken) + '&roomId=' + encodeURIComponent(this.state.channelId) + '&sessionId=' + encodeURIComponent(this.state.sessionId) + '&appointmentID=' + this.props.businessNumber,
302
+ baseURL: this.props.logUrl + '&message=' + encodeURIComponent(val) + '&react_hsbc_teller=2.0.7&logTime=' + Date.now() + '&mtoken=' + encodeURIComponent(this.state.rtoken) + '&roomId=' + encodeURIComponent(this.state.channelId) + '&sessionId=' + encodeURIComponent(this.state.sessionId) + '&appointmentID=' + this.props.businessNumber,
307
303
 
308
304
  }).then(res => {
309
305
 
@@ -349,16 +345,7 @@ class Video extends Component {
349
345
  this.test_controller.Publish(publish_config)
350
346
  })
351
347
  // this.publishAllScreen();
352
-
353
- // eslint-disable-next-line no-undef
354
- setTimeout(() => {
355
- if (this.state.imStatus && !this.state.imJoinRoom) {
356
- joinRoom((this.props.tellerAccount + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), this.state.imRoomId)
357
- this.state.imJoinRoom = true
358
- this.saveLog('Join im room')
359
- console.log('加入IM房间')
360
- }
361
- })
348
+
362
349
  this.props.createRoomCallback({
363
350
  type: 1,
364
351
  errorManage: '',
@@ -468,11 +455,6 @@ class Video extends Component {
468
455
  handleEdit = () => {
469
456
  console.log(JSON.parse(window.sessionStorage.getItem('sigData')));
470
457
  // eslint-disable-next-line no-undef
471
- // initWebSocket('wss://im.uat.dsp.hsbcfts.com.cn:443/wealth/im/ws/')
472
- if (!this.state.imStatus) {
473
- this.state.manualClose = false
474
- initWebSocket('wss://' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname + ':' + JSON.parse(window.sessionStorage.getItem('sigData')).webPort + '/ws/');
475
- }
476
458
  const config_param = {};
477
459
  config_param.workspaceId = this.state.workSpaceId;
478
460
  config_param.uid = this.props.tellerAccount;
@@ -714,6 +696,14 @@ class Video extends Component {
714
696
  })
715
697
  }
716
698
  };
699
+ sendMessage = (msg) => {
700
+ try {
701
+ this.test_controller.SendTextMsg(JSON.stringify(msg))
702
+ } catch (err) {
703
+ console.error(`内部错误, msg = ${JSON.stringify(msg)} `)
704
+ console.error(err)
705
+ }
706
+ }
717
707
  errorCodeClick=(type,value)=>{
718
708
  if(type == 'ocr'){
719
709
  if(value == -1007 || value == -100701 || value == -100702 || value == -200001 || value == -300901 || value == -300902 || value == -400001) {
@@ -1312,9 +1302,8 @@ class Video extends Component {
1312
1302
  })
1313
1303
  }
1314
1304
  }
1315
- mountClick = () => {
1316
- window.IMEvt = msg => {
1317
- console.log(JSON.parse(msg));
1305
+ handleReceiveMsg = (msg) => {
1306
+ console.log(JSON.parse(msg));
1318
1307
  const Mival = JSON.parse(msg);
1319
1308
  if (Mival.typeId == 1210) {
1320
1309
  // 进行初始化操作
@@ -1471,33 +1460,25 @@ class Video extends Component {
1471
1460
  });
1472
1461
  let sid = document.getElementById('publish_video1').name || document.getElementById('publish_streamId1').name;
1473
1462
  this.test_controller.SetLocalAudioEnable(0, parseInt(sid, 10));
1474
- callNimIM('sendCustomCmdMsg', {
1475
- customId: this.state.imRoomId,
1476
- content: JSON.stringify({
1463
+ this.sendMessage({
1477
1464
  'typeId': 1013,
1478
1465
  'muteStatus': 1,
1479
1466
  'data': {
1480
1467
  'sessionId': this.state.sessionId,
1481
1468
  'userId': this.props.tellerAccount
1482
1469
  }
1483
- })
1484
- }, function (code, message, data) {
1485
- // console.log(data)
1486
1470
  })
1487
1471
  }
1488
1472
  document.getElementById('audio1').muted = true
1489
1473
  console.log('音频流静音')
1490
1474
  console.log(document.getElementById('audio1').muted)
1491
1475
  setTimeout(() => {
1492
- callNimIM('sendCustomCmdMsg', {
1493
- customId: this.state.imRoomId,
1494
- content: JSON.stringify({
1495
- 'typeId': 1223,
1496
- 'state': 1, // app解除静音
1497
- 'sessionId': this.state.sessionId,
1498
- 'userId': Mival.data.userId //this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
1499
- })
1500
- });
1476
+ this.sendMessage({
1477
+ 'typeId': 1223,
1478
+ 'state': 1, // app解除静音
1479
+ 'sessionId': this.state.sessionId,
1480
+ 'userId': Mival.data.userId //this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
1481
+ })
1501
1482
  }, 1000);
1502
1483
  }
1503
1484
  } else if (Mival.typeId == 1401) {
@@ -1517,36 +1498,15 @@ class Video extends Component {
1517
1498
  this.messageClick('录制服务异常中断,请重试', 'error')
1518
1499
  let audio = new Audio(recordErrorAudio)
1519
1500
  audio.play()
1520
- }
1521
- };
1522
- window.IMOpenfire = msg => {
1523
- console.log('im登录', msg)
1524
- if (msg.status == 'error') {
1525
- this.state.imStatus = false
1526
- this.saveLog('Im connection establishment failed')
1527
- this.roomCallBack(2, 'im建立连接失败', 5)
1528
- } else if (msg.status == 'success') {
1529
- this.state.imStatus = true
1530
- setTimeout(() => {
1531
- if (this.state.imRoomId && !this.state.imJoinRoom) {
1532
- joinRoom((this.props.tellerAccount + '@' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname), this.state.imRoomId)
1533
- this.state.imJoinRoom = true
1534
- console.log('IMOpenfire 加入im房间')
1535
- }
1536
- }, 200);
1537
- } else if (msg.status == 'close') {
1538
- if (!this.state.manualClose) {
1539
- this.timer && clearInterval(this.timer);
1540
- this.state.imStatus = false
1541
- console.log('IMOpenfireclose')
1542
- this.saveLog('Repeated login of account')
1543
- this.roomCallBack(2, '账号重复登录', 9)
1544
-
1501
+ } else if (Mival.typeId == 33001 && this.state.sessionId == Mival.data.sessionId) {
1502
+ if (Mival.type == 1) {
1503
+ this.saveAuthorize(Mival.data.userId)
1504
+ this.customerFaceClick(this.state.customerList[this.state.customerSelect - 1])
1545
1505
  }
1546
-
1506
+ console.log('33001 done')
1547
1507
  }
1548
-
1549
- }
1508
+ }
1509
+ mountClick = () => {
1550
1510
  let data = {
1551
1511
  account: this.props.tellerAccount,
1552
1512
  type: '2',
@@ -1726,6 +1686,10 @@ class Video extends Component {
1726
1686
  this.state.rtoken = rtoken
1727
1687
  this.createRoom()
1728
1688
  this.saveLog('RM mrtc create room successfully, room_id=' + room_id)
1689
+
1690
+ this.state.imStatus = true
1691
+ this.saveLog('Join im room')
1692
+ console.log('加入IM房间')
1729
1693
  };
1730
1694
  // 创建房间失败
1731
1695
  this.test_controller.OnCreateRoomFailed = (err_code, err_msg) => {
@@ -1779,6 +1743,10 @@ class Video extends Component {
1779
1743
 
1780
1744
  this.roomCallBack(1, '', 0)
1781
1745
  this.saveLog('mrtc join room success')
1746
+
1747
+ this.state.imStatus = true
1748
+ this.saveLog('Join im room')
1749
+ console.log('加入IM房间')
1782
1750
  };
1783
1751
  // 加入房间失败
1784
1752
  this.test_controller.OnJoinRoomFailed = (err_code, err_msg) => {
@@ -1793,12 +1761,9 @@ class Video extends Component {
1793
1761
  this.state.rtoken = '',
1794
1762
  this.state.sessionId = '',
1795
1763
  this.state.imRoomId = ''
1796
- this.state.imJoinRoom = false
1797
1764
  if (this.state.imStatus) {
1798
1765
  console.log('disconnect断开连接')
1799
- this.state.manualClose = true
1800
1766
  this.state.imStatus = false
1801
- disconnect();
1802
1767
  }
1803
1768
  this.test_controller.Disconnect()
1804
1769
  let data = {
@@ -1818,62 +1783,68 @@ class Video extends Component {
1818
1783
  }
1819
1784
  this.test_controller.OnSendTextMsgFailed = (msgId, code, msg) => {
1820
1785
  console.log('发送失败', msgId, code, msg)
1821
- this.setState({
1822
- documentError: '推送授权白板失败,请重试'
1823
- })
1786
+ const Mival = JSON.parse(msg)
1787
+ // 失败处理
1788
+ if (Mival.typeId == '3300') {
1789
+ this.setState({
1790
+ documentError: '推送授权白板失败,请重试'
1791
+ })
1792
+ }
1824
1793
  this.saveLog('mrtc OnSendTextMsgFail:' + msgId +', code=' + code + ',msg=' + msg)
1825
1794
  }
1826
1795
  this.test_controller.OnReceiveTextMsg = (uid, msg) => {
1827
- console.log('收到手机端消息', uid, msg, JSON.parse(msg).typeId, JSON.parse(msg).data.sessionId, this.state.sessionId)
1828
- if (JSON.parse(msg).typeId == 33001 && this.state.sessionId == JSON.parse(msg).data.sessionId) {
1829
- if (JSON.parse(msg).type == 1) {
1830
- this.saveAuthorize(JSON.parse(msg).data.userId)
1831
- this.customerFaceClick(this.state.customerList[this.state.customerSelect - 1])
1832
- }
1833
- }
1796
+ console.log('收到手机端消息',uid, msg, JSON.parse(msg))
1834
1797
  // 线下demo静音处理
1835
- if (JSON.parse(msg).typeId == 4004 && this.state.sessionId == JSON.parse(msg).data.sessionId) {
1836
- if (this.isFileSuccuse()) {
1837
- if (!this.state.voiceStatue) {
1838
- // 静音本地
1839
- this.setState({
1840
- voiceStatue: true,
1841
- voiceImg: voiceImgCloe,
1842
- voiceName: '解除静音'
1843
- });
1844
- let sid = document.getElementById('publish_video1').name || document.getElementById('publish_streamId1').name;
1845
- this.test_controller.SetLocalAudioEnable(0, parseInt(sid, 10));
1846
- callNimIM('sendCustomCmdMsg', {
1847
- customId: this.state.imRoomId,
1848
- content: JSON.stringify({
1849
- 'typeId': 1013,
1850
- 'muteStatus': 1,
1851
- 'data': {
1852
- 'sessionId': this.state.sessionId,
1853
- 'userId': this.props.tellerAccount
1854
- }
1855
- })
1856
- }, function (code, message, data) {
1857
- // console.log(data)
1858
- })
1859
- }
1860
- document.getElementById('audio1').muted = true
1861
- console.log('音频流静音')
1862
- console.log(document.getElementById('audio1').muted)
1863
- setTimeout(() => {
1864
- callNimIM('sendCustomCmdMsg', {
1865
- customId: this.state.imRoomId,
1866
- content: JSON.stringify({
1867
- 'typeId': 1223,
1868
- 'state': 1, // app解除静音
1869
- 'sessionId': this.state.sessionId,
1870
- 'userId': uid //this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
1871
- })
1872
- });
1873
- }, 1000);
1874
- }
1875
- }
1798
+ // if (JSON.parse(msg).typeId == 4004 && this.state.sessionId == JSON.parse(msg).data.sessionId) {
1799
+ // if (this.isFileSuccuse()) {
1800
+ // if (!this.state.voiceStatue) {
1801
+ // // 静音本地
1802
+ // this.setState({
1803
+ // voiceStatue: true,
1804
+ // voiceImg: voiceImgCloe,
1805
+ // voiceName: '解除静音'
1806
+ // });
1807
+ // let sid = document.getElementById('publish_video1').name || document.getElementById('publish_streamId1').name;
1808
+ // this.test_controller.SetLocalAudioEnable(0, parseInt(sid, 10));
1809
+ // callNimIM('sendCustomCmdMsg', {
1810
+ // customId: this.state.imRoomId,
1811
+ // content: JSON.stringify({
1812
+ // 'typeId': 1013,
1813
+ // 'muteStatus': 1,
1814
+ // 'data': {
1815
+ // 'sessionId': this.state.sessionId,
1816
+ // 'userId': this.props.tellerAccount
1817
+ // }
1818
+ // })
1819
+ // }, function (code, message, data) {
1820
+ // // console.log(data)
1821
+ // })
1822
+ // }
1823
+ // document.getElementById('audio1').muted = true
1824
+ // console.log('音频流静音')
1825
+ // console.log(document.getElementById('audio1').muted)
1826
+ // setTimeout(() => {
1827
+ // callNimIM('sendCustomCmdMsg', {
1828
+ // customId: this.state.imRoomId,
1829
+ // content: JSON.stringify({
1830
+ // 'typeId': 1223,
1831
+ // 'state': 1, // app解除静音
1832
+ // 'sessionId': this.state.sessionId,
1833
+ // 'userId': uid //this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
1834
+ // })
1835
+ // });
1836
+ // }, 1000);
1837
+ // }
1838
+ // }
1876
1839
  this.saveLog('mrtc OnReceiveTextMsg info:' + msg)
1840
+ this.handleReceiveMsg(msg)
1841
+ // 33001 已合并到 handleReceiveMsg
1842
+ // if (JSON.parse(msg).typeId == 33001 && this.state.sessionId == JSON.parse(msg).data.sessionId) {
1843
+ // if (JSON.parse(msg).type == 1) {
1844
+ // this.saveAuthorize(JSON.parse(msg).data.userId)
1845
+ // this.customerFaceClick(this.state.customerList[this.state.customerSelect - 1])
1846
+ // }
1847
+ // }
1877
1848
  }
1878
1849
  this.test_controller.StreamFilterHandler = async (publish_tag, stream, stream_type, publish_device, media_type) => {
1879
1850
  console.log(`stream processed by client, publish_device=${publish_device}, media_type=${media_type}, publish_tag=${publish_tag},stream_type=${stream_type}`);
@@ -1961,15 +1932,12 @@ class Video extends Component {
1961
1932
  console.log('发布媒体流成功', sid)
1962
1933
  this.state.sessionType = true
1963
1934
  if (sid == document.getElementById('video20').name) {
1964
- callNimIM('sendCustomCmdMsg', {
1965
- customId: this.state.imRoomId,
1966
- content: JSON.stringify({
1967
- 'typeId': 2030,
1968
- 'sessionId': this.state.sessionId,
1969
- 'sharedScreen': 1,
1970
- 'tellerId': this.props.tellerAccount
1971
- })
1972
- });
1935
+ this.sendMessage({
1936
+ 'typeId': 2030,
1937
+ 'sessionId': this.state.sessionId,
1938
+ 'sharedScreen': 1,
1939
+ 'tellerId': this.props.tellerAccount
1940
+ })
1973
1941
  if (this.state.screenName == '切换共享') {
1974
1942
  this.state.isSharedScreen = true
1975
1943
  this.state.isScreenSwitching = false
@@ -1987,19 +1955,15 @@ class Video extends Component {
1987
1955
  this.timer = setInterval(
1988
1956
  () => {
1989
1957
  if (!this.state.voiceStatue && this.state.analyserHeight.get(sid).toFixed(2) > 0.1) {
1990
- callNimIM('sendCustomCmdMsg', {
1991
- customId: this.state.imRoomId,
1992
- content: JSON.stringify({
1993
- 'typeId': 3200,
1994
- 'decibelValue': this.state.analyserHeight.get(sid).toFixed(2),
1995
- "data": {
1996
- 'sessionId': this.state.sessionId,
1997
- 'userId': this.props.tellerAccount,
1998
- 'data': (new Date()).valueOf()
1999
- }
2000
-
2001
- })
2002
- });
1958
+ this.sendMessage({
1959
+ 'typeId': 3200,
1960
+ 'decibelValue': this.state.analyserHeight.get(sid).toFixed(2),
1961
+ "data": {
1962
+ 'sessionId': this.state.sessionId,
1963
+ 'userId': this.props.tellerAccount,
1964
+ 'data': (new Date()).valueOf()
1965
+ }
1966
+ })
2003
1967
  }
2004
1968
  },
2005
1969
  1000
@@ -2155,22 +2119,15 @@ class Video extends Component {
2155
2119
  this.test_controller.OnNewPublish = (feed) => {
2156
2120
  console.log('有新发布者', feed);
2157
2121
  console.log(new Date())
2158
- callNimIM('sendCustomCmdMsg', {
2159
- customId: this.state.imRoomId,
2160
- content: JSON.stringify({
2122
+ this.sendMessage({
2161
2123
  'typeId': 1013,
2162
2124
  'muteStatus': this.state.voiceStatue ? 1 : 0,
2163
2125
  'data': {
2164
2126
  'sessionId': this.state.sessionId,
2165
2127
  'userId': this.props.tellerAccount
2166
2128
  }
2167
- })
2168
- }, function (code, message, data) {
2169
- console.log(data)
2170
2129
  })
2171
- callNimIM('sendCustomCmdMsg', {
2172
- customId: this.state.imRoomId,
2173
- content: JSON.stringify({
2130
+ this.sendMessage({
2174
2131
  'typeId': 1014,
2175
2132
  'sessionId': this.state.sessionId,
2176
2133
  'meetingInfo': {
@@ -2179,9 +2136,6 @@ class Video extends Component {
2179
2136
  'customers': this.props.meetingInfo.customers,
2180
2137
  'otherAttendees': this.props.meetingInfo.otherAttendees
2181
2138
  }
2182
-
2183
- })
2184
- }, function (code, message, data) {
2185
2139
  })
2186
2140
  this.sendNotification()
2187
2141
  let array = this.state.roomCustomerList;
@@ -2268,14 +2222,11 @@ class Video extends Component {
2268
2222
  this.test_controller.OnUnPublishSucc = (sid) => {
2269
2223
  console.log('取消发布成功', sid, document.getElementById('publish_video1').name)
2270
2224
  if (document.getElementById('publish_video1').name && sid != document.getElementById('publish_video1').name) {
2271
- callNimIM('sendCustomCmdMsg', {
2272
- customId: this.state.imRoomId,
2273
- content: JSON.stringify({
2225
+ this.sendMessage({
2274
2226
  'typeId': 2030,
2275
2227
  'sessionId': this.state.sessionId,
2276
2228
  'sharedScreen': 0,
2277
2229
  'tellerId': this.props.tellerAccount
2278
- })
2279
2230
  })
2280
2231
  this.state.isSharedScreen = false
2281
2232
  this.setState({
@@ -2938,9 +2889,7 @@ class Video extends Component {
2938
2889
  });
2939
2890
  console.log(result);
2940
2891
  this.appGetUsername(document.getElementById('publish_video1').name)
2941
- callNimIM('sendCustomCmdMsg', {
2942
- customId: this.state.imRoomId,
2943
- content: JSON.stringify({
2892
+ this.sendMessage({
2944
2893
  'typeId': 1014,
2945
2894
  'sessionId': this.state.sessionId,
2946
2895
  'meetingInfo': {
@@ -2949,9 +2898,6 @@ class Video extends Component {
2949
2898
  'customers': this.props.meetingInfo.customers,
2950
2899
  'otherAttendees': this.props.meetingInfo.otherAttendees
2951
2900
  }
2952
-
2953
- })
2954
- }, function (code, message, data) {
2955
2901
  })
2956
2902
  } catch (err) {
2957
2903
  console.error(err);
@@ -2978,11 +2924,6 @@ class Video extends Component {
2978
2924
  this.stopASR()
2979
2925
  this.asr_controller.Disconnect()
2980
2926
  }
2981
- if (this.state.imStatus) {
2982
- console.log('disconnect断开连接')
2983
- this.state.manualClose = true
2984
- disconnect();
2985
- }
2986
2927
  message.destroy()
2987
2928
  }
2988
2929
  finishSession = () => {
@@ -3182,7 +3123,7 @@ class Video extends Component {
3182
3123
  }
3183
3124
  }
3184
3125
  componentWillMount() {
3185
- console.log('hsbc_teller_sdk', '2.0.6')
3126
+ console.log('hsbc_teller_sdk', '2.0.7')
3186
3127
  let arr = []
3187
3128
  for(let i=1;i<=12;i++){
3188
3129
  arr.push({
@@ -3221,20 +3162,14 @@ class Video extends Component {
3221
3162
  sid = document.getElementById('publish_streamId1').name
3222
3163
  }
3223
3164
  this.test_controller.SetLocalAudioEnable(0, parseInt(sid, 10));
3224
- callNimIM('sendCustomCmdMsg', {
3225
- customId: this.state.imRoomId,
3226
- content: JSON.stringify({
3165
+ this.sendMessage({
3227
3166
  'typeId': 1013,
3228
3167
  'muteStatus': 1,
3229
3168
  'data': {
3230
3169
  'sessionId': this.state.sessionId,
3231
3170
  'userId': this.props.tellerAccount
3232
3171
  }
3233
- })
3234
- }, function (code, message, data) {
3235
- console.log(data)
3236
3172
  })
3237
-
3238
3173
  } else if (this.state.voiceStatue) {
3239
3174
  // 打开本地
3240
3175
  this.setState({
@@ -3248,18 +3183,13 @@ class Video extends Component {
3248
3183
  sid = document.getElementById('publish_streamId1').name
3249
3184
  }
3250
3185
  this.test_controller.SetLocalAudioEnable(1, parseInt(sid, 10));
3251
- callNimIM('sendCustomCmdMsg', {
3252
- customId: this.state.imRoomId,
3253
- content: JSON.stringify({
3186
+ this.sendMessage({
3254
3187
  'typeId': 1013,
3255
3188
  'muteStatus': 0,
3256
3189
  'data': {
3257
3190
  'sessionId': this.state.sessionId,
3258
3191
  'userId': this.props.tellerAccount
3259
3192
  }
3260
- })
3261
- }, function (code, message, data) {
3262
- console.log(data)
3263
3193
  })
3264
3194
  }
3265
3195
  }
@@ -3286,17 +3216,12 @@ class Video extends Component {
3286
3216
  sid = document.getElementById('publish_streamId1').name
3287
3217
  }
3288
3218
  this.test_controller.SetLocalVideoEnable(0, parseInt(sid, 10));
3289
- callNimIM('sendCustomCmdMsg', {
3290
- customId: this.state.imRoomId,
3291
- content: JSON.stringify({
3219
+ this.sendMessage({
3292
3220
  'typeId': 1012,
3293
3221
  'state': 0,
3294
3222
  'sessionId': this.state.sessionId,
3295
3223
  'userId': this.props.tellerAccount
3296
- })
3297
- }, function (code, message, data) {
3298
- console.log(data)
3299
- })
3224
+ })
3300
3225
  } else if (this.state.audioed) {
3301
3226
  this.state.audioed = false,
3302
3227
  this.setState({
@@ -3308,16 +3233,11 @@ class Video extends Component {
3308
3233
  sid = document.getElementById('publish_streamId1').name
3309
3234
  }
3310
3235
  this.test_controller.SetLocalVideoEnable(1, parseInt(sid, 10));
3311
- callNimIM('sendCustomCmdMsg', {
3312
- customId: this.state.imRoomId,
3313
- content: JSON.stringify({
3314
- 'typeId': 1012,
3315
- 'state': 1,
3316
- 'sessionId': this.state.sessionId,
3317
- 'userId': this.props.tellerAccount
3318
- })
3319
- }, function (code, message, data) {
3320
- console.log(data)
3236
+ this.sendMessage({
3237
+ 'typeId': 1012,
3238
+ 'state': 1,
3239
+ 'sessionId': this.state.sessionId,
3240
+ 'userId': this.props.tellerAccount
3321
3241
  })
3322
3242
  }
3323
3243
  }
@@ -3442,15 +3362,11 @@ class Video extends Component {
3442
3362
  voiceName: '静音'
3443
3363
  })
3444
3364
  }
3445
- callNimIM('sendCustomCmdMsg', {
3446
- customId: this.state.imRoomId,
3447
- content: JSON.stringify({
3448
- 'typeId': 1011,
3449
- 'state': 1,
3450
- 'sessionId': this.state.sessionId,
3451
- 'userId': this.props.tellerAccount
3452
- })
3453
- }, function (code, message, data) {
3365
+ this.sendMessage({
3366
+ 'typeId': 1011,
3367
+ 'state': 1,
3368
+ 'sessionId': this.state.sessionId,
3369
+ 'userId': this.props.tellerAccount
3454
3370
  })
3455
3371
  } else {
3456
3372
  this.setState({
@@ -3461,32 +3377,22 @@ class Video extends Component {
3461
3377
  };
3462
3378
  handleOk = () => {
3463
3379
  // 代表此时按钮是暂停会话,把isSuspend改成true变成恢复会话
3464
- callNimIM('sendCustomCmdMsg', {
3465
- customId: this.state.imRoomId,
3466
- content: JSON.stringify({
3467
- 'typeId': 1012,
3468
- 'state': 1,
3469
- 'sessionId': this.state.sessionId,
3470
- 'userId': this.props.tellerAccount
3471
- })
3472
- }, function (code, message, data) {
3473
- console.log(data)
3474
- });
3380
+ this.sendMessage({
3381
+ 'typeId': 1012,
3382
+ 'state': 1,
3383
+ 'sessionId': this.state.sessionId,
3384
+ 'userId': this.props.tellerAccount
3385
+ })
3475
3386
  this.setState({
3476
3387
  isSuspend: true,
3477
3388
  suspendName: '恢复'
3478
3389
  });
3479
- callNimIM('sendCustomCmdMsg', {
3480
- customId: this.state.imRoomId,
3481
- content: JSON.stringify({
3482
- 'typeId': 1011,
3483
- 'state': 0,
3484
- 'sessionId': this.state.sessionId,
3485
- 'userId': this.props.tellerAccount
3486
- })
3487
- }, function (code, message, data) {
3488
- console.log(data)
3489
- });
3390
+ this.sendMessage({
3391
+ 'typeId': 1011,
3392
+ 'state': 0,
3393
+ 'sessionId': this.state.sessionId,
3394
+ 'userId': this.props.tellerAccount
3395
+ })
3490
3396
  let sid = document.getElementById('publish_video1').name;
3491
3397
  if (!sid) {
3492
3398
  // 纯音频的时候sid在publish_streamId标签中
@@ -3697,15 +3603,12 @@ class Video extends Component {
3697
3603
  console.log('ocrCallback', result.data,val)
3698
3604
  // this.messageClick('姓名:' + result.data.idCardName + ',身份证号:' + result.data.idCardNumber,'success')
3699
3605
  // this.messageClick('识别成功','success')
3700
- callNimIM('sendCustomCmdMsg', {
3701
- customId: this.state.imRoomId,
3702
- content: JSON.stringify({
3703
- 'typeId': 1020,
3704
- 'sessionId': this.state.sessionId,
3705
- 'cameraState': 1,
3706
- "userId": this.state.faceCustomerUid
3707
- })
3708
- });
3606
+ this.sendMessage({
3607
+ 'typeId': 1020,
3608
+ 'sessionId': this.state.sessionId,
3609
+ 'cameraState': 1,
3610
+ "userId": this.state.faceCustomerUid
3611
+ })
3709
3612
  if(this.state.documentType == 'ID_CARD') {
3710
3613
  if (result.data.side == 'front' && val == 1) {
3711
3614
  if(this.state.certificateValidity) {
@@ -3973,15 +3876,12 @@ class Video extends Component {
3973
3876
  }
3974
3877
  };
3975
3878
  handleCancelFacial = () => {
3976
- callNimIM('sendCustomCmdMsg', {
3977
- customId: this.state.imRoomId,
3978
- content: JSON.stringify({
3979
- 'typeId': 1020,
3980
- 'sessionId': this.state.sessionId,
3981
- 'cameraState': 1, // 1--打开前置 2--打开后置
3982
- "userId": this.state.faceCustomerUid
3983
- })
3984
- });
3879
+ this.sendMessage({
3880
+ 'typeId': 1020,
3881
+ 'sessionId': this.state.sessionId,
3882
+ 'cameraState': 1, // 1--打开前置 2--打开后置
3883
+ "userId": this.state.faceCustomerUid
3884
+ })
3985
3885
  this.setState({
3986
3886
  isModalVisibleFacial: false
3987
3887
  })
@@ -4006,15 +3906,12 @@ class Video extends Component {
4006
3906
  }
4007
3907
  }
4008
3908
  newFaceClick=()=>{
4009
- callNimIM('sendCustomCmdMsg', {
4010
- customId: this.state.imRoomId,
4011
- content: JSON.stringify({
4012
- 'typeId': 1020,
4013
- 'sessionId': this.state.sessionId,
4014
- 'cameraState': 2, // 1--打开前置 2--打开后置
4015
- "userId": this.state.faceCustomerUid
4016
- })
4017
- });
3909
+ this.sendMessage({
3910
+ 'typeId': 1020,
3911
+ 'sessionId': this.state.sessionId,
3912
+ 'cameraState': 2, // 1--打开前置 2--打开后置
3913
+ "userId": this.state.faceCustomerUid
3914
+ })
4018
3915
  this.setState({
4019
3916
  clickedFacial: false,
4020
3917
  clickedOcr: false,
@@ -4125,15 +4022,12 @@ class Video extends Component {
4125
4022
  } else {
4126
4023
  if (this.state.faceCustomerType == 2) {
4127
4024
  // ocr
4128
- callNimIM('sendCustomCmdMsg', {
4129
- customId: this.state.imRoomId,
4130
- content: JSON.stringify({
4131
- 'typeId': 1020,
4132
- 'sessionId': this.state.sessionId,
4133
- 'cameraState': 2, // 1--打开前置 2--打开后置
4134
- "userId": item.customId
4135
- })
4136
- });
4025
+ this.sendMessage({
4026
+ 'typeId': 1020,
4027
+ 'sessionId': this.state.sessionId,
4028
+ 'cameraState': 2, // 1--打开前置 2--打开后置
4029
+ "userId": item.customId
4030
+ })
4137
4031
  }
4138
4032
  var sid
4139
4033
  if (item.feedId == document.getElementById("feedId1").innerText) {
@@ -4920,117 +4814,81 @@ class Video extends Component {
4920
4814
  muteOpposite = (value) => {
4921
4815
  console.log(value);
4922
4816
  if (value == 'video1') {
4923
- callNimIM('sendCustomCmdMsg', {
4924
- customId: this.state.imRoomId,
4925
- content: JSON.stringify({
4926
- 'typeId': 1223,
4927
- 'sessionId': this.state.sessionId,
4928
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
4929
- })
4930
- });
4817
+ this.sendMessage({
4818
+ 'typeId': 1223,
4819
+ 'sessionId': this.state.sessionId,
4820
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId1').innerText).uid
4821
+ })
4931
4822
  }
4932
4823
  if (value == 'video2') {
4933
- callNimIM('sendCustomCmdMsg', {
4934
- customId: this.state.imRoomId,
4935
- content: JSON.stringify({
4936
- 'typeId': 1223,
4937
- 'sessionId': this.state.sessionId,
4938
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId2').innerText).uid
4939
- })
4940
- });
4824
+ this.sendMessage({
4825
+ 'typeId': 1223,
4826
+ 'sessionId': this.state.sessionId,
4827
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId2').innerText).uid
4828
+ })
4941
4829
  } if (value == 'video3') {
4942
- callNimIM('sendCustomCmdMsg', {
4943
- customId: this.state.imRoomId,
4944
- content: JSON.stringify({
4945
- 'typeId': 1223,
4946
- 'sessionId': this.state.sessionId,
4947
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId3').innerText).uid
4948
- })
4949
- });
4830
+ this.sendMessage({
4831
+ 'typeId': 1223,
4832
+ 'sessionId': this.state.sessionId,
4833
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId3').innerText).uid
4834
+ })
4950
4835
  } if (value == 'video4') {
4951
- callNimIM('sendCustomCmdMsg', {
4952
- customId: this.state.imRoomId,
4953
- content: JSON.stringify({
4954
- 'typeId': 1223,
4955
- 'sessionId': this.state.sessionId,
4956
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId4').innerText).uid
4957
- })
4958
- });
4836
+ this.sendMessage({
4837
+ 'typeId': 1223,
4838
+ 'sessionId': this.state.sessionId,
4839
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId4').innerText).uid
4840
+ })
4959
4841
  } if (value == 'video5') {
4960
- callNimIM('sendCustomCmdMsg', {
4961
- customId: this.state.imRoomId,
4962
- content: JSON.stringify({
4963
- 'typeId': 1223,
4964
- 'sessionId': this.state.sessionId,
4965
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId5').innerText).uid
4966
- })
4967
- });
4842
+ this.sendMessage({
4843
+ 'typeId': 1223,
4844
+ 'sessionId': this.state.sessionId,
4845
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId5').innerText).uid
4846
+ })
4968
4847
  } if (value == 'video6') {
4969
- callNimIM('sendCustomCmdMsg', {
4970
- customId: this.state.imRoomId,
4971
- content: JSON.stringify({
4972
- 'typeId': 1223,
4973
- 'sessionId': this.state.sessionId,
4974
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId6').innerText).uid
4975
- })
4976
- });
4848
+ this.sendMessage({
4849
+ 'typeId': 1223,
4850
+ 'sessionId': this.state.sessionId,
4851
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId6').innerText).uid
4852
+ })
4977
4853
  } if (value == 'video7') {
4978
- callNimIM('sendCustomCmdMsg', {
4979
- customId: this.state.imRoomId,
4980
- content: JSON.stringify({
4981
- 'typeId': 1223,
4982
- 'sessionId': this.state.sessionId,
4983
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId7').innerText).uid
4984
- })
4985
- });
4854
+ this.sendMessage({
4855
+ 'typeId': 1223,
4856
+ 'sessionId': this.state.sessionId,
4857
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId7').innerText).uid
4858
+ })
4986
4859
  } if (value == 'video8') {
4987
- callNimIM('sendCustomCmdMsg', {
4988
- customId: this.state.imRoomId,
4989
- content: JSON.stringify({
4990
- 'typeId': 1223,
4991
- 'sessionId': this.state.sessionId,
4992
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId8').innerText).uid
4993
- })
4994
- });
4860
+ this.sendMessage({
4861
+ 'typeId': 1223,
4862
+ 'sessionId': this.state.sessionId,
4863
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId8').innerText).uid
4864
+ })
4995
4865
  } if (value == 'video9') {
4996
- callNimIM('sendCustomCmdMsg', {
4997
- customId: this.state.imRoomId,
4998
- content: JSON.stringify({
4999
- 'typeId': 1223,
5000
- 'sessionId': this.state.sessionId,
5001
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId9').innerText).uid
5002
- })
5003
- });
4866
+ this.sendMessage({
4867
+ 'typeId': 1223,
4868
+ 'sessionId': this.state.sessionId,
4869
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId9').innerText).uid
4870
+ })
5004
4871
  }
5005
4872
  if (value == 'video10') {
5006
- callNimIM('sendCustomCmdMsg', {
5007
- customId: this.state.imRoomId,
5008
- content: JSON.stringify({
5009
- 'typeId': 1223,
5010
- 'sessionId': this.state.sessionId,
5011
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId10').innerText).uid
5012
- })
5013
- });
4873
+ this.sendMessage({
4874
+ 'typeId': 1223,
4875
+ 'sessionId': this.state.sessionId,
4876
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId10').innerText).uid
4877
+ })
5014
4878
  }
5015
4879
  if (value == 'video11') {
5016
- callNimIM('sendCustomCmdMsg', {
5017
- customId: this.state.imRoomId,
5018
- content: JSON.stringify({
5019
- 'typeId': 1223,
5020
- 'sessionId': this.state.sessionId,
5021
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId11').innerText).uid
5022
- })
5023
- });
4880
+ this.sendMessage({
4881
+ 'typeId': 1223,
4882
+ 'sessionId': this.state.sessionId,
4883
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId11').innerText).uid
4884
+ })
5024
4885
  }
5025
4886
  if (value == 'video12') {
5026
- callNimIM('sendCustomCmdMsg', {
5027
- customId: this.state.imRoomId,
5028
- content: JSON.stringify({
5029
- 'typeId': 1223,
5030
- 'sessionId': this.state.sessionId,
5031
- 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId12').innerText).uid
5032
- })
5033
- });
4887
+ this.sendMessage({
4888
+ 'typeId': 1223,
4889
+ 'sessionId': this.state.sessionId,
4890
+ 'userId': this.seeList(this.state.roomCustomerList, 'feedId', document.getElementById('feedId12').innerText).uid
4891
+ })
5034
4892
  }
5035
4893
 
5036
4894
  }
@@ -5039,14 +4897,11 @@ class Video extends Component {
5039
4897
  this.state.shareMaskState = this.props.shareMask
5040
4898
  // 加延迟是因为在关闭的时候可以看到部分rm的操作
5041
4899
  setTimeout(() => {
5042
- callNimIM('sendCustomCmdMsg', {
5043
- customId: this.state.imRoomId,
5044
- content: JSON.stringify({
5045
- 'typeId': 1230,
5046
- 'sessionId': this.state.sessionId,
5047
- 'type': this.state.shareMaskState ? 1 : 2
5048
- })
5049
- });
4900
+ this.sendMessage({
4901
+ 'typeId': 1230,
4902
+ 'sessionId': this.state.sessionId,
4903
+ 'type': this.state.shareMaskState ? 1 : 2
4904
+ })
5050
4905
  }, 100)
5051
4906
 
5052
4907
  }