support new htmlUrl
parent
13dbe2c784
commit
dea09d52cf
|
@ -54,6 +54,7 @@ function DeviceFrame(props) {
|
||||||
var [config, setConfig] = useState({})
|
var [config, setConfig] = useState({})
|
||||||
var [cacheKey, setCacheKey] = useState(new Date().getTime());
|
var [cacheKey, setCacheKey] = useState(new Date().getTime());
|
||||||
var [openPopup, setOpenPopup] = useState(false);
|
var [openPopup, setOpenPopup] = useState(false);
|
||||||
|
var [absoluteUrl, setAbsoluteUrl] = useState('');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setConfig(configMap[props.device])
|
setConfig(configMap[props.device])
|
||||||
|
@ -63,7 +64,8 @@ function DeviceFrame(props) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('触发更新', props.htmlUrl);
|
console.log('触发更新', props.htmlUrl);
|
||||||
refresh();
|
setAbsoluteUrl(!props.htmlUrl?.startsWith("http") ? BaseUrl + props.htmlUrl : props.htmlUrl);
|
||||||
|
refresh()
|
||||||
props.refreshQrCode()
|
props.refreshQrCode()
|
||||||
}, [props.htmlUrl])
|
}, [props.htmlUrl])
|
||||||
|
|
||||||
|
@ -73,7 +75,7 @@ function DeviceFrame(props) {
|
||||||
{ props.qrDataUrl &&
|
{ props.qrDataUrl &&
|
||||||
<div className='qrCode'>
|
<div className='qrCode'>
|
||||||
<p style={{ margin: '0' }}>扫一扫,手机预览
|
<p style={{ margin: '0' }}>扫一扫,手机预览
|
||||||
<CopyToClipboard text={BaseUrl + props.htmlUrl} onCopy={() => setOpenPopup(true)}>
|
<CopyToClipboard text={absoluteUrl} onCopy={() => setOpenPopup(true)}>
|
||||||
<img style={{ cursor: 'pointer', width: '20px', height: '20px' }} src={copyPng} alt='复制链接'/>
|
<img style={{ cursor: 'pointer', width: '20px', height: '20px' }} src={copyPng} alt='复制链接'/>
|
||||||
</CopyToClipboard>
|
</CopyToClipboard>
|
||||||
</p>
|
</p>
|
||||||
|
@ -102,7 +104,7 @@ function DeviceFrame(props) {
|
||||||
paddingBottom: config.offsetv
|
paddingBottom: config.offsetv
|
||||||
}}
|
}}
|
||||||
title='preview'
|
title='preview'
|
||||||
src={baseUrl + props.htmlUrl + '?cacheKey=' + cacheKey}
|
src={absoluteUrl + '?cacheKey=' + cacheKey}
|
||||||
width={config.width}
|
width={config.width}
|
||||||
height={config.height}
|
height={config.height}
|
||||||
frameBorder={'0'}/>
|
frameBorder={'0'}/>
|
||||||
|
|
Loading…
Reference in New Issue