import React, {Component} from 'react'
import './ExampleHtmlBoardPage.css'
import {GIS} from "iclient3d-plot-diy";
import {Button} from "antd";
import $ from "jquery";
export default class ExampleHtmlBoardPage extends Component {
constructor(props) {
super(props);
this.state = {
htmlString: '
正在加载中...
',
cssString: '正在加载中...
',
bp: null,
clickBpIndex: -1,
};
}
options = [
{
code: '12xxxx3123',
"showHtmlBoard": true,
templateHtml: `
`,
"templateValue": {
title: "12xxxx3123",
name: "name",
lon: 111.23432,
lat: 23.1,
},
"infoWindowSelector": ".info-window",
"infoWindowTitleSelector": ".info-window-heading",
"infoWindowBtnPinSelector": ".btn-pin",
"type": 2002,
"useModify": false,
"lon": 102.74521918551825,
"lat": 30.982390144247127,
"height": 0
},
{
code: '12xxxx3122',
"showHtmlBoard": true,
"infoWindowSelector": ".info-window",
"infoWindowTitleSelector": ".info-window-heading",
"infoWindowBtnPinSelector": ".btn-pin",
"type": 2002,
"useModify": false,
"lon": 112.74521918551825,
"lat": 30.982390144247127,
"height": 0
}
]
htmlBoardElementCallback(code){
let html = `
`
let values = {
title: code,
name: "name",
lon: 111.23432,
lat: 23.1,
};
html = html.replace(/\{\{(.*)}}/g, (g, g2) => {
return values[g2] || '';
});
return $(html)[0];
}
componentDidMount() {
fetch('./example/ExampleHtmlBoardPage.md')
.then(response => response.text())
.then(mdText => {
this.setState({htmlString: window.marked.parse(mdText)});
});
fetch('./example/ExampleHtmlBoardCss.md')
.then(response => response.text())
.then(mdText => {
this.setState({cssString: window.marked.parse(mdText)});
});
let html = `
`;
// let element = $(html);
this.mapFunction.mapApiService.showDrawDatas(this.options);
}
showWindow() {
// this.mapFunction.mapApiService.showDrawDatas(this.options);
this.mapFunction.mapApiService.updateDraw('12xxxx3123', {
"showHtmlBoard": true
});
}
closeWindow() {
this.mapFunction.mapApiService.updateDraw('12xxxx3123', {
"showHtmlBoard": false
});
}
render() {
return (
军标绘制拨盘功能
{
this.mapFunction = e
}
}
plotUrl={this.state.plotUrl}
mapRef={this}
showDefaultLayer={true}
htmlBoardElementCallback={this.htmlBoardElementCallback.bind(this)}
/>
{this.state.clickBpIndex > -1 &&
你点击了第 {this.state.clickBpIndex + 1} 个选项!}
)
}
}