react_hsbc_teller 1.9.29 → 1.9.31

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.9.29",
3
+ "version": "1.9.31",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -154,6 +154,26 @@ class API extends Server{
154
154
  throw err;
155
155
  }
156
156
  }
157
+ async uploadLogCallback(params = {}){
158
+ // return this.axios('get', '/lang/select/2', params);
159
+ try{
160
+ let result = await this.axios('post', '/sessionLog/saveOrUpdate', params);
161
+ // console.log(result)
162
+ if(result && (result.data instanceof Object) && result.code === 200){
163
+ return result||[];
164
+ }else{
165
+ let err = {
166
+ tip: '服务异常',
167
+ response: result,
168
+ data: params,
169
+ // url: 'https://api.cangdu.org/shopro/data/products',
170
+ }
171
+ throw err;
172
+ }
173
+ }catch(err){
174
+ throw err;
175
+ }
176
+ }
157
177
  async retrieveCustomerInfoByActivityId(params = {}){
158
178
  // return this.axios('get', '/lang/select/2', params);
159
179
  try{
@@ -296,7 +296,7 @@ class Video extends Component {
296
296
  saveLog = (val) => {
297
297
  axios({
298
298
  method: 'get',
299
- baseURL: this.props.logUrl + '&message=' + encodeURIComponent(val) + '&react_hsbc_teller=1.9.29&logTime=' + Date.now() + '&mtoken=' + encodeURIComponent(this.state.rtoken) + '&roomId=' + encodeURIComponent(this.state.channelId) + '&sessionId=' + encodeURIComponent(this.state.sessionId) + '&appointmentID=' + this.props.businessNumber,
299
+ baseURL: this.props.logUrl + '&message=' + encodeURIComponent(val) + '&react_hsbc_teller=1.9.31&logTime=' + Date.now() + '&mtoken=' + encodeURIComponent(this.state.rtoken) + '&roomId=' + encodeURIComponent(this.state.channelId) + '&sessionId=' + encodeURIComponent(this.state.sessionId) + '&appointmentID=' + this.props.businessNumber,
300
300
 
301
301
  }).then(res => {
302
302
 
@@ -2049,6 +2049,7 @@ class Video extends Component {
2049
2049
  console.log(config_param)
2050
2050
  console.log('发起订阅')
2051
2051
  this.test_controller.Subscribe(config_param)
2052
+ document.getElementById(config_param.subscribe_video_id).name = 'temp'
2052
2053
 
2053
2054
  }
2054
2055
  })
@@ -2497,6 +2498,23 @@ class Video extends Component {
2497
2498
  ) => {
2498
2499
  console.log('下载失败', clientRecordId, code, msg)
2499
2500
  };
2501
+ // 日志上传成功
2502
+ this.test_controller.OnUploadLogSucc = (filePath) => {
2503
+ // const filePath = 'https://mpaas.oss-cn-hk-hsbc-d01-a.ali-ops.cloud.cn.hsbc/log/0E6C7637D9A53DF38D4CFC614EC8915C_41B8EEB302057/wmzTeller_681269134338102_1681269140267_1.log?Expires=1681269740&OSSAccessKeyId=Cq0vGDNN7WQeyn8n&Signature=avYEdwRSdblKIY7LhB6FzwpPAD8%3D'
2504
+
2505
+ console.info('OnUploadLogSucc', filePath)
2506
+ this.saveLog('mrtc OnUploadLogSucc, filePath=' + filePath)
2507
+
2508
+ // const exp1 = /.+\.log/g
2509
+ // const url = filePath.match(exp1)[0]
2510
+ // console.log(url)
2511
+ this.uploadLogCallback(filePath)
2512
+ };
2513
+ this.test_controller.OnUploadLogFail = (code, err_msg) => {
2514
+ // test_controller.trace(`upload log failed, err_code=${code}, err_msg=${JSON.stringify(err_msg)}`);
2515
+ console.info('OnUploadLogFail', code, err_msg)
2516
+ this.saveLog('mrtc OnUploadLogFail, code=' + code, ',msg=' + err_msg)
2517
+ };
2500
2518
  // 切流成功通知
2501
2519
  this.test_controller.OnChangeMediaStreamSuccess = (sid) => {
2502
2520
  console.log('切流成功通知', sid);
@@ -2657,7 +2675,7 @@ class Video extends Component {
2657
2675
  }
2658
2676
  // 停止共享
2659
2677
  this.test_controller.OnDesktopDisplayClosed = () => {
2660
- console.log('OnDesktopDisplayClosed', this.state.isSharedScreen, this.state.laveRoomSharedScreen)
2678
+ console.log('OnDesktopDisplayClosed', this.state.isSharedScreen, this.state.laveRoomSharedScreen, streamShare)
2661
2679
 
2662
2680
  if (this.state.isScreenSwitching) {
2663
2681
  this.state.isScreenSwitching = false
@@ -2703,6 +2721,21 @@ class Video extends Component {
2703
2721
  }
2704
2722
  }
2705
2723
  }
2724
+ uploadLogCallback = async (url) => {
2725
+ try {
2726
+ let result = await API.uploadLogCallback({
2727
+ activityId: this.props.businessNumber,
2728
+ sessionId: this.state.sessionId,
2729
+ roomId: this.state.channelId + '',
2730
+ tellerAccount: this.props.tellerAccount,
2731
+ fileUrl: url
2732
+ });
2733
+ } catch (err) {
2734
+ // console.error(err);
2735
+ if (err.status == 502 || err.status == 404) {
2736
+ }
2737
+ }
2738
+ }
2706
2739
  // 保存mettingInfo
2707
2740
  updateMeetingInfo = async () => {
2708
2741
  let customers
@@ -2939,13 +2972,13 @@ class Video extends Component {
2939
2972
  if (document.all) { //如果是IE
2940
2973
  script.onreadystatechange = () => {
2941
2974
  if (script.readyState == 'loaded' || script.readyState == 'complete') {
2942
- that.test_controller = new McuController();
2975
+ that.test_controller = new MeetingController();
2943
2976
  that.mountClick()
2944
2977
  }
2945
2978
  }
2946
2979
  } else {
2947
2980
  script.onload = () => {
2948
- that.test_controller = new McuController();
2981
+ that.test_controller = new MeetingController();
2949
2982
  that.mountClick()
2950
2983
  }
2951
2984
  }
@@ -2968,7 +3001,7 @@ class Video extends Component {
2968
3001
  }
2969
3002
  }
2970
3003
  componentWillMount() {
2971
- console.log('hsbc_teller_sdk', '1.9.29')
3004
+ console.log('hsbc_teller_sdk', '1.9.31')
2972
3005
  let arr = []
2973
3006
  for(let i=1;i<=12;i++){
2974
3007
  arr.push({
@@ -2982,6 +3015,18 @@ class Video extends Component {
2982
3015
  }
2983
3016
  this.setState({
2984
3017
  videoList: arr
3018
+ }, () => {
3019
+ // 设置播放回调
3020
+ for(let i=1;i<=12;i++){
3021
+ let dom = document.getElementById('video'+ i)
3022
+ dom.addEventListener("loadedmetadata", (event) => {
3023
+ console.log('video'+ i +' loadedmetadata:' + dom.srcObject.id)
3024
+ this.saveLog('video'+ i +' loadedmetadata, id=' + dom.srcObject.id)
3025
+ // let arrItem = this.state.videoList.find(el => el.idIndex == i) || {}
3026
+ // console.log(arrItem.videoName)
3027
+
3028
+ });
3029
+ }
2985
3030
  })
2986
3031
  if (this.props.sessionId) {
2987
3032
  this.getRoomStatus({
@@ -4255,8 +4300,10 @@ class Video extends Component {
4255
4300
  canvas.width = 960;
4256
4301
  canvas.height = 540;
4257
4302
 
4258
-
4259
- videoMedia.addEventListener('play', (event) => {
4303
+ if (this.state.whiteboardPlayEvent) {
4304
+ videoMedia.removeEventListener('play', this.state.whiteboardPlayEvent)
4305
+ }
4306
+ this.state.whiteboardPlayEvent = (event) => {
4260
4307
  var $this = this; //cache
4261
4308
  if ($this.state.operateShow) {
4262
4309
  isGraffiti = false
@@ -4304,7 +4351,8 @@ class Video extends Component {
4304
4351
  publish_config.publish_tag = 'projectionWhiteboard'
4305
4352
  this.test_controller.Publish(publish_config)
4306
4353
  }
4307
- }, 0);
4354
+ }
4355
+ videoMedia.addEventListener('play', this.state.whiteboardPlayEvent);
4308
4356
  navigator.mediaDevices.getDisplayMedia({
4309
4357
  video: true,
4310
4358
  preferCurrentTab: true,
@@ -4336,6 +4384,16 @@ class Video extends Component {
4336
4384
  that.test_controller.UnPublish(document.getElementById('video20').name)
4337
4385
  }
4338
4386
  }
4387
+
4388
+ // 关闭当前共享屏幕
4389
+ document.getElementById('video20') && document.getElementById('video20').name ? this.test_controller.UnPublish(document.getElementById('video20').name) : ''
4390
+ that.state.isSharedScreen = false
4391
+ that.state.isScreenSwitching = false
4392
+ that.setState({
4393
+ screenName: '共享模式'
4394
+ });
4395
+ that.tabTitlesClick('RMScreen', 'delect')
4396
+
4339
4397
  }, error => {
4340
4398
  console.log("Unable to acquire screen capture", error);
4341
4399
  });
@@ -30,7 +30,26 @@ function compressImage(base64, callback) {
30
30
  callback(base64); //必须通过回调函数返回,否则无法及时拿到该值
31
31
  }
32
32
  }
33
-
33
+ function debounce(fn, delay = 500) {
34
+ // 是闭包中的
35
+ let timer
36
+
37
+ // input事件调用的函数,相当于obj调用函数 this指向Input
38
+ return function() {
39
+ // 这个if 判断不做也没关系,判断了(除第一次非空的情况)也就是执行从第二次开始,在延迟时间内多次触发才会走该判断
40
+ if(timer) {clearTimeout(timer)}
41
+ // 此时的箭头函数的this 和 arguments 都是从外部函数继承而来
42
+ // 如果用普通函数就要用词法作用域 var tshat = this var arg = arguments
43
+ timer = setTimeout(() =>{
44
+ // 使得传入的回调函数的this 指向Input这个元素对象
45
+ // arguments是该事件的详情,可以获得该函数被调用时的所有参数,是一个event 对象(所有Dom事件都会传event对象进入)
46
+ // 直接使用 fn() 问题也不大
47
+ fn.apply(this,arguments)
48
+ timer = null
49
+ },delay)
50
+ }
51
+ }
34
52
  export {
35
- compressImage
53
+ compressImage,
54
+ debounce
36
55
  }