react_hsbc_teller 1.5.9 → 1.6.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": "1.5.9",
3
+ "version": "1.6.2",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -2,6 +2,25 @@ import Server from './server';
2
2
 
3
3
  class API extends Server{
4
4
 
5
+ async updateMeetingInfo(params = {}){
6
+ // return this.axios('get', '/lang/select/2', params);
7
+ try{
8
+ let result = await this.axios('post', '/hsbc/updateMeetingInfo', params);
9
+ if(result && (result.data instanceof Object) && result.code === 200){
10
+ return result||[];
11
+ }else{
12
+ let err = {
13
+ tip: '服务异常',
14
+ response: result,
15
+ data: params,
16
+ // url: 'https://api.cangdu.org/shopro/data/products',
17
+ }
18
+ throw err;
19
+ }
20
+ }catch(err){
21
+ throw err;
22
+ }
23
+ }
5
24
  async rateAll(params = {}){
6
25
  // return this.axios('get', '/lang/select/2', params);
7
26
  try{
Binary file
@@ -161,6 +161,9 @@ createRoomCallback=(data)=>{
161
161
  joinRoomCallback=(data)=>{
162
162
  console.log('joinRoomCallback', data)
163
163
  }
164
+ userExit =(val)=>{
165
+     console.log(val)
166
+ }
164
167
  render() {
165
168
  return (
166
169
  <div className="test">
@@ -192,6 +195,7 @@ joinRoomCallback=(data)=>{
192
195
  createRoomCallback={this.createRoomCallback}
193
196
  joinRoomCallback={this.joinRoomCallback}
194
197
  imgCallback={this.imgCallback}
198
+ userExit={this.userExit}
195
199
  >
196
200
 
197
201
  <Pdf></Pdf>
@@ -50,8 +50,11 @@ export default class foot extends Component {
50
50
  switchExternal=()=>{
51
51
  this.props.switchExternal()
52
52
  }
53
+ beautyClick=()=>{
54
+ this.props.beautyClick()
55
+ }
53
56
  render() {
54
- const {clickedOcr,clickedFacial,img,isWhiteboard,cameraImg,isTranscribing ,screenName,suspendName,customerList,menus,voiceName} = this.props
57
+ const {clickedOcr,clickedFacial,img,isWhiteboard,cameraImg,isTranscribing ,screenName,suspendName,customerList,menus,voiceName,beautyName} = this.props
55
58
  const content = (
56
59
  <div>
57
60
  {customerList.map((item,index)=>{
@@ -149,6 +152,14 @@ export default class foot extends Component {
149
152
 
150
153
  })
151
154
  }
155
+ {
156
+ <div className="one" onClick={this.beautyClick.bind(this)}>
157
+ <img className="imgClass" src={require("../../assets/img/meiyan.png").default} alt="" />
158
+ <div className="text">
159
+ {beautyName}
160
+ </div>
161
+ </div>
162
+ }
152
163
  </div>
153
164
  );
154
165
  return (
@@ -11,6 +11,8 @@ import voiceImgOpen from '../../assets/img/icon_Mute.png'
11
11
  import voiceImgCloe from '../../assets/img/icon_MuteOne.png'
12
12
  import cameraImgOpen from '../../assets/img/icon_camera.png'
13
13
  import cameraImgCloe from '../../assets/img/icon_cameraOne.png'
14
+ import autod from '../../assets/mp3/joinmeeting.mp3'
15
+ import leftMetting from '../../assets/mp3/leftmeeting.mp3'
14
16
  import errorPng from '../../assets/img/tooltips2_fail.png'
15
17
  import { callNimIM } from '../../utils/cell.js'
16
18
  import Modal from "antd/lib/modal";
@@ -37,7 +39,29 @@ let streamShare
37
39
  let muteJson = new Map()
38
40
  let dateTime = 0
39
41
  let messageValue = ''
42
+ let beautyNum = 0 // 0-关闭 1--弱 2--中 5---高
40
43
  let rateList = []
44
+ let beautyDiv = {};
45
+ function clearStreamRemain() {
46
+ if (!(beautyDiv.beauty_canvas == null || beautyDiv.beauty_canvas == undefined)) {
47
+ beautyDiv.beauty_canvas = null;
48
+ }
49
+ if (!(beautyDiv.beauty_player == null || beautyDiv.beauty_player == undefined)) {
50
+ beautyDiv.beauty_player.destroy();
51
+ beautyDiv.beauty_player = null;
52
+ }
53
+ if (!(beautyDiv.beauty_div == null || beautyDiv.beauty_div == undefined)) {
54
+ document.body.removeChild(beautyDiv.beauty_div);
55
+ beautyDiv.beauty_div = null;
56
+ }
57
+ beautyDiv = {};
58
+ };
59
+ function startBeauty(stream) {
60
+ let newStream = stream;
61
+ beautyDiv = meetingBeautifyStream(newStream, beautyNum);
62
+ newStream = beautyDiv.stream;
63
+ return newStream
64
+ }
41
65
  message.config({
42
66
  getContainer: ()=>document.getElementById('allHSBC')
43
67
  })
@@ -48,6 +72,7 @@ class Video extends Component {
48
72
  }
49
73
  cancel = axios.CancelToken.source()
50
74
  state = {
75
+ beautyName: '开启美颜',
51
76
  signNoClick: false,
52
77
  listVideoPicture: [],
53
78
  isScreenSwitching: false,
@@ -1982,6 +2007,45 @@ class Video extends Component {
1982
2007
  this.test_controller.OnSendTextMsgFailed =(msgId, code, msg)=>{
1983
2008
  console.log('发送失败',msgId,code, msg)
1984
2009
  }
2010
+ this.test_controller.StreamFilterHandler = async function (publish_tag, stream, stream_type, publish_device, media_type) {
2011
+ console.log(`stream processed by client, publish_device=${publish_device}, media_type=${media_type}, publish_tag=${publish_tag},stream_type=${stream_type}`);
2012
+ if (stream_type == "subscribe") {
2013
+ return stream
2014
+ }
2015
+ if (media_type == 2 || media_type == 4) {
2016
+ return stream
2017
+ }
2018
+ // if (publish_device != 1) {
2019
+ // return stream
2020
+ // }
2021
+ if(publish_tag == 'tag1') {
2022
+ let newStream = stream;
2023
+ let beauty_strength = beautyNum;
2024
+ if (beauty_strength != 0 && stream.getVideoTracks()[0]) {
2025
+ newStream = new MediaStream([startBeauty(stream).getVideoTracks()[0]]);
2026
+ // 清理原始流
2027
+ newStream.oninactive = function () {
2028
+ clearOriginStream(stream);
2029
+ };
2030
+ newStream.getVideoTracks()[0].onended = function () {
2031
+ clearOriginStream(stream);
2032
+ };
2033
+ function clearOriginStream(stream) {
2034
+ stream.getTracks().forEach((track) => {
2035
+ track.stop();
2036
+ });
2037
+ stream = null;
2038
+ }
2039
+ };
2040
+ if (stream.getAudioTracks()[0] && newStream.addTrack) {
2041
+ newStream.addTrack(stream.getAudioTracks()[0])
2042
+ }
2043
+ return newStream
2044
+ } else {
2045
+ return stream
2046
+ }
2047
+
2048
+ }
1985
2049
  // 发布媒体流成功
1986
2050
  this.test_controller.OnPublishSucc = (sid) => {
1987
2051
  console.log('发布媒体流成功', sid)
@@ -2007,6 +2071,7 @@ class Video extends Component {
2007
2071
  loading: false,
2008
2072
  });
2009
2073
  this.enterRoom()
2074
+ this.updateMeetingInfo()
2010
2075
  this.timer = setInterval(
2011
2076
  () => {
2012
2077
  if(!this.state.voiceStatue && this.state.analyserHeight.get(sid).toFixed(2) > 0.1) {
@@ -2403,29 +2468,14 @@ class Video extends Component {
2403
2468
  this.test_controller.OnNewJoinerIn = (participant) => {
2404
2469
  console.log('新加⼊房间者', participant);
2405
2470
  this.state.isCustomer= true
2406
- // let audio = document.createElement('audio') //生成一个audio元素
2407
- // audio.src = 'http://mp3.9ku.com/hot/2005/05-19/65937.mp3' //音乐的路径
2408
- // audio.play()
2471
+ let src = autod
2472
+ let audio = new Audio(src)
2473
+ audio.play()
2409
2474
  };
2410
2475
  // 推送“有新发布”给与会者
2411
2476
  this.test_controller.OnNewPublish = (feed) => {
2412
2477
  console.log('有新发布者', feed);
2413
2478
  console.log(new Date())
2414
- callNimIM('sendCustomCmdMsg', {
2415
- customId: this.state.imRoomId,
2416
- content: JSON.stringify({
2417
- 'typeId': 1014,
2418
- 'sessionId': this.state.sessionId,
2419
- 'meetingInfo': {
2420
- 'title': this.props.meetingInfo.title,
2421
- 'host': this.props.meetingInfo.host,
2422
- 'customers': this.props.meetingInfo.customers,
2423
- 'otherAttendees': this.props.meetingInfo.otherAttendees
2424
- }
2425
-
2426
- })
2427
- }, function (code, message, data) {
2428
- })
2429
2479
  callNimIM('sendCustomCmdMsg', {
2430
2480
  customId: this.state.imRoomId,
2431
2481
  content: JSON.stringify({
@@ -2619,7 +2669,7 @@ class Video extends Component {
2619
2669
  // 取消发布成功
2620
2670
  this.test_controller.OnUnPublishSucc = (sid) => {
2621
2671
  console.log('取消发布成功', sid, document.getElementById('publish_video1').name)
2622
- if (sid != document.getElementById('publish_video1').name) {
2672
+ if (document.getElementById('publish_video1').name && sid != document.getElementById('publish_video1').name) {
2623
2673
  callNimIM('sendCustomCmdMsg', {
2624
2674
  customId: this.state.imRoomId,
2625
2675
  content: JSON.stringify({
@@ -2640,6 +2690,9 @@ class Video extends Component {
2640
2690
  // }
2641
2691
 
2642
2692
  }
2693
+ if(sid == document.getElementById('publish_video1').name || !document.getElementById('publish_video1').name) {
2694
+ clearStreamRemain()
2695
+ }
2643
2696
  };
2644
2697
  // 取消订阅媒体流成功
2645
2698
  this.test_controller.OnUnSubscribeSucc = (sid) => {
@@ -2787,14 +2840,25 @@ class Video extends Component {
2787
2840
  exitType
2788
2841
  ) => {
2789
2842
  console.log('退出房间者', participant, exitType)
2843
+ let src = leftMetting
2844
+ let audio = new Audio(src)
2845
+ audio.play()
2790
2846
  this.appGetUsernameClick(participant).then((res)=>{
2791
2847
  console.log('退出房间者',res)
2792
- let data = res? res : '客户'
2793
- console.log(data)
2794
- this.messageClick(( data + '已退出会议'),'error')
2795
- // let audio = document.createElement('audio') //生成一个audio元素
2796
- // audio.src = 'http://mp3.9ku.com/hot/2005/05-19/65937.mp3' //音乐的路径
2797
- // audio.play()
2848
+ let data = res? res.username ? res.username : '客户' : '客户'
2849
+ console.log(data)
2850
+ this.messageClick(( data + '已退出会议'),'error')
2851
+ if(res.userType == 1) {
2852
+ // 2--坐席  1--客户
2853
+ this.props.userExit({
2854
+ userId: participant,
2855
+ userType:'1'
2856
+ })
2857
+ }
2858
+ // console.log('退出房间者',res)
2859
+ // let data = res? res : '客户'
2860
+ // console.log(data)
2861
+ // this.messageClick(( data + '已退出会议'),'error')
2798
2862
  })
2799
2863
 
2800
2864
  };
@@ -3162,6 +3226,42 @@ class Video extends Component {
3162
3226
  }
3163
3227
  }
3164
3228
  }
3229
+ // 保存mettingInfo
3230
+ // callNimIM('sendCustomCmdMsg', {
3231
+ // customId: this.state.imRoomId,
3232
+ // content: JSON.stringify({
3233
+ // 'typeId': 1014,
3234
+ // 'sessionId': this.state.sessionId,
3235
+ // 'meetingInfo': {
3236
+ // 'title': this.props.meetingInfo.title,
3237
+ // 'host': this.props.meetingInfo.host,
3238
+ // 'customers': this.props.meetingInfo.customers,
3239
+ // 'otherAttendees': this.props.meetingInfo.otherAttendees
3240
+ // }
3241
+
3242
+ // })
3243
+ // }, function (code, message, data) {
3244
+ // })
3245
+ updateMeetingInfo= async()=>{
3246
+ let customers
3247
+ this.props.meetingInfo.customers.map((item, index) => {
3248
+ customers = customers ? customers + ',' + item : item
3249
+ })
3250
+ try{
3251
+ let result = await API.updateMeetingInfo({
3252
+ title:this.props.meetingInfo.title,
3253
+ host:this.props.meetingInfo.host,
3254
+ customers:customers,
3255
+ otherAttendees: this.props.meetingInfo.otherAttendees ? this.props.meetingInfo.otherAttendees : '',
3256
+ sessionId:this.state.sessionId
3257
+ })
3258
+ } catch (err) {
3259
+ console.error(err);
3260
+ if(err.status == 502 || err.status== 404) {
3261
+ this.roomCallBack(2, '连接服务器失败','SYS-02')
3262
+ }
3263
+ }
3264
+ }
3165
3265
  enterRoom = async () =>{
3166
3266
  try {
3167
3267
  let result = await API.enterRoom({
@@ -3185,6 +3285,8 @@ class Video extends Component {
3185
3285
  this.finishSessionClick()
3186
3286
  }
3187
3287
  if (this.test_controller&&this.state.sessionType) {
3288
+ clearStreamRemain()
3289
+ beautyNum = 0
3188
3290
  this.test_controller.LeaveRoom()
3189
3291
  this.test_controller.Disconnect()
3190
3292
  }
@@ -3688,6 +3790,15 @@ class Video extends Component {
3688
3790
  });
3689
3791
  if (result.code == 200) {
3690
3792
  this.messageClick('识别成功','success')
3793
+ callNimIM('sendCustomCmdMsg', {
3794
+ customId: this.state.imRoomId,
3795
+ content: JSON.stringify({
3796
+ 'typeId': 1020,
3797
+ 'sessionId': this.state.sessionId,
3798
+ 'cameraState': 1, // 1--打开前置 2--打开后置
3799
+ "userId": this.state.faceCustomerUid
3800
+ })
3801
+ });
3691
3802
  this.setState({
3692
3803
  isModalVisibleFacial: false
3693
3804
  })
@@ -3714,6 +3825,15 @@ class Video extends Component {
3714
3825
 
3715
3826
  };
3716
3827
  handleCancelFacial = () => {
3828
+ callNimIM('sendCustomCmdMsg', {
3829
+ customId: this.state.imRoomId,
3830
+ content: JSON.stringify({
3831
+ 'typeId': 1020,
3832
+ 'sessionId': this.state.sessionId,
3833
+ 'cameraState': 1, // 1--打开前置 2--打开后置
3834
+ "userId": this.state.faceCustomerUid
3835
+ })
3836
+ });
3717
3837
  this.setState({
3718
3838
  isModalVisibleFacial: false
3719
3839
  })
@@ -3795,6 +3915,18 @@ class Video extends Component {
3795
3915
  if(item.tourist) {
3796
3916
  this.retrieveCustomerInfoByActivityId(item.customId)
3797
3917
  } else {
3918
+ if(this.state.faceCustomerType == 2) {
3919
+ // ocr
3920
+ callNimIM('sendCustomCmdMsg', {
3921
+ customId: this.state.imRoomId,
3922
+ content: JSON.stringify({
3923
+ 'typeId': 1020,
3924
+ 'sessionId': this.state.sessionId,
3925
+ 'cameraState': 2, // 1--打开前置 2--打开后置
3926
+ "userId": item.customId
3927
+ })
3928
+ });
3929
+ }
3798
3930
  var sid
3799
3931
  if (item.feedId == document.getElementById("feedId1").innerText) {
3800
3932
  sid = document.getElementById('video1').name;
@@ -3827,12 +3959,21 @@ class Video extends Component {
3827
3959
  this.setState({
3828
3960
  clickedFacial: false,
3829
3961
  clickedOcr: false,
3830
-
3831
3962
  isModalVisibleFacial: true,
3832
3963
  facialImg: this.test_controller.TakePicture(1, undefined, undefined, sid, 'png')
3833
3964
  })
3965
+ setTimeout(() => {
3966
+ this.setState({
3967
+ facialImg: this.test_controller.TakePicture(1, undefined, undefined, sid, 'png')
3968
+ })
3969
+ },1000)
3834
3970
  }
3835
3971
  }
3972
+ sgsinImage=()=>{
3973
+ this.setState({
3974
+ facialImg: this.test_controller.TakePicture(1, undefined, undefined, this.state.customOcrSid, 'png')
3975
+ })
3976
+ }
3836
3977
  handleChangeOcr =(val)=> {
3837
3978
  console.log(val)
3838
3979
  this.setState({
@@ -3856,7 +3997,8 @@ class Video extends Component {
3856
3997
  console.log(result)
3857
3998
 
3858
3999
  if (result.code == 200) {
3859
- data = result.data.username ? result.data.username : ''
4000
+ data = result.data ? result.data : ''
4001
+ // data = result.data.username ? result.data.username : ''
3860
4002
  }
3861
4003
  return data
3862
4004
  }catch (err) {
@@ -4257,6 +4399,21 @@ class Video extends Component {
4257
4399
  microphoneValue: event.target.value
4258
4400
  })
4259
4401
  }
4402
+ beautyClick = () =>{
4403
+ const publish_config = {}
4404
+ publish_config.sid = document.getElementById('publish_video1').name
4405
+ publish_config.media_type = 1
4406
+ publish_config.publish_device = 1
4407
+ publish_config.videoSource = this.state.cameraValue
4408
+ publish_config.audioSource = this.state.microphoneValue
4409
+ publish_config.video_profile_type=100
4410
+ publish_config.video_profile_diy={width:640, height:360, frameRate:15, bitrate:400}
4411
+ this.test_controller.ChangeMediaStream(publish_config)
4412
+ beautyNum = beautyNum == 0 ? 2 : 0
4413
+ this.setState({
4414
+ beautyName: beautyNum == 0 ? '开启美颜' : '关闭美颜'
4415
+ })
4416
+ }
4260
4417
  componentDidMount() {
4261
4418
  var box=document.getElementById("whiteboardDIV");
4262
4419
  if(box){ //此处在加一层判断,更加严密,如果box存在的情况下获取
@@ -5010,6 +5167,7 @@ class Video extends Component {
5010
5167
  </div>
5011
5168
  </div>
5012
5169
  <Foot
5170
+ beautyName={this.state.beautyName}
5013
5171
  voiceName={this.state.voiceName}
5014
5172
  img={this.state.voiceImg}
5015
5173
  screenName={this.state.screenName}
@@ -5035,6 +5193,7 @@ class Video extends Component {
5035
5193
  ocrClick={this.ocrClick}
5036
5194
  switchExternal={this.switchExternal}
5037
5195
  inspection={this.inspection}
5196
+ beautyClick={this.beautyClick}
5038
5197
  ></Foot>
5039
5198
  <Modal cancelText="取消" okText="确定" visible={this.state.isModalVisible} onOk={this.handleOk}
5040
5199
  onCancel={this.handleCancel}>
@@ -5056,6 +5215,7 @@ class Video extends Component {
5056
5215
  <Modal title={this.state.titleModal} closable={false} centered={true} visible={this.state.isModalVisibleFacial} footer={[
5057
5216
  <div key='facial'>
5058
5217
  <Button className="modelButtonCancel" onClick={this.handleCancelFacial}>取消</Button>
5218
+ <Button className="modelButtonCancel" onClick={this.sgsinImage}>重新截图</Button>
5059
5219
  <Button className="modelButtonOk" type="primary" danger onClick={this.handleOkFacial}>确定</Button>
5060
5220
  </div>
5061
5221
  ]}>