2022-08-08 10:55:27 +08:00
|
|
|
|
import React from "react";
|
|
|
|
|
import FrameLoader from "./FrameLoader";
|
2022-08-16 11:13:29 +08:00
|
|
|
|
|
2022-08-08 10:55:27 +08:00
|
|
|
|
export default class FrameFaceLogin extends React.Component {
|
2022-08-12 10:24:41 +08:00
|
|
|
|
constructor(props:any) {
|
2022-08-08 10:55:27 +08:00
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
|
|
|
|
transferData: {
|
2022-08-12 10:24:41 +08:00
|
|
|
|
image: ''
|
2022-08-08 10:55:27 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
2022-08-16 11:13:29 +08:00
|
|
|
|
|
2022-08-08 10:55:27 +08:00
|
|
|
|
componentDidMount() {
|
2022-08-16 11:13:29 +08:00
|
|
|
|
// 接收Iframe传递的数据
|
2022-08-08 10:55:27 +08:00
|
|
|
|
window.addEventListener("message", (e) => {
|
2022-10-28 17:23:46 +08:00
|
|
|
|
const{image,detectResult,actionAndTimer} = e.data|| {};
|
|
|
|
|
if(image){
|
|
|
|
|
this.props.faceCompareEvent2(image);
|
|
|
|
|
}
|
|
|
|
|
else if(detectResult){
|
2022-10-24 17:06:53 +08:00
|
|
|
|
this.props.faceCompareEvent(detectResult);
|
2022-10-28 17:23:46 +08:00
|
|
|
|
}else if(actionAndTimer){
|
|
|
|
|
this.props.faceDetectStatusEvent(actionAndTimer.arg1, actionAndTimer.arg2);
|
2022-08-08 10:55:27 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
render() {
|
|
|
|
|
const { transferData } = this.state || {};
|
|
|
|
|
console.log(transferData, "数据");
|
|
|
|
|
return (
|
2022-08-16 11:13:29 +08:00
|
|
|
|
<div style={{ height: "100%" }}>
|
|
|
|
|
{/* 设置Iframe 盒子的宽度 */}
|
2022-08-17 17:21:01 +08:00
|
|
|
|
<div style={{ minHeight: "200px", position: "relative" }}>
|
2022-08-16 11:13:29 +08:00
|
|
|
|
{/* 这个是打包后的Iframe 地址:要到webpack中配置打包地址 */}
|
|
|
|
|
<FrameLoader url="/faceLoginIE/index.html" />
|
|
|
|
|
</div>
|
2022-08-08 10:55:27 +08:00
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|