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';
|
2018-01-04 20:00:38 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2018-01-05 14:59:12 +08:00
|
|
|
import Animate from 'rc-animate';
|
2016-03-03 17:23:08 +08:00
|
|
|
import Banner from './Banner';
|
|
|
|
import Page1 from './Page1';
|
|
|
|
import Page2 from './Page2';
|
|
|
|
import Page3 from './Page3';
|
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;
|
2018-01-04 20:00:38 +08:00
|
|
|
max-width: 1200px;
|
2017-12-01 20:27:44 +08:00
|
|
|
width: 100%;
|
2018-01-04 20:00:38 +08:00
|
|
|
margin: 20px auto 0;
|
|
|
|
padding: 0 24px;
|
2017-12-01 20:27:44 +08:00
|
|
|
}
|
|
|
|
#header,
|
|
|
|
#header .ant-select-selection,
|
|
|
|
#header .ant-menu {
|
|
|
|
background: transparent;
|
|
|
|
}
|
2018-01-04 20:00:38 +08:00
|
|
|
#header #logo {
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
#header .ant-row > div:last-child, #header .nav-phone-icon{
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
footer .footer-wrap{
|
|
|
|
width: 100%;
|
|
|
|
padding: 0;
|
|
|
|
border-bottom: 1px solid rgba(255, 255, 255, 0.25);
|
|
|
|
}
|
|
|
|
footer .footer-wrap .ant-row{
|
|
|
|
width: 100%;
|
|
|
|
max-width: 1200px;
|
|
|
|
padding: 86px 24px 93px 24px;
|
|
|
|
margin: auto;
|
2018-01-05 16:08:45 +08:00
|
|
|
|
2018-01-04 20:00:38 +08:00
|
|
|
}
|
|
|
|
footer .bottom-bar{
|
|
|
|
margin: auto;
|
|
|
|
max-width: 1200px;
|
|
|
|
padding: 16px 24px;
|
|
|
|
border-top: none;
|
|
|
|
}
|
|
|
|
@media only screen and (max-width: 768px) {
|
|
|
|
footer .footer-wrap .ant-row{
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
}
|
2016-09-27 10:06:34 +08:00
|
|
|
`;
|
|
|
|
}
|
2016-03-23 14:15:00 +08:00
|
|
|
|
2018-01-05 14:59:12 +08:00
|
|
|
const versionName = 'antd-noShowNewVersionVideo-3.0';
|
2018-01-05 17:20:52 +08:00
|
|
|
const vidoeSrc = 'https://gw.alipayobjects.com/os/rmsportal/DNDyihnvkHUuANuumKck.mp4';
|
2018-01-05 14:59:12 +08:00
|
|
|
// window.localStorage.setItem(versionName, 'false');
|
2017-12-18 17:58:45 +08:00
|
|
|
class Home extends React.Component {
|
2018-01-04 20:00:38 +08:00
|
|
|
static contextTypes = {
|
2018-01-05 14:07:10 +08:00
|
|
|
intl: PropTypes.object.isRequired,
|
2018-01-04 20:00:38 +08:00
|
|
|
isMoblie: PropTypes.bool.isRequired,
|
|
|
|
}
|
2017-12-18 17:58:45 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2018-01-05 14:59:12 +08:00
|
|
|
const noShowNewVersionVideo = typeof window === 'undefined' ? true : (
|
|
|
|
window.localStorage && window.localStorage.getItem(versionName) === 'true'
|
|
|
|
);
|
2018-01-05 16:08:45 +08:00
|
|
|
this.state = { noShowNewVersionVideo };
|
2017-12-18 17:58:45 +08:00
|
|
|
}
|
2018-01-05 14:59:12 +08:00
|
|
|
onVideoEnd = () => {
|
|
|
|
this.setState({
|
|
|
|
noShowNewVersionVideo: true,
|
|
|
|
});
|
|
|
|
if (window.localStorage) {
|
|
|
|
window.localStorage.setItem(versionName, 'true');
|
|
|
|
}
|
|
|
|
}
|
2017-12-18 17:58:45 +08:00
|
|
|
render() {
|
2018-01-05 14:07:10 +08:00
|
|
|
const { isMoblie, intl } = this.context;
|
|
|
|
const childProps = { ...this.props, isMoblie, locale: intl.locale };
|
2018-01-05 14:59:12 +08:00
|
|
|
const noShowNewVersionVideo = this.state.noShowNewVersionVideo ? null : (
|
|
|
|
<div className="new-version-video" key="video">
|
|
|
|
<div className="vidoe-wrap">
|
|
|
|
<video width="100%" autoPlay onEnded={this.onVideoEnd}>
|
|
|
|
<source src={vidoeSrc} autoPlay type="video/mp4" />
|
|
|
|
<track kind="captions" />
|
|
|
|
</video>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
2017-12-18 17:58:45 +08:00
|
|
|
return (
|
|
|
|
<DocumentTitle title={`Ant Design - ${this.props.intl.formatMessage({ id: 'app.home.slogan' })}`}>
|
|
|
|
<div className="main-wrapper">
|
2018-01-04 20:00:38 +08:00
|
|
|
<Banner {...childProps} />
|
|
|
|
<Page1 {...childProps} />
|
|
|
|
<Page2 {...childProps} />
|
|
|
|
<Page3 {...childProps} />
|
2017-12-18 17:58:45 +08:00
|
|
|
<style dangerouslySetInnerHTML={{ __html: getStyle() }} />
|
2018-01-05 14:59:12 +08:00
|
|
|
<Animate transitionName="fade">
|
|
|
|
{noShowNewVersionVideo}
|
|
|
|
</Animate>
|
2017-12-18 17:58:45 +08:00
|
|
|
</div>
|
|
|
|
</DocumentTitle>
|
|
|
|
);
|
|
|
|
}
|
2016-02-29 14:08:40 +08:00
|
|
|
}
|
2016-10-14 09:55:12 +08:00
|
|
|
|
|
|
|
export default injectIntl(Home);
|