diff --git a/config/config.js b/config/config.js index 1ffa812e7f844c0d3281e7dba2d3de7729b7ddea..9317a5b3cd66dd7f5e71e4b6a6192730804838f9 100644 --- a/config/config.js +++ b/config/config.js @@ -6,7 +6,7 @@ import defaultSettings from '../src/defaultSettings'; import slash from 'slash2'; const { pwa, primaryColor } = defaultSettings; -const { NODE_ENV, APP_TYPE, TEST } = process.env; +const { APP_TYPE, TEST } = process.env; const plugins = [ [ diff --git a/src/components/Charts/AsyncLoadBizCharts.js b/src/components/Charts/AsyncLoadBizCharts.js deleted file mode 100644 index 8d9a2cd059b692da7a7848f71c269610a9d534c1..0000000000000000000000000000000000000000 --- a/src/components/Charts/AsyncLoadBizCharts.js +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import PageLoading from '../PageLoading'; -import { importCDN } from '@/utils/utils'; - -let isLoaderBizChart = false; -const loadBizCharts = async () => { - if (isLoaderBizChart) { - return Promise.resolve(true); - } - await Promise.all([ - importCDN('//gw.alipayobjects.com/os/lib/bizcharts/3.4.3/umd/BizCharts.min.js'), - importCDN('//gw.alipayobjects.com/os/lib/antv/data-set/0.10.1/dist/data-set.min.js'), - ]); - // eslint-disable-next-line no-console - console.log('bizCharts load success'); - isLoaderBizChart = true; - return Promise.resolve(true); -}; - -class AsyncLoadBizCharts extends React.Component { - state = { - loading: !isLoaderBizChart, - }; - - async componentDidMount() { - await loadBizCharts(); - requestAnimationFrame(() => { - this.setState({ - loading: false, - }); - }); - } - - render() { - const { children } = this.props; - const { loading } = this.state; - if (!loading) { - return children; - } - return ; - } -} - -export { loadBizCharts, AsyncLoadBizCharts }; diff --git a/src/components/Charts/index.js b/src/components/Charts/index.js index 6fbcb743648d6738afbcbcad26f988b2dae37d89..294eeb65f430ea18af184fc27ba9f2d11c188d47 100644 --- a/src/components/Charts/index.js +++ b/src/components/Charts/index.js @@ -1,24 +1,16 @@ -import React, { Suspense } from 'react'; import numeral from 'numeral'; import ChartCard from './ChartCard'; import Field from './Field'; - -const getComponent = Component => props => ( - - - -); - -const Bar = getComponent(React.lazy(() => import('./Bar'))); -const Pie = getComponent(React.lazy(() => import('./Pie'))); -const Radar = getComponent(React.lazy(() => import('./Radar'))); -const Gauge = getComponent(React.lazy(() => import('./Gauge'))); -const MiniArea = getComponent(React.lazy(() => import('./MiniArea'))); -const MiniBar = getComponent(React.lazy(() => import('./MiniBar'))); -const MiniProgress = getComponent(React.lazy(() => import('./MiniProgress'))); -const WaterWave = getComponent(React.lazy(() => import('./WaterWave'))); -const TagCloud = getComponent(React.lazy(() => import('./TagCloud'))); -const TimelineChart = getComponent(React.lazy(() => import('./TimelineChart'))); +import Bar from './Bar'; +import Pie from './Pie'; +import Radar from './Radar'; +import Gauge from './Gauge'; +import MiniArea from './MiniArea'; +import MiniBar from './MiniBar'; +import MiniProgress from './MiniProgress'; +import WaterWave from './WaterWave'; +import TagCloud from './TagCloud'; +import TimelineChart from './TimelineChart'; const yuan = val => `¥ ${numeral(val).format('0,0')}`; diff --git a/src/pages/Dashboard/Analysis.js b/src/pages/Dashboard/Analysis.js index 07172cc826c3dc89cd8f59a458436f7a99c6975f..0d222cc3c7bb16ed0ad1190f46a8e10629c6d372 100644 --- a/src/pages/Dashboard/Analysis.js +++ b/src/pages/Dashboard/Analysis.js @@ -5,7 +5,6 @@ import GridContent from '@/components/PageHeaderWrapper/GridContent'; import { getTimeDistance } from '@/utils/utils'; import styles from './Analysis.less'; import PageLoading from '@/components/PageLoading'; -import { AsyncLoadBizCharts } from '@/components/Charts/AsyncLoadBizCharts'; const IntroduceRow = React.lazy(() => import('./IntroduceRow')); const SalesCard = React.lazy(() => import('./SalesCard')); @@ -182,8 +181,4 @@ class Analysis extends Component { } } -export default props => ( - - - -); +export default Analysis; diff --git a/src/pages/Dashboard/Monitor.js b/src/pages/Dashboard/Monitor.js index d9bb87c614a90ac1bd01da9028b5919235ae94be..a2d812aba193a0a10393ead604b1008a6cb36801 100644 --- a/src/pages/Dashboard/Monitor.js +++ b/src/pages/Dashboard/Monitor.js @@ -1,5 +1,4 @@ import React, { Component } from 'react'; -import { AsyncLoadBizCharts } from '@/components/Charts/AsyncLoadBizCharts'; import { connect } from 'dva'; import { formatMessage, FormattedMessage } from 'umi/locale'; import { Row, Col, Card, Tooltip } from 'antd'; @@ -242,8 +241,4 @@ class Monitor extends Component { } } -export default props => ( - - - -); +export default Monitor; diff --git a/src/pages/Dashboard/Workplace.js b/src/pages/Dashboard/Workplace.js index 3e7ff986abe821cb2ef6956db700365b07e424fb..d71b122a74b41147590b53bb566efaeed36d3f2a 100644 --- a/src/pages/Dashboard/Workplace.js +++ b/src/pages/Dashboard/Workplace.js @@ -3,7 +3,6 @@ import moment from 'moment'; import { connect } from 'dva'; import Link from 'umi/link'; import { Row, Col, Card, List, Avatar } from 'antd'; -import { AsyncLoadBizCharts } from '@/components/Charts/AsyncLoadBizCharts'; import { Radar } from '@/components/Charts'; import EditableLinkGroup from '@/components/EditableLinkGroup'; import PageHeaderWrapper from '@/components/PageHeaderWrapper'; @@ -253,8 +252,4 @@ class Workplace extends PureComponent { } } -export default props => ( - - - -); +export default Workplace;