react_hsbc_teller 1.9.20 → 1.9.22
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/pages/video/video.jsx +49 -25
- package/packages/utils/utils.js +36 -0
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import API from '../../api/api';
|
|
|
6
6
|
import { initWebSocket, joinRoom, disconnect } from '../../common/websocket';
|
|
7
7
|
import { BoardOperate } from '../../common/index.esm.js';
|
|
8
8
|
import './video.less'
|
|
9
|
+
import { compressImage } from '../../utils/utils'
|
|
9
10
|
import Header from '../header/header.jsx'
|
|
10
11
|
import Foot from '../foot/foot.jsx'
|
|
11
12
|
import voiceImgOpen from '../../assets/img/icon_Mute.png'
|
|
@@ -295,7 +296,7 @@ class Video extends Component {
|
|
|
295
296
|
saveLog = (val) => {
|
|
296
297
|
axios({
|
|
297
298
|
method: 'get',
|
|
298
|
-
baseURL: this.props.logUrl + '&message=' + encodeURIComponent(val) + '&react_hsbc_teller=1.9.
|
|
299
|
+
baseURL: this.props.logUrl + '&message=' + encodeURIComponent(val) + '&react_hsbc_teller=1.9.22&logTime=' + Date.now() + '&mtoken=' + encodeURIComponent(this.state.rtoken) + '&roomId=' + encodeURIComponent(this.state.channelId) + '&sessionId=' + encodeURIComponent(this.state.sessionId) + '&appointmentID=' + this.props.businessNumber,
|
|
299
300
|
|
|
300
301
|
}).then(res => {
|
|
301
302
|
|
|
@@ -1011,14 +1012,14 @@ class Video extends Component {
|
|
|
1011
1012
|
return a.order - b.order;
|
|
1012
1013
|
})
|
|
1013
1014
|
for (let i =1;i<=12;i++){
|
|
1014
|
-
if(
|
|
1015
|
+
if(sortedlist[i-1].videoName){
|
|
1015
1016
|
list.push({
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1017
|
+
name: 'video' + sortedlist[i-1].idIndex,
|
|
1018
|
+
title: sortedlist[i-1].videoName,
|
|
1019
|
+
mute: sortedlist[i-1].mute,
|
|
1020
|
+
noVideo: sortedlist[i-1].noVideo
|
|
1021
|
+
})
|
|
1022
|
+
}
|
|
1022
1023
|
}
|
|
1023
1024
|
console.log(list)
|
|
1024
1025
|
this.state.listVideoPicture = list
|
|
@@ -1378,6 +1379,7 @@ class Video extends Component {
|
|
|
1378
1379
|
} else {
|
|
1379
1380
|
if (document.getElementById('video20').name) {
|
|
1380
1381
|
this.test_controller.UnPublish(document.getElementById('video20').name)
|
|
1382
|
+
if(this.state.drawCanvasInterval) clearInterval(this.state.drawCanvasInterval)
|
|
1381
1383
|
}
|
|
1382
1384
|
this.setState({
|
|
1383
1385
|
isWhiteboard: false
|
|
@@ -1408,6 +1410,9 @@ class Video extends Component {
|
|
|
1408
1410
|
|
|
1409
1411
|
}
|
|
1410
1412
|
}
|
|
1413
|
+
if (this.state.isPictureInPicture) {
|
|
1414
|
+
this.pictureInPicture('Refresh')
|
|
1415
|
+
}
|
|
1411
1416
|
}
|
|
1412
1417
|
} else if (Mival.typeId == 121305) {
|
|
1413
1418
|
if (Mival.sessionId == this.state.sessionId) {
|
|
@@ -1442,6 +1447,9 @@ class Video extends Component {
|
|
|
1442
1447
|
this.setState({
|
|
1443
1448
|
videoList: this.state.videoList
|
|
1444
1449
|
})
|
|
1450
|
+
if (this.state.isPictureInPicture) {
|
|
1451
|
+
this.pictureInPicture('Refresh')
|
|
1452
|
+
}
|
|
1445
1453
|
}
|
|
1446
1454
|
}
|
|
1447
1455
|
};
|
|
@@ -1843,10 +1851,8 @@ class Video extends Component {
|
|
|
1843
1851
|
}
|
|
1844
1852
|
}
|
|
1845
1853
|
return newStream1
|
|
1846
|
-
} else {
|
|
1847
|
-
return stream
|
|
1848
1854
|
}
|
|
1849
|
-
|
|
1855
|
+
return stream
|
|
1850
1856
|
}
|
|
1851
1857
|
// 发布媒体流成功
|
|
1852
1858
|
this.test_controller.OnPublishSucc = (sid) => {
|
|
@@ -2941,7 +2947,7 @@ class Video extends Component {
|
|
|
2941
2947
|
}
|
|
2942
2948
|
}
|
|
2943
2949
|
componentWillMount() {
|
|
2944
|
-
console.log('hsbc_teller_sdk', '1.9.
|
|
2950
|
+
console.log('hsbc_teller_sdk', '1.9.22')
|
|
2945
2951
|
let arr = []
|
|
2946
2952
|
for(let i=1;i<=12;i++){
|
|
2947
2953
|
arr.push({
|
|
@@ -3021,6 +3027,11 @@ class Video extends Component {
|
|
|
3021
3027
|
console.log(data)
|
|
3022
3028
|
})
|
|
3023
3029
|
}
|
|
3030
|
+
if (this.state.isPictureInPicture) {
|
|
3031
|
+
setTimeout(() => {
|
|
3032
|
+
this.pictureInPicture('Refresh')
|
|
3033
|
+
}, 0);
|
|
3034
|
+
}
|
|
3024
3035
|
}
|
|
3025
3036
|
};
|
|
3026
3037
|
isFileSuccuse = () => {
|
|
@@ -3432,6 +3443,9 @@ class Video extends Component {
|
|
|
3432
3443
|
// videoList: this.state.videoList
|
|
3433
3444
|
// })
|
|
3434
3445
|
this.videoListSort();
|
|
3446
|
+
if (this.state.isPictureInPicture) {
|
|
3447
|
+
this.pictureInPicture('Refresh')
|
|
3448
|
+
}
|
|
3435
3449
|
} else {
|
|
3436
3450
|
console.log('1')
|
|
3437
3451
|
this.messageClick('保持信息失败', 'error')
|
|
@@ -3624,6 +3638,7 @@ class Video extends Component {
|
|
|
3624
3638
|
})
|
|
3625
3639
|
// this.messageClick('识别失败', 'error')
|
|
3626
3640
|
this.errorCodeClick('ocr',result.code)
|
|
3641
|
+
this.saveLog('OCR failed, error code=' + result.code)
|
|
3627
3642
|
}
|
|
3628
3643
|
} catch (err) {
|
|
3629
3644
|
this.setState({
|
|
@@ -3722,6 +3737,9 @@ class Video extends Component {
|
|
|
3722
3737
|
// videoList: this.state.videoList
|
|
3723
3738
|
// })
|
|
3724
3739
|
this.videoListSort();
|
|
3740
|
+
if (this.state.isPictureInPicture) {
|
|
3741
|
+
this.pictureInPicture('Refresh')
|
|
3742
|
+
}
|
|
3725
3743
|
} else {
|
|
3726
3744
|
console.log('1')
|
|
3727
3745
|
this.messageClick('保持信息失败', 'error')
|
|
@@ -3963,19 +3981,25 @@ class Video extends Component {
|
|
|
3963
3981
|
}
|
|
3964
3982
|
}
|
|
3965
3983
|
sgsinImage = () => {
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
})
|
|
3978
|
-
|
|
3984
|
+
const imgBase64 = this.test_controller.TakePicture(1, undefined, undefined, this.state.customOcrSid, 'png')
|
|
3985
|
+
// console.log(imgBase64)
|
|
3986
|
+
|
|
3987
|
+
compressImage(imgBase64, (compressedImg)=>{
|
|
3988
|
+
// console.log(compressedImg)
|
|
3989
|
+
if (this.state.IDtypeFrontOrBack == IDtypeFront) {
|
|
3990
|
+
this.setState({
|
|
3991
|
+
facialImg: compressedImg,
|
|
3992
|
+
isFaceImage: true,
|
|
3993
|
+
facialImgFront: compressedImg,
|
|
3994
|
+
})
|
|
3995
|
+
} else if (this.state.IDtypeFrontOrBack == IDtypeBack) {
|
|
3996
|
+
this.setState({
|
|
3997
|
+
facialImg: compressedImg,
|
|
3998
|
+
isFaceImage: true,
|
|
3999
|
+
facialImgBack: compressedImg,
|
|
4000
|
+
})
|
|
4001
|
+
}
|
|
4002
|
+
})
|
|
3979
4003
|
|
|
3980
4004
|
}
|
|
3981
4005
|
handleChangeOcr = (val) => {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
function compressImage(base64, callback) {
|
|
2
|
+
var targSize = 1024 * 1024 * 1.45 //1024KB
|
|
3
|
+
if (base64.length <= targSize) {
|
|
4
|
+
callback(base64);
|
|
5
|
+
// console.log("直接返回")
|
|
6
|
+
return
|
|
7
|
+
}
|
|
8
|
+
var newImage = new Image();
|
|
9
|
+
newImage.src = base64;
|
|
10
|
+
console.log('压缩前'+base64.length)
|
|
11
|
+
newImage.setAttribute("crossOrigin", 'Anonymous'); //url为外域时需要
|
|
12
|
+
newImage.onload = function () {
|
|
13
|
+
var quality = 0.95; //压缩系数0-1之间
|
|
14
|
+
var canvas = document.createElement("canvas");
|
|
15
|
+
var ctx = canvas.getContext("2d");
|
|
16
|
+
canvas.width = 720
|
|
17
|
+
canvas.height = 405
|
|
18
|
+
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
19
|
+
ctx.drawImage(newImage, 0, 0, canvas.width, canvas.height);
|
|
20
|
+
var base64 = canvas.toDataURL("image/png", quality); //压缩语句
|
|
21
|
+
// 如想确保图片压缩到自己想要的尺寸,如要求在5-10kb之间,请加以下语句,quality初始值根据情况自定
|
|
22
|
+
// console.log(base64.length + "循环1压缩" + (base64.length / 1024 > 512))
|
|
23
|
+
|
|
24
|
+
// while (base64.length > targSize) {
|
|
25
|
+
// quality -= 0.03;
|
|
26
|
+
// // console.log(base64.length + "循环压缩" + quality)
|
|
27
|
+
// base64 = canvas.toDataURL("image/png", quality);
|
|
28
|
+
// }
|
|
29
|
+
console.log('压缩后'+base64.length)
|
|
30
|
+
callback(base64); //必须通过回调函数返回,否则无法及时拿到该值
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
compressImage
|
|
36
|
+
}
|