Commit f82468ac authored by suhuiguang's avatar suhuiguang

1.双屏联动,通过postmessage实现-全景监控

parent 63c56696
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
// 管控模型 // 管控模型
mgtCtrlModel: 'http://172.16.10.91:8080', mgtCtrlModel: 'http://172.16.10.91:8080',
prePlan: 'http://172.16.10.91:3004', prePlan: 'http://172.16.10.91:3004',
ue4URI: 'http://172.16.3.69:8089?token={token}' ue4URI: 'http://172.16.3.69:8089'
}, },
// 系统配置信息 主要是为了区分各子系统 // 系统配置信息 主要是为了区分各子系统
sysConf: { sysConf: {
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { IFrame } from 'amos-framework'; import { IFrame } from 'amos-framework';
import { Store } from 'amos-tool'; import { Store } from 'amos-tool';
import { CONSTS } from 'CONSTS/storageConsts';
import SysConsts from 'amos-processor/lib/config/consts'; import SysConsts from 'amos-processor/lib/config/consts';
import formatUrl from 'amos-processor/lib/utils/urlFormat'; import formatUrl from 'amos-processor/lib/utils/urlFormat';
import { getOutterURL } from '../../consts/urlConsts'; import { getOutterURL } from '../../consts/urlConsts';
import { tirggerTransTopic } from './../3dview/dataProcessor';
const lsTool = Store.lsTool; const lsTool = Store.lsTool;
const ue4URI = getOutterURL('ue4URI');
/** /**
* ue4-全景监控 * ue4-全景监控
*/ */
export default class Ue4RootView extends Component { class Ue4RootView extends Component {
componentDidMount() {
window.addEventListener('message',this.messageHandle);
}
componentWillUnmount() {
window.removeEventListener('message',this.messageHandle);
}
messageHandle =(event)=>{
console.log('双屏联动信息',event.origin,event.data);
if(event.origin === ue4URI){
tirggerTransTopic(CONSTS.forward,event.data);
}
}
render() { render() {
let url = getOutterURL('ue4URI'); let url = `${ue4URI}?token={token}`;
const token = lsTool.read(SysConsts.token); const token = lsTool.read(SysConsts.token);
url = formatUrl(url, { token }); url = formatUrl(url, { token });
return ( return (
<IFrame <IFrame
url={url} url={url}
width='100%' width='100%'
id="iframe-ue4-view-root" id="iframe-ue4-view"
style={{height: 'calc(100% - 40px)',marginTop: '40px'}} style={{height: 'calc(100% - 40px)',marginTop: '40px'}}
display="initial" display="initial"
position="relative" position="relative"
...@@ -29,4 +50,6 @@ export default class Ue4RootView extends Component { ...@@ -29,4 +50,6 @@ export default class Ue4RootView extends Component {
/> />
); );
} }
} }
\ No newline at end of file
export default Ue4RootView;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment