react_hsbc_teller 1.3.6 → 1.3.9
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/lib/hsbc.js +1 -1
- package/package.json +1 -1
- package/packages/api/api.js +20 -1
- package/packages/pages/video/video.jsx +89 -16
package/package.json
CHANGED
package/packages/api/api.js
CHANGED
|
@@ -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 数据类型
|
|
@@ -296,6 +326,7 @@ class Video extends Component {
|
|
|
296
326
|
// initWebSocket('wss://im.uat.dsp.hsbcfts.com.cn:443/wealth/im/ws/')
|
|
297
327
|
// initWebSocket('wss://' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname + ':' + '15603' + '/ws/');
|
|
298
328
|
if(!this.state.imStatus){
|
|
329
|
+
this.state.manualClose = false
|
|
299
330
|
initWebSocket('wss://' + JSON.parse(window.sessionStorage.getItem('sigData')).hostname + ':' + JSON.parse(window.sessionStorage.getItem('sigData')).webPort + '/ws/');
|
|
300
331
|
|
|
301
332
|
}
|
|
@@ -1427,6 +1458,8 @@ class Video extends Component {
|
|
|
1427
1458
|
file: Mival.data.file}
|
|
1428
1459
|
) // 文字抄录和风险抄录,3--风险,,2--文字
|
|
1429
1460
|
}
|
|
1461
|
+
} else if (Mival.typeId == 1321) {
|
|
1462
|
+
this.getBase64Image(Mival.fileName)
|
|
1430
1463
|
} else if (Mival.typeId == 1216) {
|
|
1431
1464
|
// 签字回调
|
|
1432
1465
|
if (Mival.sessionId == this.state.sessionId) {
|
|
@@ -1872,6 +1905,13 @@ class Video extends Component {
|
|
|
1872
1905
|
this.state.rtoken = '',
|
|
1873
1906
|
this.state.sessionId = '',
|
|
1874
1907
|
this.state.imRoomId = ''
|
|
1908
|
+
this.state.imJoinRoom = false
|
|
1909
|
+
if(this.state.imStatus) {
|
|
1910
|
+
console.log('disconnect断开连接')
|
|
1911
|
+
this.state.manualClose = true
|
|
1912
|
+
this.state.imStatus = false
|
|
1913
|
+
disconnect();
|
|
1914
|
+
}
|
|
1875
1915
|
this.test_controller.Disconnect()
|
|
1876
1916
|
let data = {
|
|
1877
1917
|
account: this.props.tellerAccount,
|
|
@@ -2710,7 +2750,7 @@ class Video extends Component {
|
|
|
2710
2750
|
this.test_controller.OnStartRemoteRecordSucc = (record_id) => {
|
|
2711
2751
|
console.log('开始服务端录制成功', record_id);
|
|
2712
2752
|
this.state.recordId = record_id
|
|
2713
|
-
this.videoRecordCallback('1')
|
|
2753
|
+
this.videoRecordCallback('1',true)
|
|
2714
2754
|
};
|
|
2715
2755
|
// 开始服务端录制失败
|
|
2716
2756
|
this.test_controller.OnStartRemoteRecordFailed = (
|
|
@@ -2718,12 +2758,13 @@ class Video extends Component {
|
|
|
2718
2758
|
err_code,
|
|
2719
2759
|
err_msg
|
|
2720
2760
|
) => {
|
|
2761
|
+
this.videoRecordCallback('1',false)
|
|
2721
2762
|
console.log('开始服务端录制失败', record_id, err_code, err_msg)
|
|
2722
2763
|
};
|
|
2723
2764
|
// 结束服务端录制成功
|
|
2724
2765
|
this.test_controller.OnStopRemoteRecordSucc = (recordId) => {
|
|
2725
2766
|
console.log('结束服务端录制成功', recordId);
|
|
2726
|
-
this.videoRecordCallback('2')
|
|
2767
|
+
this.videoRecordCallback('2',true)
|
|
2727
2768
|
// this.endSessionValue()
|
|
2728
2769
|
// 获取服务端录制结果
|
|
2729
2770
|
};
|
|
@@ -2733,6 +2774,7 @@ class Video extends Component {
|
|
|
2733
2774
|
err_code,
|
|
2734
2775
|
err_msg
|
|
2735
2776
|
) => {
|
|
2777
|
+
this.videoRecordCallback('2',false)
|
|
2736
2778
|
console.log('结束服务端录制失败', recordId, err_code, err_msg)
|
|
2737
2779
|
};
|
|
2738
2780
|
// 开启浏览器录制成功
|
|
@@ -3046,12 +3088,13 @@ class Video extends Component {
|
|
|
3046
3088
|
|
|
3047
3089
|
};
|
|
3048
3090
|
}
|
|
3049
|
-
videoRecordCallback = async(type)=>{
|
|
3091
|
+
videoRecordCallback = async(type,status)=>{
|
|
3050
3092
|
try {
|
|
3051
3093
|
let result = await API.videoRecordCallback({
|
|
3052
3094
|
activityId: this.props.businessNumber,
|
|
3053
3095
|
sessionId: this.state.sessionId,
|
|
3054
|
-
type: type
|
|
3096
|
+
type: type,
|
|
3097
|
+
status: status
|
|
3055
3098
|
});
|
|
3056
3099
|
console.log(result);
|
|
3057
3100
|
} catch (err) {
|
|
@@ -3981,8 +4024,15 @@ class Video extends Component {
|
|
|
3981
4024
|
handleCancelSign=()=>{
|
|
3982
4025
|
this.signCanvas.current.clear()
|
|
3983
4026
|
}
|
|
3984
|
-
|
|
4027
|
+
|
|
3985
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
|
+
}
|
|
3986
4036
|
const that = this
|
|
3987
4037
|
const publish_config = {};
|
|
3988
4038
|
const canvas = document.createElement('canvas');
|
|
@@ -3992,10 +4042,22 @@ class Video extends Component {
|
|
|
3992
4042
|
const right = document.getElementById("whiteboardDIV").getBoundingClientRect().right
|
|
3993
4043
|
const top = document.getElementById("whiteboardDIV").getBoundingClientRect().top
|
|
3994
4044
|
const bottom = document.getElementById("whiteboardDIV").getBoundingClientRect().bottom
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
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
|
+
}
|
|
3999
4061
|
canvas.width = 1280;
|
|
4000
4062
|
canvas.height = 720;
|
|
4001
4063
|
cobj.fillStyle = 'rgb(255 255 255)'
|
|
@@ -4011,7 +4073,7 @@ class Video extends Component {
|
|
|
4011
4073
|
|
|
4012
4074
|
// console.log('addEventListener',x,y,width,height1,height)
|
|
4013
4075
|
|
|
4014
|
-
cobj.drawImage(videoMedia, x, y, width, height, 0, 0,
|
|
4076
|
+
cobj.drawImage(videoMedia, x, y, width, height, 0, 0,1280, 720);
|
|
4015
4077
|
setTimeout(loop, 1000 / 10); // drawing at 30fps
|
|
4016
4078
|
}
|
|
4017
4079
|
}
|
|
@@ -4051,12 +4113,23 @@ class Video extends Component {
|
|
|
4051
4113
|
streamShare = ''
|
|
4052
4114
|
}
|
|
4053
4115
|
videoMedia.srcObject = stream;
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4116
|
+
if(os.isTablet){
|
|
4117
|
+
stream.getVideoTracks()[0].applyConstraints({
|
|
4118
|
+
// width: document.body.clientWidth,
|
|
4119
|
+
// height: document.body.clientHeight
|
|
4120
|
+
width: window.screen.width,
|
|
4121
|
+
height: window.screen.height
|
|
4122
|
+
})
|
|
4123
|
+
}
|
|
4124
|
+
if(os.isPc) {
|
|
4125
|
+
stream.getVideoTracks()[0].applyConstraints({
|
|
4126
|
+
width: document.body.clientWidth,
|
|
4127
|
+
height: document.body.clientHeight - 50
|
|
4128
|
+
// width: window.screen.width,
|
|
4129
|
+
// height: window.screen.height
|
|
4130
|
+
})
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4060
4133
|
streamShare = stream
|
|
4061
4134
|
stream.getVideoTracks()[0].onended = async ()=>{
|
|
4062
4135
|
//单击停止共享按钮后,触发这个事件
|