react_hsbc_teller 1.6.7 → 1.7.1

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,6 +4,7 @@
4
4
  import React, { Component, useState } from 'react';
5
5
  import API from '../../api/api';
6
6
  import { initWebSocket, joinRoom, disconnect } from '../../common/websocket';
7
+ import { BoardOperate } from '../../common/index.esm.js';
7
8
  import './video.less'
8
9
  import Header from '../header/header.jsx'
9
10
  import Foot from '../foot/foot.jsx'
@@ -23,10 +24,11 @@ import Spin from "antd/lib/spin";
23
24
  import 'antd/lib/spin/style'
24
25
  import Select from "antd/lib/select";
25
26
  import 'antd/lib/select/style'
26
-
27
+ import styled from 'styled-components';
27
28
  import { Button } from '../../../node_modules/antd/lib/index';
28
29
  import SignMy from '../sign/signMy.jsx'
29
30
  import axios from 'axios';
31
+ import CryptoJS from "crypto-js";
30
32
  const { Option } = Select;
31
33
  const LEAVE_TYPE = {
32
34
  TELLER_EXIT: 1, // 坐席退出
@@ -42,6 +44,37 @@ let messageValue = ''
42
44
  let beautyNum = 0 // 0-关闭 1--弱 2--中 5---高
43
45
  let rateList = []
44
46
  let beautyDiv = {};
47
+ let CanvasHome = styled.div`
48
+ position: fixed;
49
+ width: 76vw;
50
+ height: 74vh;
51
+ top: 3vh;
52
+ left: 1.5vw;
53
+ z-index: ${props=>props.zIndexNum};
54
+
55
+ .canvas{
56
+ width:100%;
57
+
58
+ height:100%;
59
+ box-shadow: 0 0 5px 0 #06a;
60
+ display:none;
61
+ }
62
+ `;
63
+ const OpreateDiv = styled.div`
64
+ display: inline-block;
65
+ margin-left: 10vw;
66
+ padding: 0 6px;
67
+ height: 40px;
68
+ line-height: 40px;
69
+ border-radius: 5px;
70
+ background: #fff;
71
+ font-size: 16px;
72
+ border: #333 1px solid;
73
+ span{
74
+ margin-right:10px;
75
+ cursor:pointer;
76
+ }
77
+ `;
45
78
  function clearStreamRemain() {
46
79
  if (!(beautyDiv.beauty_canvas == null || beautyDiv.beauty_canvas == undefined)) {
47
80
  beautyDiv.beauty_canvas = null;
@@ -69,6 +102,7 @@ message.config({
69
102
  class Video extends Component {
70
103
  constructor(props) {
71
104
  super(props)
105
+ this.boardOperate = null;
72
106
  }
73
107
  cancel = axios.CancelToken.source()
74
108
  state = {
@@ -78,6 +112,8 @@ class Video extends Component {
78
112
  isScreenSwitching: false,
79
113
  whiteboardWidth: '',
80
114
  whiteboardHeight: '',
115
+ whiteboardTop: '',
116
+ whiteboardLeft: '',
81
117
  laveRoomSharedScreen: false,
82
118
  isJoinRoom: false,
83
119
  sessionType: false,
@@ -213,10 +249,18 @@ class Video extends Component {
213
249
  ],
214
250
  shareMaskState: false,
215
251
  idCardName: '',
216
- idCardNumber: ''
252
+ idCardNumber: '',
253
+ operateShow: false,
254
+ drawConfig: {
255
+ curryControl: 'pen', // 工具类型
256
+ },
257
+ zIndexNum: -1,
258
+ selectSpan: 'pen'
217
259
  };
218
260
  // eslint-disable-next-line no-undef
219
261
  test_controller = '';
262
+
263
+
220
264
  /**
221
265
  * 创建房间成功后回调后台
222
266
  * @param {JSON} data 数据类型
@@ -297,6 +341,35 @@ class Video extends Component {
297
341
 
298
342
  }
299
343
  };
344
+ decrypt(data) {
345
+ let keyStr = "le&&If?()*^%$#hA"
346
+ let iv = CryptoJS.enc.Utf8.parse("jwe232DEE?^%$eq3")
347
+ let encryptedHexStr = CryptoJS.enc.Hex.parse(data);
348
+ let content = CryptoJS.enc.Base64.stringify(encryptedHexStr);
349
+ let key = CryptoJS.enc.Utf8.parse(keyStr);
350
+ let decrypt = CryptoJS.AES.decrypt(content, key, {
351
+ iv: iv,
352
+ mode: CryptoJS.mode.CBC,
353
+ padding: CryptoJS.pad.Pkcs7,
354
+ });
355
+ return CryptoJS.enc.Utf8.stringify(decrypt).toString();
356
+ }
357
+ encrypt(data) {
358
+ let keyStr = "le&&If?()*^%$#hA"
359
+ let iv = CryptoJS.enc.Utf8.parse("jwe232DEE?^%$eq3")
360
+ let dataString = data;
361
+ if (typeof data !== "string") {
362
+ dataString = JSON.stringify(data);
363
+ }
364
+ const key = CryptoJS.enc.Utf8.parse(keyStr);
365
+ let sc = CryptoJS.enc.Utf8.parse(dataString);
366
+ let encrypted = CryptoJS.AES.encrypt(sc, key, {
367
+ iv: iv,
368
+ mode: CryptoJS.mode.CBC,
369
+ padding: CryptoJS.pad.Pkcs7,
370
+ });
371
+ return encrypted.ciphertext.toString();
372
+ }
300
373
  /**
301
374
  * 初始化获取数据
302
375
  * @param {JSON} data 数据类型
@@ -304,18 +377,13 @@ class Video extends Component {
304
377
  mpaasSig = async data => {
305
378
  console.log(data);
306
379
  try {
307
- let result = await API.mpaasSig({ account: data.account, type: data.type });
308
- console.log(result);
380
+ // let result = JSON.parse(this.decrypt(await API.mpaasSig({ ciphertext: this.encrypt({account: data.account, type: data.type})})));
381
+ let result = await API.mpaasSig({account: data.account, type: data.type});
382
+ console.log('mpaasSig',result,result.mpsSig);
309
383
  window.sessionStorage.setItem('alimpassSig', result.mpsSig);
310
384
  this.state.workSpaceId = result.workspaceId,
311
385
  this.state.appId = result.appId,
312
386
  this.state.bizName = result.bizName
313
- // const data1={
314
- // hostname: 'im.uat.dsp.hsbcfts.com.cn',
315
- // webPort: '443',
316
- // account: 'web',
317
- // openfireToken: '123'
318
- // }
319
387
  window.sessionStorage.setItem('sigData', JSON.stringify(result));
320
388
  if (data.sigType == 1) {
321
389
  this.handleEdit()
@@ -2500,6 +2568,12 @@ class Video extends Component {
2500
2568
  this.test_controller.OnNewJoinerIn = (participant) => {
2501
2569
  console.log('新加⼊房间者', participant);
2502
2570
  this.state.isCustomer= true
2571
+ if(this.props.isOpenSound) {
2572
+ let src = autod
2573
+ let audio = new Audio(src)
2574
+ audio.play()
2575
+ }
2576
+
2503
2577
  // let src = autod
2504
2578
  // let audio = new Audio(src)
2505
2579
  // audio.play()
@@ -2887,9 +2961,13 @@ class Video extends Component {
2887
2961
  exitType
2888
2962
  ) => {
2889
2963
  console.log('退出房间者', participant, exitType)
2890
- // let src = leftMetting
2891
- // let audio = new Audio(src)
2892
- // audio.play()
2964
+ if(this.props.isOpenSound) {
2965
+ let src = leftMetting
2966
+ let audio = new Audio(src)
2967
+ audio.play()
2968
+ }
2969
+
2970
+
2893
2971
  this.appGetUsernameClick(participant).then((res)=>{
2894
2972
  console.log('退出房间者',res)
2895
2973
  let data = res? res.username ? res.username : '客户' : '客户'
@@ -3262,6 +3340,7 @@ userType:'1'
3262
3340
  let result = await API.videoRecordCallback({
3263
3341
  activityId: this.props.businessNumber,
3264
3342
  sessionId: this.state.sessionId,
3343
+ roomId: this.state.channelId + '',
3265
3344
  type: type,
3266
3345
  status: status
3267
3346
  });
@@ -3457,7 +3536,6 @@ userType:'1'
3457
3536
 
3458
3537
  this.props.resourcePath + "/eruda.js",
3459
3538
  this.props.resourcePath + "/iconfont.js",
3460
- this.props.resourcePath + "/dialogue.css",
3461
3539
 
3462
3540
 
3463
3541
 
@@ -3648,7 +3726,7 @@ userType:'1'
3648
3726
  // publish_config.video_profile_diy={width:1280, height:720, frameRate:8, bitrate:1500}
3649
3727
  publish_config.enableDesktopAudio=true
3650
3728
  publish_config.degradationType=2
3651
- publish_config.desktopStreamToCanvas=true
3729
+ publish_config.desktopStreamToCanvas=false
3652
3730
  publish_config.sid = document.getElementById('video20').name
3653
3731
  this.test_controller.ChangeMediaStream(publish_config)
3654
3732
  this.state.isScreenSwitching = true
@@ -3660,7 +3738,7 @@ userType:'1'
3660
3738
  // publish_config.video_profile_type=100
3661
3739
  // publish_config.video_profile_diy={width:1280, height:720, frameRate:8, bitrate:1500}
3662
3740
  publish_config.enableDesktopAudio=true
3663
- publish_config.desktopStreamToCanvas=true
3741
+ publish_config.desktopStreamToCanvas=false
3664
3742
  publish_config.degradationType=2
3665
3743
  publish_config.sid = document.getElementById('video20').name;
3666
3744
  this.test_controller.ChangeMediaStream(publish_config);
@@ -3669,7 +3747,7 @@ userType:'1'
3669
3747
  publish_config.publish_device = 2
3670
3748
  publish_config.need_volume_analyser = true
3671
3749
  publish_config.video_profile_type = 1
3672
- publish_config.desktopStreamToCanvas=true
3750
+ publish_config.desktopStreamToCanvas=false
3673
3751
  // publish_config.video_profile_type=100
3674
3752
  // publish_config.video_profile_diy={width:1280, height:720, frameRate:8, bitrate:1500}
3675
3753
  publish_config.enableDesktopAudio=true
@@ -4414,13 +4492,87 @@ userType:'1'
4414
4492
  // }
4415
4493
  }
4416
4494
  }
4417
-
4418
4495
  this.navigatorClick()
4496
+
4419
4497
  } else {
4420
4498
  this.messageClick('internal staff正在共享屏幕,请先关闭','error')
4421
4499
  }
4422
4500
  }
4423
4501
  }
4502
+ openCanvas(drawCanvas) {
4503
+ if (!this.boardOperate) {
4504
+ this.boardOperate = new BoardOperate(drawCanvas, {
4505
+ drawColor: "#000000",
4506
+ drawType: "pen",
4507
+ lineWidth: 5,
4508
+ fillStyle: '', // 初始背景色,若为空则透明背景
4509
+ });
4510
+ }
4511
+ }
4512
+ closeCanvas() {
4513
+ this.boardOperate.destroy();
4514
+ this.boardOperate = null;
4515
+ }
4516
+
4517
+ setTool(type) {
4518
+ const { drawConfig } = this.state;
4519
+ drawConfig.curryControl = type;
4520
+ this.boardOperate.changeWay({
4521
+ type
4522
+ });
4523
+
4524
+ this.setState({ drawConfig,selectSpan: type });
4525
+ }
4526
+
4527
+ setOpreate(type) {
4528
+ this.boardOperate[type]();
4529
+ }
4530
+ downCanvas() {
4531
+ const canvas = document.getElementById('canvas');
4532
+ const base64 = canvas.toDataURL();
4533
+
4534
+
4535
+ let img = document.createElement('img');
4536
+ img.style.position = 'fixed';
4537
+ img.style.width = '90vw';
4538
+ img.style.height = '95vh';
4539
+ img.style.top = '9vh';
4540
+ img.style.left = '5vw';
4541
+ img.src = base64;
4542
+ document.body.appendChild(img);
4543
+
4544
+ }
4545
+ graffiti=()=>{
4546
+ if(!this.state.operateShow) {
4547
+ this.setState({
4548
+ zIndexNum: 999
4549
+ })
4550
+ this.change(true)
4551
+ }
4552
+
4553
+ }
4554
+ closeGraffiti=()=>{
4555
+ this.setState({
4556
+ zIndexNum: -1
4557
+ })
4558
+ this.change(false)
4559
+ }
4560
+ change(val) {
4561
+ this.setState({ operateShow: val })
4562
+ const canvas = document.getElementById('canvas');
4563
+ if (val) {
4564
+ canvas.style.display = 'block';
4565
+ canvas.width = canvas.clientWidth;
4566
+ canvas.height = canvas.clientHeight;
4567
+ setTimeout(() => {
4568
+ this.openCanvas(canvas)
4569
+ }, 0);
4570
+ } else {
4571
+ // this.downCanvas()
4572
+ this.closeCanvas();
4573
+ canvas.style.display = 'none';
4574
+ }
4575
+ }
4424
4576
  switchSelect = (value) => {
4425
4577
  this.setState({
4426
4578
  isSelect: value,
@@ -4494,6 +4646,8 @@ userType:'1'
4494
4646
  if(box){ //此处在加一层判断,更加严密,如果box存在的情况下获取
4495
4647
  this.state.whiteboardWidth = box.offsetWidth,
4496
4648
  this.state.whiteboardHeight = box.offsetHeight * 0.92,
4649
+ this.state.whiteboardTop = box.getBoundingClientRect().top * 1.08 - 40
4650
+ this.state.whiteboardLeft = box.getBoundingClientRect().left
4497
4651
  console.log('whiteboardDIV', this.state.whiteboardHeight,box.clientHeight,this.state.whiteboardWidth)
4498
4652
  }
4499
4653
  }
@@ -4783,7 +4937,19 @@ userType:'1'
4783
4937
  {tabTitleList}
4784
4938
  {/* <img style={sectionStyle} src={require("../../assets/img/placeholder_bg.png").default} alt="" /> */}
4785
4939
  <div id="whiteboardDIV" style={{height: 'calc(100% - 33px)'}}>
4786
-
4940
+ <CanvasHome zIndexNum={this.state.zIndexNum} style={{width: this.state.whiteboardWidth,height: this.state.whiteboardHeight,top: this.state.whiteboardTop,left:this.state.whiteboardLeft}}>
4941
+ {this.state.operateShow &&
4942
+ <OpreateDiv id="operate">
4943
+ <span style={{color: this.state.selectSpan == 'pen' ? '#1890ff' : '#333'}} onClick={() => this.setTool('pen')}>铅笔</span>
4944
+ <span style={{color: this.state.selectSpan == 'eraser' ? '#1890ff' : '#333'}} onClick={() => this.setTool('eraser')}>橡皮</span>
4945
+ <span onClick={() => this.setOpreate('undo')}>撤销</span>
4946
+ <span onClick={() => this.setOpreate('redo')}>恢复</span>
4947
+ <span onClick={() => this.setOpreate('clear')}>清除</span>
4948
+ <span onClick={() => this.closeGraffiti()}>关闭</span>
4949
+ </OpreateDiv>
4950
+ }
4951
+ <canvas id="canvas" className="canvas"></canvas>
4952
+ </CanvasHome>
4787
4953
  <div className="videoDiv" style={{ display: (this.state.isSelect == 'RMScreen' || this.state.isSelect == 'staffScreen') ? '' : 'none', }}>
4788
4954
  <div className="videoDiv">
4789
4955
  <video
@@ -5275,6 +5441,7 @@ userType:'1'
5275
5441
  switchExternal={this.switchExternal}
5276
5442
  inspection={this.inspection}
5277
5443
  beautyClick={this.beautyClick}
5444
+ graffiti={this.graffiti}
5278
5445
  ></Foot>
5279
5446
  <Modal cancelText="取消" okText="确定" visible={this.state.isModalVisible} onOk={this.handleOk}
5280
5447
  onCancel={this.handleCancel}>
@@ -5439,7 +5606,7 @@ sessionId: "",
5439
5606
  microphoneSize: 25,
5440
5607
  fontSize: '14',
5441
5608
  fontFamily: 'auto',
5442
- menus: ['BOARD','SHARE', 'FRIES', 'OCR', 'INVITE', 'PIP', 'BEAUTY'],
5609
+ menus: ['BOARD','SHARE', 'FRIES', 'OCR', 'INVITE', 'PIP', 'BEAUTY','GRAFFITI'],
5443
5610
  customLeaveRoom: '客户离开房间',
5444
5611
  meetingInfo: {
5445
5612
  title: '--',
@@ -5449,6 +5616,7 @@ sessionId: "",
5449
5616
  },
5450
5617
  isTranscribing: false,
5451
5618
  shareMask: false,
5619
+ isOpenSound: false, // true开启进出音效 false不开启
5452
5620
  internalUrl: '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'
5453
5621
  }
5454
5622
  export default Video