43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import React from "react";
|
||
import FrameLoader from "./FrameLoader";
|
||
|
||
export default class FrameFaceLogin extends React.Component {
|
||
constructor(props:any) {
|
||
super(props);
|
||
this.state = {
|
||
transferData: {
|
||
image: ''
|
||
},
|
||
};
|
||
}
|
||
|
||
componentDidMount() {
|
||
// 接收Iframe传递的数据
|
||
window.addEventListener("message", (e) => {
|
||
const{image,detectResult,actionAndTimer} = e.data|| {};
|
||
if(image){
|
||
this.props.faceCompareEvent2(image);
|
||
}
|
||
else if(detectResult){
|
||
this.props.faceCompareEvent(detectResult);
|
||
}else if(actionAndTimer){
|
||
this.props.faceDetectStatusEvent(actionAndTimer.arg1, actionAndTimer.arg2);
|
||
}
|
||
});
|
||
}
|
||
render() {
|
||
const { transferData } = this.state || {};
|
||
console.log(transferData, "数据");
|
||
return (
|
||
<div style={{ height: "100%" }}>
|
||
{/* 设置Iframe 盒子的宽度 */}
|
||
<div style={{ minHeight: "200px", position: "relative" }}>
|
||
{/* 这个是打包后的Iframe 地址:要到webpack中配置打包地址 */}
|
||
<FrameLoader url="/faceLoginIE/index.html" />
|
||
</div>
|
||
</div>
|
||
);
|
||
}
|
||
}
|
||
|