|
|
@ -2,7 +2,6 @@ import React from 'react'; |
|
|
|
import { injectIntl } from 'react-intl'; |
|
|
|
import DocumentTitle from 'react-document-title'; |
|
|
|
import PropTypes from 'prop-types'; |
|
|
|
import Animate from 'rc-animate'; |
|
|
|
import Banner from './Banner'; |
|
|
|
import Page1 from './Page1'; |
|
|
|
import Page2 from './Page2'; |
|
|
@ -57,57 +56,25 @@ function getStyle() { |
|
|
|
`; |
|
|
|
} |
|
|
|
|
|
|
|
const versionName = 'antd-noShowNewVersionVideo-3.0'; |
|
|
|
const vidoeSrc = 'https://gw.alipayobjects.com/os/rmsportal/BGdVjjPjKQtvtEtRTMgv.mp4'; |
|
|
|
// window.localStorage.setItem(versionName, 'false'); |
|
|
|
class Home extends React.Component { |
|
|
|
static contextTypes = { |
|
|
|
intl: PropTypes.object.isRequired, |
|
|
|
isMoblie: PropTypes.bool.isRequired, |
|
|
|
} |
|
|
|
constructor(props) { |
|
|
|
super(props); |
|
|
|
const noShowNewVersionVideo = typeof window === 'undefined' ? true : ( |
|
|
|
window.localStorage && window.localStorage.getItem(versionName) === 'true' |
|
|
|
); |
|
|
|
this.state = { noShowNewVersionVideo }; |
|
|
|
} |
|
|
|
onVideoEnd = () => { |
|
|
|
this.setState({ |
|
|
|
noShowNewVersionVideo: true, |
|
|
|
}); |
|
|
|
if (window.localStorage) { |
|
|
|
window.localStorage.setItem(versionName, 'true'); |
|
|
|
} |
|
|
|
} |
|
|
|
render() { |
|
|
|
const { isMoblie, intl } = this.context; |
|
|
|
const childProps = { ...this.props, isMoblie, locale: intl.locale }; |
|
|
|
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> |
|
|
|
const Home = (props, context) => { |
|
|
|
const { isMoblie, intl } = context; |
|
|
|
const childProps = { ...props, isMoblie, locale: intl.locale }; |
|
|
|
return ( |
|
|
|
<DocumentTitle title={`Ant Design - ${props.intl.formatMessage({ id: 'app.home.slogan' })}`}> |
|
|
|
<div className="main-wrapper"> |
|
|
|
<Banner {...childProps} /> |
|
|
|
<Page1 {...childProps} /> |
|
|
|
<Page2 {...childProps} /> |
|
|
|
<Page3 {...childProps} /> |
|
|
|
<style dangerouslySetInnerHTML={{ __html: getStyle() }} /> |
|
|
|
</div> |
|
|
|
); |
|
|
|
return ( |
|
|
|
<DocumentTitle title={`Ant Design - ${this.props.intl.formatMessage({ id: 'app.home.slogan' })}`}> |
|
|
|
<div className="main-wrapper"> |
|
|
|
<Banner {...childProps} /> |
|
|
|
<Page1 {...childProps} /> |
|
|
|
<Page2 {...childProps} /> |
|
|
|
<Page3 {...childProps} /> |
|
|
|
<style dangerouslySetInnerHTML={{ __html: getStyle() }} /> |
|
|
|
<Animate transitionName="fade"> |
|
|
|
{noShowNewVersionVideo} |
|
|
|
</Animate> |
|
|
|
</div> |
|
|
|
</DocumentTitle> |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
</DocumentTitle> |
|
|
|
); |
|
|
|
}; |
|
|
|
|
|
|
|
Home.contextTypes = { |
|
|
|
intl: PropTypes.object.isRequired, |
|
|
|
isMoblie: PropTypes.bool.isRequired, |
|
|
|
}; |
|
|
|
|
|
|
|
export default injectIntl(Home); |
|
|
|