106 lines
2.4 KiB
JavaScript
106 lines
2.4 KiB
JavaScript
/* eslint no-undef: 0 */
|
|
/* eslint arrow-parens: 0 */
|
|
import React from 'react';
|
|
import { enquireScreen } from 'enquire-js';
|
|
import Nav3 from "../Home/Nav3";
|
|
import Pricing1 from './Pricing1';
|
|
import Feature7 from './Feature7';
|
|
import Content11 from './Content11';
|
|
import Footer0 from '../Home/Footer0';
|
|
import {
|
|
Pricing10DataSource,
|
|
Feature70DataSource,
|
|
Content110DataSource,
|
|
} from './data.source';
|
|
import './less/antMotionStyle.less';
|
|
import '../Home/less/antMotionStyle.less';
|
|
import {
|
|
Nav30DataSource,
|
|
|
|
Footer00DataSource,
|
|
|
|
|
|
} from '../Home/data.source';
|
|
let isMobile;
|
|
enquireScreen((b) => {
|
|
isMobile = b;
|
|
});
|
|
|
|
const { location } = window;
|
|
|
|
export default class Home extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
isMobile,
|
|
show: !location.port, // 如果不是 dva 2.0 请删除
|
|
};
|
|
}
|
|
|
|
componentDidMount() {
|
|
// 适配手机屏幕;
|
|
enquireScreen((b) => {
|
|
this.setState({ isMobile: !!b });
|
|
});
|
|
// dva 2.0 样式在组件渲染之后动态加载,导致滚动组件不生效;线上不影响;
|
|
/* 如果不是 dva 2.0 请删除 start */
|
|
if (location.port) {
|
|
// 样式 build 时间在 200-300ms 之间;
|
|
setTimeout(() => {
|
|
this.setState({
|
|
show: true,
|
|
});
|
|
}, 500);
|
|
}
|
|
/* 如果不是 dva 2.0 请删除 end */
|
|
}
|
|
|
|
render() {
|
|
|
|
const children = [
|
|
<Nav3
|
|
id="Nav3_0"
|
|
key="Nav3_0"
|
|
dataSource={Nav30DataSource}
|
|
isMobile={this.state.isMobile}
|
|
/>,
|
|
<Pricing1
|
|
id="Pricing1_0"
|
|
key="Pricing1_0"
|
|
dataSource={Pricing10DataSource}
|
|
isMobile={this.state.isMobile}
|
|
/>,
|
|
<Feature7
|
|
id="Feature7_0"
|
|
key="Feature7_0"
|
|
dataSource={Feature70DataSource}
|
|
isMobile={this.state.isMobile}
|
|
/>,
|
|
<Content11
|
|
id="Content11_0"
|
|
key="Content11_0"
|
|
dataSource={Content110DataSource}
|
|
isMobile={this.state.isMobile}
|
|
/>,
|
|
<Footer0
|
|
id="Footer0_0"
|
|
key="Footer0_0"
|
|
dataSource={Footer00DataSource}
|
|
isMobile={this.state.isMobile}
|
|
/>,
|
|
];
|
|
return (
|
|
<div
|
|
className="templates-wrapper"
|
|
ref={(d) => {
|
|
this.dom = d;
|
|
}}
|
|
>
|
|
{/* 如果不是 dva 2.0 替换成 {children} start */}
|
|
{this.state.show && children}
|
|
{/* 如果不是 dva 2.0 替换成 {children} end */}
|
|
</div>
|
|
);
|
|
}
|
|
}
|