Commit 980324f5 authored by 杨思琦's avatar 杨思琦

chore: postcss移除,按需加载修改

parent 6a5e9f34
...@@ -80,26 +80,26 @@ export async function addCSSRules(opts) { ...@@ -80,26 +80,26 @@ export async function addCSSRules(opts) {
...userConfig.cssLoader, ...userConfig.cssLoader,
}); });
rule // rule
.use('postcss-loader') // .use('postcss-loader')
.loader(require.resolve('@umijs/bundler-webpack/compiled/postcss-loader')) // .loader(require.resolve('@umijs/bundler-webpack/compiled/postcss-loader'))
.options({ // .options({
postcssOptions: { // postcssOptions: {
ident: 'postcss', // ident: 'postcss',
plugins: [ // plugins: [
require('../compiled/postcss-flexbugs-fixes'), // require('../compiled/postcss-flexbugs-fixes'),
require('postcss-preset-env')({ // require('postcss-preset-env')({
browsers: opts.browsers, // browsers: opts.browsers,
autoprefixer: { // autoprefixer: {
flexbox: 'no-2009', // flexbox: 'no-2009',
...userConfig.autoprefixer, // ...userConfig.autoprefixer,
}, // },
stage: 3, // stage: 3,
}), // }),
].concat(userConfig.extraPostCSSPlugins || []), // ].concat(userConfig.extraPostCSSPlugins || []),
...userConfig.postcssLoader, // ...userConfig.postcssLoader,
}, // },
}); // });
if (loader) { if (loader) {
rule rule
......
...@@ -70,30 +70,30 @@ function createCSSRule({ ...@@ -70,30 +70,30 @@ function createCSSRule({
), ),
); );
rule // rule
.use('postcss-loader') // .use('postcss-loader')
.loader(require.resolve('postcss-loader')) // .loader(require.resolve('postcss-loader'))
.options( // .options(
deepmerge( // deepmerge(
{ // {
ident: 'postcss', // ident: 'postcss',
plugins: () => [ // plugins: () => [
require('postcss-flexbugs-fixes'), // require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({ // require('postcss-preset-env')({
// TODO: set browsers // // TODO: set browsers
autoprefixer: { // autoprefixer: {
...config.autoprefixer, // ...config.autoprefixer,
overrideBrowserslist: browserslist, // overrideBrowserslist: browserslist,
}, // },
// https://cssdb.org/ // // https://cssdb.org/
stage: 3, // stage: 3,
}), // }),
...(config.extraPostCSSPlugins ? config.extraPostCSSPlugins : []), // ...(config.extraPostCSSPlugins ? config.extraPostCSSPlugins : []),
], // ],
}, // },
config.postcssLoader || {}, // config.postcssLoader || {},
), // ),
); // );
if (loader) { if (loader) {
rule rule
......
...@@ -60,7 +60,7 @@ module.exports = require('./webpack.base.babel')({ ...@@ -60,7 +60,7 @@ module.exports = require('./webpack.base.babel')({
name(module) { name(module) {
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1]; const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
// @ts-ignore // @ts-ignore
if (module.type !== 'css/mini-extract') { if (['@wisdom-components', 'swiper'].indexOf(packageName) === -1) {
return `npm.${packageName.replace('@', '')}`; return `npm.${packageName.replace('@', '')}`;
} }
}, },
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
"@ant-design/pro-layout": "^6.24.1", "@ant-design/pro-layout": "^6.24.1",
"@ant-design/pro-list": "1.21.71", "@ant-design/pro-list": "1.21.71",
"@ant-design/pro-skeleton": "^1.0.0-beta.2", "@ant-design/pro-skeleton": "^1.0.0-beta.2",
"@ant-design/pro-table": "2.76.4", "@ant-design/pro-table": "2.77.1",
"@ant-design/pro-utils": "^1.10.4", "@ant-design/pro-utils": "^1.10.4",
"@babel/polyfill": "7.4.3", "@babel/polyfill": "7.4.3",
"@babel/runtime": "^7.10.5", "@babel/runtime": "^7.10.5",
...@@ -112,9 +112,9 @@ ...@@ -112,9 +112,9 @@
"@wisdom-components/basictable": "^1.5.16", "@wisdom-components/basictable": "^1.5.16",
"@wisdom-components/empty": "^1.4.1", "@wisdom-components/empty": "^1.4.1",
"@wisdom-components/videoslidermodal": "^1.1.60", "@wisdom-components/videoslidermodal": "^1.1.60",
"@wisdom-map/amap": "1.9.0", "@wisdom-map/amap": "2.0.0",
"@wisdom-map/arcgismap": "1.4.0-338", "@wisdom-map/arcgismap": "2.0.5",
"@wisdom-map/basemap": "1.1.0-45", "@wisdom-map/basemap": "2.0.0",
"@wisdom-map/util": "1.2.9", "@wisdom-map/util": "1.2.9",
"@wisdom-utils/components": "0.1.364", "@wisdom-utils/components": "0.1.364",
"@wisdom-utils/runtime": "0.0.51", "@wisdom-utils/runtime": "0.0.51",
...@@ -270,11 +270,6 @@ ...@@ -270,11 +270,6 @@
"ora": "^5.1.0", "ora": "^5.1.0",
"path-to-regexp": "^2.4.0", "path-to-regexp": "^2.4.0",
"plop": "2.3.0", "plop": "2.3.0",
"postcss": "7.0.32",
"postcss-flexbugs-fixes": "4.2.1",
"postcss-loader": "3.0.0",
"postcss-preset-env": "6.7.0",
"postcss-safe-parser": "^4.0.2",
"pre-commit": "1.2.2", "pre-commit": "1.2.2",
"prettier": "1.17.0", "prettier": "1.17.0",
"querystring-browser": "^1.0.4", "querystring-browser": "^1.0.4",
......
import React, { Component, useMemo, useState } from 'react'; import React, { Component, lazy, Suspense, useMemo, useState } from 'react';
import { Button, Form, Input, Modal, notification, Pagination } from 'antd'; import { Button, Form, Input, Modal, notification, Pagination } from 'antd';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
...@@ -8,7 +8,6 @@ import { findPathByWidget, isJSON } from '@wisdom-utils/components/lib/AppLayout ...@@ -8,7 +8,6 @@ import { findPathByWidget, isJSON } from '@wisdom-utils/components/lib/AppLayout
import classNames from 'classnames'; import classNames from 'classnames';
import { appService } from '@/api'; import { appService } from '@/api';
import { getVideoUrl } from '@/utils/utils'; import { getVideoUrl } from '@/utils/utils';
import VideoSliderModal from '@wisdom-components/videoslidermodal';
import Notifier from '../../layouts/AppLayout/notifier/notice'; import Notifier from '../../layouts/AppLayout/notifier/notice';
import NoticeIcon from '../../layouts/AppLayout/notifier'; import NoticeIcon from '../../layouts/AppLayout/notifier';
import { ERR_OK, MESSAGE_TYPE, NEW_MESSAGE } from '../../layouts/AppLayout/notifier/constants'; import { ERR_OK, MESSAGE_TYPE, NEW_MESSAGE } from '../../layouts/AppLayout/notifier/constants';
...@@ -18,6 +17,7 @@ import isProd from '../../utils/env'; ...@@ -18,6 +17,7 @@ import isProd from '../../utils/env';
import { getMessageTypeIcon } from '../../layouts/AppLayout/notifier/utils'; import { getMessageTypeIcon } from '../../layouts/AppLayout/notifier/utils';
// import NoticeIcon from '../NoticeIcon'; // import NoticeIcon from '../NoticeIcon';
import styles from './index.less'; import styles from './index.less';
const VideoSliderModal = lazy(() => import('@wisdom-components/videoslidermodal'));
const { TextArea } = Input; const { TextArea } = Input;
const jessibucaObj = { const jessibucaObj = {
...@@ -476,19 +476,21 @@ class NoticeIconView extends Component { ...@@ -476,19 +476,21 @@ class NoticeIconView extends Component {
} }
{this.state.videoVisible && this.state.videoMessage?.list?.length && ( {this.state.videoVisible && this.state.videoMessage?.list?.length && (
<VideoSliderModal <Suspense fallback={<></>}>
modalInfo={{ <VideoSliderModal
title: this.state.videoMessage.title, modalInfo={{
open: this.state.videoVisible, title: this.state.videoMessage.title,
visible:this.state.videoVisible, open: this.state.videoVisible,
className:'noticeVideoModal', visible:this.state.videoVisible,
onCancel: () => { className:'noticeVideoModal',
this.handleCloseVideo() onCancel: () => {
}, this.handleCloseVideo()
}} },
videoInfos={this.state.videoMessage.list} }}
JessibucaObj={jessibucaObj} videoInfos={this.state.videoMessage.list}
/> JessibucaObj={jessibucaObj}
/>
</Suspense>
)} )}
{this.state.sysTopVisible && this.state.sysMessage && !this.props.global.isNewYear && ( {this.state.sysTopVisible && this.state.sysMessage && !this.props.global.isNewYear && (
......
// eslint-disable-next-line import/extensions
import React from 'react';
// eslint-disable-next-line import/extensions
import { ArcGISMap as MapComponent } from '@wisdom-map/arcgismap';
// import MapComponent from './lib/index.js';
// eslint-disable-next-line react/prefer-stateless-function
export default class ArcGISMap extends React.Component {
render() {
return <MapComponent {...this.props} />;
}
}
@import '~antd/es/style/themes/variable.less';
.view {
position: absolute;
top:0;
right: 0;
bottom: 0;
left: 0;
.loadingBox{
position: absolute;
left: calc(50% - 40px);
top: calc(50% - 23px);
color: @text-color;
}
.mapBox {
width: 100%;
height: 100%;
}
}
...@@ -40,9 +40,6 @@ import SoundAi from '../components/SoundAi'; ...@@ -40,9 +40,6 @@ import SoundAi from '../components/SoundAi';
const { params } = helpers; const { params } = helpers;
let notify = null; let notify = null;
// const ArcgisMap = React.lazy(() => import('../pages/map/arcgis'));
// const AMap = React.lazy(() => import('../pages/map/amap'));
// const CesiumMap = React.lazy(() => import('../pages/map/cesiumMap'));
const waitTime = (time = 100) => const waitTime = (time = 100) =>
new Promise(resolve => { new Promise(resolve => {
......
/** /**
* 云平台使用分析 * 云平台使用分析
*/ */
import React, { useCallback, useEffect, useState, useRef } from 'react'; import React, { useCallback, useEffect, useState, useRef, Suspense, lazy } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { import {
Card, Card,
...@@ -18,17 +18,17 @@ import { ...@@ -18,17 +18,17 @@ import {
ConfigProvider, ConfigProvider,
notification, notification,
} from 'antd'; } from 'antd';
import ReactECharts from 'echarts-for-react';
import zhCN from 'antd/lib/locale/zh_CN'; import zhCN from 'antd/lib/locale/zh_CN';
import { LeftOutlined } from '@ant-design/icons'; import { LeftOutlined } from '@ant-design/icons';
import { cloudService } from '@/api'; import { cloudService } from '@/api';
import SecurityLayout from '@/layouts/SecurityLayout'; import SecurityLayout from '@/layouts/SecurityLayout';
import Basictable from '@wisdom-components/basictable'; import Basictable from '@wisdom-components/basictable';
import { actionCreators } from '@/containers/App/store'; import { actionCreators } from '@/containers/App/store';
import styles from './index.less';
import _ from 'lodash'; import _ from 'lodash';
import moment from 'moment'; import moment from 'moment';
import styles from './index.less';
const ReactECharts = lazy(() => import('echarts-for-react'));
const dateForModel = (model, date = moment()) => { const dateForModel = (model, date = moment()) => {
let result = { dateFrom: null, dateTo: null }; let result = { dateFrom: null, dateTo: null };
switch (model) { switch (model) {
...@@ -1524,15 +1524,17 @@ const CloudUsingAnalysis = () => { ...@@ -1524,15 +1524,17 @@ const CloudUsingAnalysis = () => {
</div> </div>
<div className="cua-chart-content"> <div className="cua-chart-content">
{loginsOption ? ( {loginsOption ? (
<ReactECharts <Suspense fallback={<></>}>
className="po-type-hour-chart" <ReactECharts
style={{ width: '100%', height: '100%' }} className="po-type-hour-chart"
opts={{ renderer: 'svg' }} style={{ width: '100%', height: '100%' }}
option={loginsOption} opts={{ renderer: 'svg' }}
onEvents={{ option={loginsOption}
click: showLoginDetails, onEvents={{
}} click: showLoginDetails,
/> }}
/>
</Suspense>
) : null} ) : null}
</div> </div>
</div> </div>
...@@ -1560,15 +1562,17 @@ const CloudUsingAnalysis = () => { ...@@ -1560,15 +1562,17 @@ const CloudUsingAnalysis = () => {
</div> </div>
<div className="cua-chart-content"> <div className="cua-chart-content">
{industryOption ? ( {industryOption ? (
<ReactECharts <Suspense fallback={<></>}>
className="po-type-hour-chart" <ReactECharts
style={{ width: '100%', height: '100%' }} className="po-type-hour-chart"
opts={{ renderer: 'svg' }} style={{ width: '100%', height: '100%' }}
option={industryOption} opts={{ renderer: 'svg' }}
onEvents={{ option={industryOption}
click: showIndustryLevel, onEvents={{
}} click: showIndustryLevel,
/> }}
/>
</Suspense>
) : null} ) : null}
</div> </div>
</div> </div>
...@@ -1578,12 +1582,14 @@ const CloudUsingAnalysis = () => { ...@@ -1578,12 +1582,14 @@ const CloudUsingAnalysis = () => {
</div> </div>
<div className="cua-chart-content"> <div className="cua-chart-content">
{hotsOption ? ( {hotsOption ? (
<ReactECharts <Suspense fallback={<></>}>
className="po-type-hour-chart" <ReactECharts
style={{ width: '100%', height: '100%' }} className="po-type-hour-chart"
opts={{ renderer: 'svg' }} style={{ width: '100%', height: '100%' }}
option={hotsOption} opts={{ renderer: 'svg' }}
/> option={hotsOption}
/>
</Suspense>
) : null} ) : null}
</div> </div>
</div> </div>
...@@ -1616,12 +1622,14 @@ const CloudUsingAnalysis = () => { ...@@ -1616,12 +1622,14 @@ const CloudUsingAnalysis = () => {
</div> </div>
<div className="cua-chart-content"> <div className="cua-chart-content">
{productsOption ? ( {productsOption ? (
<ReactECharts <Suspense fallback={<></>}>
className="po-type-hour-chart" <ReactECharts
style={{ width: '100%', height: '100%' }} className="po-type-hour-chart"
opts={{ renderer: 'svg' }} style={{ width: '100%', height: '100%' }}
option={productsOption} opts={{ renderer: 'svg' }}
/> option={productsOption}
/>
</Suspense>
) : null} ) : null}
</div> </div>
</div> </div>
......
const mapSetting = {
zooms: [14],
mapSettings: {
mapStyle: 'amap://styles/74fae00a851749793870b658f9f22d55',
pipeStyle: 'image',
viewMode: '2D',
},
propertysName: ['所在位置', '开关状态', '编号', '口径'],
showSearchFileds: ['开关状态', '编号', '口径'],
showFileds: ['编号'],
contextMenu: true,
theme: 'dark',
radius: 120,
isEdit: false,
};
export default mapSetting;
import React from 'react';
import { AMapScene } from '@wisdom-map/amap';
import { connect } from 'react-redux';
import { store } from '@wisdom-utils/utils';
import { actionCreators } from '../../../containers/App/store';
const AMap = props => {
const getMap = (obj, current) => {
store.set('amapView', {
Amap: obj,
map: current,
});
props.updageAMapView({
Amap: obj,
map: current,
});
};
const mapOptions = {
config: window.globalConfig.mapsettings,
theme: 'amap://styles/74fae00a851749793870b658f9f22d55',
mapOptions: {
plugins: ['AMap.MarkerClusterer'],
},
};
return (
<div
style={{
position: 'absolute',
top: 0,
right: 0,
bottom: 0,
left: 0,
}}
>
<AMapScene {...mapOptions} getMapInfo={getMap} />
</div>
);
};
const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']),
amapView: state.getIn(['global', 'amapView']),
});
const mapDispatchToProps = dispatch => ({
updageAMapView(amapView) {
// eslint-disable-next-line no-undef
dispatch(actionCreators.updageAMapView(amapView));
},
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(AMap);
import React from 'react';
import _ from 'lodash';
import { connect } from 'react-redux';
import AMapLoader from '@amap/amap-jsapi-loader';
import { store } from '@wisdom-utils/utils';
import { actionCreators } from '@/containers/App/store';
import MapComponent from '@/components/MapView';
class CreateMap extends React.Component {
constructor(props) {
super(props);
this.mapManganerRef = React.createRef();
[
'_AMap_vectorlayer',
'_AMap_AMap.MouseTool',
'_AMap_AMap.DistrictSearch',
'_AMap_AMap.Autocomplete',
'_AMap_sync',
'_AMap_AMap.PlaceSearch',
'_AMap_wgl',
'_AMap_overlay',
'_AMap_mouse',
].forEach(item => {
localStorage.removeItem(item);
});
AMapLoader.reset();
}
getView = view => {
store.set('view', view);
this.props.updageMapView(view);
};
render() {
if (_.isNull(this.props.global.mapsettings.areasettings)) {
return null;
}
const props = {
loading: true,
config: this.props.global.mapsettings,
widgets: this.props.global.uiwidgets,
};
return (
<>
<MapComponent {...props} getMapInfo={this.getView} />
</>
);
}
}
const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']),
});
const mapDispatchToProps = dispatch => ({
updageMapView(mapView) {
dispatch(actionCreators.updageMapView(mapView));
},
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(CreateMap);
import ArcgisMap from './arcgis';
import AMap from './amap';
export { ArcgisMap, AMap };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment