2016-02-29 14:08:40 +08:00
|
|
|
import React from 'react';
|
2016-10-14 09:55:12 +08:00
|
|
|
import { injectIntl } from 'react-intl';
|
2016-05-27 11:48:08 +08:00
|
|
|
import DocumentTitle from 'react-document-title';
|
2017-12-18 17:58:45 +08:00
|
|
|
import { Icon } from 'antd';
|
2016-03-03 17:23:08 +08:00
|
|
|
import Banner from './Banner';
|
|
|
|
import Page1 from './Page1';
|
|
|
|
import Page2 from './Page2';
|
|
|
|
import Page3 from './Page3';
|
|
|
|
import Page4 from './Page4';
|
2016-09-27 10:06:34 +08:00
|
|
|
// To store style which is only for Home and has conflicts with others.
|
|
|
|
function getStyle() {
|
|
|
|
return `
|
|
|
|
.main-wrapper {
|
|
|
|
padding: 0;
|
|
|
|
}
|
2017-12-01 20:27:44 +08:00
|
|
|
#header {
|
|
|
|
box-shadow: none;
|
|
|
|
width: 100%;
|
|
|
|
position: absolute;
|
|
|
|
}
|
|
|
|
#header,
|
|
|
|
#header .ant-select-selection,
|
|
|
|
#header .ant-menu {
|
|
|
|
background: transparent;
|
|
|
|
}
|
2016-09-27 10:06:34 +08:00
|
|
|
`;
|
|
|
|
}
|
2016-03-23 14:15:00 +08:00
|
|
|
|
2017-12-18 17:58:45 +08:00
|
|
|
const promoteBannerImageUrl = 'https://gw.alipayobjects.com/zos/rmsportal/qVVhewfLyIYZnqrBvfhy.png';
|
|
|
|
|
|
|
|
class Home extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
|
|
|
adBannerClosed: (
|
2017-12-18 18:46:41 +08:00
|
|
|
typeof window !== 'undefined' &&
|
2017-12-18 17:58:45 +08:00
|
|
|
window.localStorage &&
|
|
|
|
window.localStorage.getItem(`adBannerClosed-${promoteBannerImageUrl}`) === 'true'
|
|
|
|
),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
closePromoteBanner = (e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
this.makeAdBannerClosed();
|
|
|
|
}
|
|
|
|
makeAdBannerClosed = () => {
|
|
|
|
this.setState({
|
|
|
|
adBannerClosed: true,
|
|
|
|
});
|
|
|
|
if (window.localStorage) {
|
|
|
|
window.localStorage.setItem(`adBannerClosed-${promoteBannerImageUrl}`, 'true');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
render() {
|
|
|
|
const promoteBanner = this.state.adBannerClosed ? null : (
|
|
|
|
<a href="http://seeconf.alipay.com/" className="promote-banner" onClick={this.makeAdBannerClosed}>
|
|
|
|
<img
|
|
|
|
src={promoteBannerImageUrl}
|
|
|
|
alt="seeconf"
|
|
|
|
/>
|
|
|
|
<Icon type="cross" title="close ad" onClick={this.closePromoteBanner} />
|
|
|
|
</a>
|
|
|
|
);
|
|
|
|
return (
|
|
|
|
<DocumentTitle title={`Ant Design - ${this.props.intl.formatMessage({ id: 'app.home.slogan' })}`}>
|
|
|
|
<div className="main-wrapper">
|
|
|
|
{promoteBanner}
|
|
|
|
<Banner {...this.props} />
|
|
|
|
<Page1 {...this.props} />
|
|
|
|
<Page2 {...this.props} />
|
|
|
|
<Page3 {...this.props} />
|
|
|
|
<Page4 {...this.props} />
|
|
|
|
<style dangerouslySetInnerHTML={{ __html: getStyle() }} />
|
|
|
|
</div>
|
|
|
|
</DocumentTitle>
|
|
|
|
);
|
|
|
|
}
|
2016-02-29 14:08:40 +08:00
|
|
|
}
|
2016-10-14 09:55:12 +08:00
|
|
|
|
|
|
|
export default injectIntl(Home);
|