react_hsbc_teller 1.3.7 → 1.4.0

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.3.7",
3
+ "version": "1.4.0",
4
4
  "description": "React",
5
5
  "private": false,
6
6
  "main": "lib/hsbc.js",
@@ -1,7 +1,26 @@
1
1
  import Server from './server';
2
2
 
3
3
  class API extends Server{
4
-
4
+ async getBase64Image(params = {}){
5
+ // return this.axios('get', '/lang/select/2', params);
6
+ try{
7
+ let result = await this.axios('get', '/hsbc/getBase64Image?fileName=' + params.fileName, params);
8
+ console.log('getBase64Image',result)
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 videoRecordCallback(params = {}){
6
25
  // return this.axios('get', '/lang/select/2', params);
7
26
  try{
@@ -38,6 +38,23 @@ let streamShare
38
38
  let muteJson = new Map()
39
39
  let dateTime = 0
40
40
  let messageValue = ''
41
+ var os = function() {
42
+ var ua = navigator.userAgent,
43
+ isWindowsPhone = /(?:Windows Phone)/.test(ua),
44
+ isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone,
45
+ isAndroid = /(?:Android)/.test(ua),
46
+ isFireFox = /(?:Firefox)/.test(ua),
47
+ isChrome = /(?:Chrome|CriOS)/.test(ua),
48
+ isTablet = /(?:iPad|PlayBook)/.test(ua) || (isAndroid && !/(?:Mobile)/.test(ua)) || (isFireFox && /(?:Tablet)/.test(ua)),
49
+ isPhone = /(?:iPhone)/.test(ua) && !isTablet,
50
+ isPc = !isPhone && !isAndroid && !isSymbian;
51
+ return {
52
+ isTablet: isTablet,
53
+ isPhone: isPhone,
54
+ isAndroid: isAndroid,
55
+ isPc: isPc
56
+ };
57
+ }();
41
58
  message.config({
42
59
  getContainer: ()=>document.getElementById('allHSBC')
43
60
  })
@@ -257,6 +274,19 @@ class Video extends Component {
257
274
 
258
275
  }
259
276
  };
277
+ getBase64Image = async data => {
278
+ try {
279
+ let result = await API.getBase64Image({ fileName: data});
280
+ console.log('getBase64Image',result)
281
+ this.props.imgCallback({
282
+ type: result.data.type + '',
283
+ file: result.data.base64Image}
284
+ )
285
+ } catch (err) {
286
+ console.error(err);
287
+
288
+ }
289
+ };
260
290
  /**
261
291
  * 初始化获取数据
262
292
  * @param {JSON} data 数据类型
@@ -1424,10 +1454,12 @@ class Video extends Component {
1424
1454
  // 一炒多的图片
1425
1455
  if (Mival.sessionId == this.state.sessionId) {
1426
1456
  this.props.imgCallback({
1427
- type: Mival.data.type,
1457
+ type: Mival.data.type + '',
1428
1458
  file: Mival.data.file}
1429
1459
  ) // 文字抄录和风险抄录,3--风险,,2--文字
1430
1460
  }
1461
+ } else if (Mival.typeId == 1321) {
1462
+ this.getBase64Image(Mival.fileName)
1431
1463
  } else if (Mival.typeId == 1216) {
1432
1464
  // 签字回调
1433
1465
  if (Mival.sessionId == this.state.sessionId) {
@@ -2718,7 +2750,7 @@ class Video extends Component {
2718
2750
  this.test_controller.OnStartRemoteRecordSucc = (record_id) => {
2719
2751
  console.log('开始服务端录制成功', record_id);
2720
2752
  this.state.recordId = record_id
2721
- this.videoRecordCallback('1')
2753
+ this.videoRecordCallback('1',true)
2722
2754
  };
2723
2755
  // 开始服务端录制失败
2724
2756
  this.test_controller.OnStartRemoteRecordFailed = (
@@ -2726,12 +2758,13 @@ class Video extends Component {
2726
2758
  err_code,
2727
2759
  err_msg
2728
2760
  ) => {
2761
+ this.videoRecordCallback('1',false)
2729
2762
  console.log('开始服务端录制失败', record_id, err_code, err_msg)
2730
2763
  };
2731
2764
  // 结束服务端录制成功
2732
2765
  this.test_controller.OnStopRemoteRecordSucc = (recordId) => {
2733
2766
  console.log('结束服务端录制成功', recordId);
2734
- this.videoRecordCallback('2')
2767
+ this.videoRecordCallback('2',true)
2735
2768
  // this.endSessionValue()
2736
2769
  // 获取服务端录制结果
2737
2770
  };
@@ -2741,6 +2774,7 @@ class Video extends Component {
2741
2774
  err_code,
2742
2775
  err_msg
2743
2776
  ) => {
2777
+ this.videoRecordCallback('2',false)
2744
2778
  console.log('结束服务端录制失败', recordId, err_code, err_msg)
2745
2779
  };
2746
2780
  // 开启浏览器录制成功
@@ -3054,12 +3088,13 @@ class Video extends Component {
3054
3088
 
3055
3089
  };
3056
3090
  }
3057
- videoRecordCallback = async(type)=>{
3091
+ videoRecordCallback = async(type,status)=>{
3058
3092
  try {
3059
3093
  let result = await API.videoRecordCallback({
3060
3094
  activityId: this.props.businessNumber,
3061
3095
  sessionId: this.state.sessionId,
3062
- type: type
3096
+ type: type,
3097
+ status: status
3063
3098
  });
3064
3099
  console.log(result);
3065
3100
  } catch (err) {
@@ -3989,8 +4024,15 @@ class Video extends Component {
3989
4024
  handleCancelSign=()=>{
3990
4025
  this.signCanvas.current.clear()
3991
4026
  }
3992
-
4027
+
3993
4028
  navigatorClick=()=>{
4029
+ if(os.isAndroid || os.isPhone) {
4030
+ console.log("手机")
4031
+ } else if(os.isTablet) {
4032
+ console.log("平板")
4033
+ } else if(os.isPc) {
4034
+ console.log("电脑")
4035
+ }
3994
4036
  const that = this
3995
4037
  const publish_config = {};
3996
4038
  const canvas = document.createElement('canvas');
@@ -4000,10 +4042,22 @@ class Video extends Component {
4000
4042
  const right = document.getElementById("whiteboardDIV").getBoundingClientRect().right
4001
4043
  const top = document.getElementById("whiteboardDIV").getBoundingClientRect().top
4002
4044
  const bottom = document.getElementById("whiteboardDIV").getBoundingClientRect().bottom
4003
- const width = (right - left)* window.screen.width / document.body.clientWidth
4004
- const height = ((bottom - top)* window.screen.width / document.body.clientWidth) - 50
4005
- const x = left * window.screen.width / document.body.clientWidth
4006
- const y = top* window.screen.width / document.body.clientWidth
4045
+ let width = 0
4046
+ let height = 0
4047
+ let x = 0
4048
+ let y = 0
4049
+ // if(os.isTablet){
4050
+ width = (right - left)* window.screen.width / document.body.clientWidth
4051
+ height = ((bottom - top)* window.screen.width / document.body.clientWidth) - 50
4052
+ x = left * window.screen.width / document.body.clientWidth
4053
+ y = top* window.screen.width / document.body.clientWidth
4054
+ // }
4055
+ // if(os.isPc) {
4056
+ // width = right - left
4057
+ // height = bottom - top
4058
+ // x = left
4059
+ // y = top
4060
+ // }
4007
4061
  canvas.width = 1280;
4008
4062
  canvas.height = 720;
4009
4063
  cobj.fillStyle = 'rgb(255 255 255)'
@@ -4059,12 +4113,19 @@ class Video extends Component {
4059
4113
  streamShare = ''
4060
4114
  }
4061
4115
  videoMedia.srcObject = stream;
4062
- stream.getVideoTracks()[0].applyConstraints({
4063
- // width: document.body.clientWidth,
4064
- // height: document.body.clientHeight
4065
- width: window.screen.width,
4066
- height: window.screen.height
4067
- })
4116
+ // if(os.isTablet){
4117
+ stream.getVideoTracks()[0].applyConstraints({
4118
+ width: window.screen.width,
4119
+ height: window.screen.height
4120
+ })
4121
+ // }
4122
+ // if(os.isPc) {
4123
+ // stream.getVideoTracks()[0].applyConstraints({
4124
+ // width: document.body.clientWidth,
4125
+ // height: document.body.clientHeight - 50
4126
+ // })
4127
+ // }
4128
+
4068
4129
  streamShare = stream
4069
4130
  stream.getVideoTracks()[0].onended = async ()=>{
4070
4131
  //单击停止共享按钮后,触发这个事件