提交 18558406 authored 作者: 钟是志's avatar 钟是志

增加了一个全屏查看按钮

上级 dfcef8d4
...@@ -7,111 +7,132 @@ import { getToken } from '@/utils/authority'; ...@@ -7,111 +7,132 @@ import { getToken } from '@/utils/authority';
import config from '@/config/config'; import config from '@/config/config';
const getUrlInfo = (param) => { const getUrlInfo = (param) => {
let url = window.document.location.href.toString(); let url = window.document.location.href.toString();
let u = url.split('?'); let u = url.split('?');
if (typeof u[1] == 'string') { if (typeof u[1] == 'string') {
u = u[1].split('&'); u = u[1].split('&');
let get = {}; let get = {};
for (let i in u) { for (let i in u) {
let j = u[i].split('='); let j = u[i].split('=');
get[j[0]] = decodeURIComponent(j[1]); get[j[0]] = decodeURIComponent(j[1]);
} }
return get; return get;
} else { } else {
return {}; return {};
} }
}; };
export default class Detail extends Component { export default class Detail extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
const { state } = this.props.location; const { state } = this.props.location;
let id = ''; let id = '';
if (state && state.record && state.record.id) { if (state && state.record && state.record.id) {
const { record } = state; const { record } = state;
id = record.id; id = record.id;
} }
if (!id) { if (!id) {
id = getUrlInfo()?.id; id = getUrlInfo()?.id;
} }
this.state = { this.state = {
id, id,
}; };
} }
componentDidMount() { componentDidMount() {
window.addEventListener( window.addEventListener(
'message', 'message',
(event) => { (event) => {
if (event.data && event.data.indexOf && event.data.indexOf('iframeDetailHeight') > -1) { if (event.data && event.data.indexOf && event.data.indexOf('iframeDetailHeight') > -1) {
const height = Number(event.data.split('-')[1]); const height = Number(event.data.split('-')[1]);
document.getElementById('detailIframeId').height = height + 50; document.getElementById('detailIframeId').height = height + 50;
setTimeout(()=> { setTimeout(() => {
document.getElementsByClassName('ant-layout-content')[0].scrollTo(0,height); document.getElementsByClassName('ant-layout-content')[0].scrollTo(0, height);
// 23627 签约审核/另行签约审核,审核框优化,自动显示到当前页面,不要一直拉 // 23627 签约审核/另行签约审核,审核框优化,自动显示到当前页面,不要一直拉
// 需求存在争议 暂时这样解决 // 需求存在争议 暂时这样解决
}, 500); }, 500);
} }
}, },
false, false,
); );
} }
showAll = () => { showAll = () => {
this.setState({ this.setState({
showAll: true, showAll: true,
}); });
}; };
render() { render() {
const { id, showAll } = this.state; const { id, showAll } = this.state;
const url = config.onestopPC.split('/#/'); const url = config.onestopPC.split('/#/');
let showPrint = this.props.location?.state?.showPrint; let showPrint = this.props.location?.state?.showPrint;
let iframeUrl = `${url[0]}/#/IframeForDetail?id=${id}&token=${getToken()}`; let iframeUrl = `${url[0]}/#/IframeForDetail?id=${id}&token=${getToken()}`;
if(showPrint){ if (showPrint) {
iframeUrl = iframeUrl + '&showPrint=true'; iframeUrl = iframeUrl + '&showPrint=true';
} }
// iframeUrl = `http://localhost:8000/onestop/IframeForDetail?id=${id}&token=${getToken()}`; // iframeUrl = `http://localhost:8000/onestop/IframeForDetail?id=${id}&token=${getToken()}`;
return ( return (
<PageHeaderWrapper title=""> <PageHeaderWrapper title=''>
<Shell> <Shell>
<div <div
style={{ style={{
height: '54px', height: '54px',
padding: '12px 0 12px 12px', padding: '12px 0 12px 12px',
}}> }}>
{showAll ? ( {showAll ? (
<ButtonDiy <ButtonDiy
name="返回" name='返回'
className="defaultBlue" className='defaultBlue'
handleClick={() => { handleClick={() => {
router.goBack(); router.goBack();
}} }}
icon="arrow-left" icon='arrow-left'
/> />
) : null} ) : null}
</div> <ButtonDiy
</Shell> name={'全屏查看'}
<Shell> className='defaultBlue'
<iframe handleClick={() => {
src={iframeUrl} document.getElementById('detailIframeId').requestFullscreen();
frameBorder={0} }} />
id="detailIframeId" </div>
name="applyIframe" </Shell>
marginWidth="0" <Shell>
marginHeight="0" <iframe
onLoad={this.showAll} src={iframeUrl}
allowtransparency="yes" frameBorder={0}
seamless id='detailIframeId'
scrolling={'no'} name='applyIframe'
style={{ marginWidth='0'
width: '100%', marginHeight='0'
overflowY: 'hidden', onLoad={this.showAll}
minHeight: '800px', allowtransparency='yes'
}} seamless
/> scrolling={'no'}
</Shell> style={{
</PageHeaderWrapper> width: '100%',
); overflowY: 'hidden',
} minHeight: '800px',
}}
/>
</Shell>
<Shell>
<div
style={{
height: '54px',
padding: '12px 0 12px 12px',
}}>
<ButtonDiy
name={'全屏查看'}
type={'primary'}
// className='primaryBlue'
handleClick={() => {
document.getElementById('detailIframeId').requestFullscreen();
}} />
</div>
</Shell>
</PageHeaderWrapper>
);
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论