react_hsbc_teller 1.9.20 → 1.9.21
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 +25 -18
- 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.21&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
|
|
|
@@ -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
|
|
@@ -1843,10 +1845,8 @@ class Video extends Component {
|
|
|
1843
1845
|
}
|
|
1844
1846
|
}
|
|
1845
1847
|
return newStream1
|
|
1846
|
-
} else {
|
|
1847
|
-
return stream
|
|
1848
1848
|
}
|
|
1849
|
-
|
|
1849
|
+
return stream
|
|
1850
1850
|
}
|
|
1851
1851
|
// 发布媒体流成功
|
|
1852
1852
|
this.test_controller.OnPublishSucc = (sid) => {
|
|
@@ -2941,7 +2941,7 @@ class Video extends Component {
|
|
|
2941
2941
|
}
|
|
2942
2942
|
}
|
|
2943
2943
|
componentWillMount() {
|
|
2944
|
-
console.log('hsbc_teller_sdk', '1.9.
|
|
2944
|
+
console.log('hsbc_teller_sdk', '1.9.21')
|
|
2945
2945
|
let arr = []
|
|
2946
2946
|
for(let i=1;i<=12;i++){
|
|
2947
2947
|
arr.push({
|
|
@@ -3624,6 +3624,7 @@ class Video extends Component {
|
|
|
3624
3624
|
})
|
|
3625
3625
|
// this.messageClick('识别失败', 'error')
|
|
3626
3626
|
this.errorCodeClick('ocr',result.code)
|
|
3627
|
+
this.saveLog('OCR failed, error code=' + result.code)
|
|
3627
3628
|
}
|
|
3628
3629
|
} catch (err) {
|
|
3629
3630
|
this.setState({
|
|
@@ -3963,19 +3964,25 @@ class Video extends Component {
|
|
|
3963
3964
|
}
|
|
3964
3965
|
}
|
|
3965
3966
|
sgsinImage = () => {
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
})
|
|
3978
|
-
|
|
3967
|
+
const imgBase64 = this.test_controller.TakePicture(1, undefined, undefined, this.state.customOcrSid, 'png')
|
|
3968
|
+
// console.log(imgBase64)
|
|
3969
|
+
|
|
3970
|
+
compressImage(imgBase64, (compressedImg)=>{
|
|
3971
|
+
// console.log(compressedImg)
|
|
3972
|
+
if (this.state.IDtypeFrontOrBack == IDtypeFront) {
|
|
3973
|
+
this.setState({
|
|
3974
|
+
facialImg: compressedImg,
|
|
3975
|
+
isFaceImage: true,
|
|
3976
|
+
facialImgFront: compressedImg,
|
|
3977
|
+
})
|
|
3978
|
+
} else if (this.state.IDtypeFrontOrBack == IDtypeBack) {
|
|
3979
|
+
this.setState({
|
|
3980
|
+
facialImg: compressedImg,
|
|
3981
|
+
isFaceImage: true,
|
|
3982
|
+
facialImgBack: compressedImg,
|
|
3983
|
+
})
|
|
3984
|
+
}
|
|
3985
|
+
})
|
|
3979
3986
|
|
|
3980
3987
|
}
|
|
3981
3988
|
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
|
+
}
|