From 71bf733632f8f150e3c32d336e8a6605b809e604 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 18 Jul 2019 09:27:11 +0800 Subject: [PATCH] html --- .../context/EvaluateSuccessEffectDisplay.js | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/public/react/src/context/EvaluateSuccessEffectDisplay.js b/public/react/src/context/EvaluateSuccessEffectDisplay.js index f09b6d2f2..7ce321bc2 100644 --- a/public/react/src/context/EvaluateSuccessEffectDisplay.js +++ b/public/react/src/context/EvaluateSuccessEffectDisplay.js @@ -17,7 +17,16 @@ class EvaluateSuccessEffectDisplay extends Component { } componentDidMount() { - + if (this.props.type == 'html') { + const iframe = document.getElementById('_displayIframe') + if (iframe && iframe.contentWindow) { + iframe.contentWindow.open() + iframe.contentWindow.document.write(this.props.iframe_src); + iframe.contentWindow.document.close(); + } else { + console.error('not mounted') + } + } } hidepicture = () => { window.$('#picture_display').hide(); @@ -26,7 +35,7 @@ class EvaluateSuccessEffectDisplay extends Component { // qrcode // const type = 'image' // 'qrcode' const { type, qrcode_str, - answer_picture, orignal_picture, user_picture } = this.props; + answer_picture, orignal_picture, user_picture, contents } = this.props; if (type == 'qrcode') { // 单张图片,比如安卓评测完显示qrcode return ( @@ -71,10 +80,14 @@ class EvaluateSuccessEffectDisplay extends Component {

实际输出

- +
) + } else if (type == "html") { + return ( + + ) } /*
@@ -95,12 +108,17 @@ class EvaluateSuccessEffectDisplay extends Component { height: 100%; box-sizing: border-box; } + + iframe#_displayIframe { + width: 100%; + height: 100%; + } `}
-

查看效果

+

查看效果