react_hsbc_teller 1.9.29 → 1.9.30

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.30",
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.30&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
 
@@ -2497,6 +2497,23 @@ class Video extends Component {
2497
2497
  ) => {
2498
2498
  console.log('下载失败', clientRecordId, code, msg)
2499
2499
  };
2500
+ // 日志上传成功
2501
+ this.test_controller.OnUploadLogSucc = (filePath) => {
2502
+ // 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'
2503
+
2504
+ console.info('OnUploadLogSucc', filePath)
2505
+ this.saveLog('mrtc OnUploadLogSucc, filePath=' + filePath)
2506
+
2507
+ // const exp1 = /.+\.log/g
2508
+ // const url = filePath.match(exp1)[0]
2509
+ // console.log(url)
2510
+ this.uploadLogCallback(filePath)
2511
+ };
2512
+ this.test_controller.OnUploadLogFail = (code, err_msg) => {
2513
+ // test_controller.trace(`upload log failed, err_code=${code}, err_msg=${JSON.stringify(err_msg)}`);
2514
+ console.info('OnUploadLogFail', code, err_msg)
2515
+ this.saveLog('mrtc OnUploadLogFail, code=' + code, ',msg=' + err_msg)
2516
+ };
2500
2517
  // 切流成功通知
2501
2518
  this.test_controller.OnChangeMediaStreamSuccess = (sid) => {
2502
2519
  console.log('切流成功通知', sid);
@@ -2657,7 +2674,7 @@ class Video extends Component {
2657
2674
  }
2658
2675
  // 停止共享
2659
2676
  this.test_controller.OnDesktopDisplayClosed = () => {
2660
- console.log('OnDesktopDisplayClosed', this.state.isSharedScreen, this.state.laveRoomSharedScreen)
2677
+ console.log('OnDesktopDisplayClosed', this.state.isSharedScreen, this.state.laveRoomSharedScreen, streamShare)
2661
2678
 
2662
2679
  if (this.state.isScreenSwitching) {
2663
2680
  this.state.isScreenSwitching = false
@@ -2703,6 +2720,21 @@ class Video extends Component {
2703
2720
  }
2704
2721
  }
2705
2722
  }
2723
+ uploadLogCallback = async (url) => {
2724
+ try {
2725
+ let result = await API.uploadLogCallback({
2726
+ activityId: this.props.businessNumber,
2727
+ sessionId: this.state.sessionId,
2728
+ roomId: this.state.channelId + '',
2729
+ tellerAccount: this.props.tellerAccount,
2730
+ fileUrl: url
2731
+ });
2732
+ } catch (err) {
2733
+ // console.error(err);
2734
+ if (err.status == 502 || err.status == 404) {
2735
+ }
2736
+ }
2737
+ }
2706
2738
  // 保存mettingInfo
2707
2739
  updateMeetingInfo = async () => {
2708
2740
  let customers
@@ -2939,13 +2971,13 @@ class Video extends Component {
2939
2971
  if (document.all) { //如果是IE
2940
2972
  script.onreadystatechange = () => {
2941
2973
  if (script.readyState == 'loaded' || script.readyState == 'complete') {
2942
- that.test_controller = new McuController();
2974
+ that.test_controller = new MeetingController();
2943
2975
  that.mountClick()
2944
2976
  }
2945
2977
  }
2946
2978
  } else {
2947
2979
  script.onload = () => {
2948
- that.test_controller = new McuController();
2980
+ that.test_controller = new MeetingController();
2949
2981
  that.mountClick()
2950
2982
  }
2951
2983
  }
@@ -2968,7 +3000,7 @@ class Video extends Component {
2968
3000
  }
2969
3001
  }
2970
3002
  componentWillMount() {
2971
- console.log('hsbc_teller_sdk', '1.9.29')
3003
+ console.log('hsbc_teller_sdk', '1.9.30')
2972
3004
  let arr = []
2973
3005
  for(let i=1;i<=12;i++){
2974
3006
  arr.push({
@@ -2982,6 +3014,18 @@ class Video extends Component {
2982
3014
  }
2983
3015
  this.setState({
2984
3016
  videoList: arr
3017
+ }, () => {
3018
+ // 设置播放回调
3019
+ for(let i=1;i<=12;i++){
3020
+ let dom = document.getElementById('video'+ i)
3021
+ dom.addEventListener("loadedmetadata", (event) => {
3022
+ console.log('video'+ i +' loadedmetadata:' + dom.srcObject.id)
3023
+ this.saveLog('video'+ i +' loadedmetadata, id=' + dom.srcObject.id)
3024
+ // let arrItem = this.state.videoList.find(el => el.idIndex == i) || {}
3025
+ // console.log(arrItem.videoName)
3026
+
3027
+ });
3028
+ }
2985
3029
  })
2986
3030
  if (this.props.sessionId) {
2987
3031
  this.getRoomStatus({
@@ -4255,8 +4299,10 @@ class Video extends Component {
4255
4299
  canvas.width = 960;
4256
4300
  canvas.height = 540;
4257
4301
 
4258
-
4259
- videoMedia.addEventListener('play', (event) => {
4302
+ if (this.state.whiteboardPlayEvent) {
4303
+ videoMedia.removeEventListener('play', this.state.whiteboardPlayEvent)
4304
+ }
4305
+ this.state.whiteboardPlayEvent = (event) => {
4260
4306
  var $this = this; //cache
4261
4307
  if ($this.state.operateShow) {
4262
4308
  isGraffiti = false
@@ -4304,7 +4350,8 @@ class Video extends Component {
4304
4350
  publish_config.publish_tag = 'projectionWhiteboard'
4305
4351
  this.test_controller.Publish(publish_config)
4306
4352
  }
4307
- }, 0);
4353
+ }
4354
+ videoMedia.addEventListener('play', this.state.whiteboardPlayEvent);
4308
4355
  navigator.mediaDevices.getDisplayMedia({
4309
4356
  video: true,
4310
4357
  preferCurrentTab: true,
@@ -4336,6 +4383,16 @@ class Video extends Component {
4336
4383
  that.test_controller.UnPublish(document.getElementById('video20').name)
4337
4384
  }
4338
4385
  }
4386
+
4387
+ // 关闭当前共享屏幕
4388
+ document.getElementById('video20') && document.getElementById('video20').name ? this.test_controller.UnPublish(document.getElementById('video20').name) : ''
4389
+ that.state.isSharedScreen = false
4390
+ that.state.isScreenSwitching = false
4391
+ that.setState({
4392
+ screenName: '共享模式'
4393
+ });
4394
+ that.tabTitlesClick('RMScreen', 'delect')
4395
+
4339
4396
  }, error => {
4340
4397
  console.log("Unable to acquire screen capture", error);
4341
4398
  });
@@ -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
  }