Commit b9e02229 authored by 邓晓峰's avatar 邓晓峰

feat: 优化moment国际化

parent f6b5e507
...@@ -15,7 +15,7 @@ export default { ...@@ -15,7 +15,7 @@ export default {
// }, // },
{ {
name: 'civ_water', name: 'civ_water',
entry: `//${window.location.hostname}:8082/civ_water`, entry: `//${window.location.hostname}:8080/civ_water`,
container: '#micro-container', container: '#micro-container',
activeRule: '/civbase/civ_water', activeRule: '/civbase/civ_water',
}, },
......
...@@ -110,9 +110,9 @@ ...@@ -110,9 +110,9 @@
"@wisdom-map/Map": "^1.0.12-17", "@wisdom-map/Map": "^1.0.12-17",
"@wisdom-map/arcgismap": "^1.0.79-17", "@wisdom-map/arcgismap": "^1.0.79-17",
"@wisdom-map/util": "^1.0.27-0", "@wisdom-map/util": "^1.0.27-0",
"@wisdom-utils/components": "0.1.35", "@wisdom-utils/components": "0.1.43",
"@wisdom-utils/runtime": "0.0.15", "@wisdom-utils/runtime": "0.0.15",
"@wisdom-utils/utils": "0.1.75", "@wisdom-utils/utils": "0.1.83",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"antd": "^4.17.4", "antd": "^4.17.4",
"compression": "1.7.4", "compression": "1.7.4",
......
...@@ -4,13 +4,12 @@ import { Helmet } from 'react-helmet'; ...@@ -4,13 +4,12 @@ import { Helmet } from 'react-helmet';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Router, Switch } from '@wisdom-utils/runtime'; import { Router, Switch } from '@wisdom-utils/runtime';
import { helpers } from '@wisdom-utils/utils'; import { helpers } from '@wisdom-utils/utils';
import defaultSetting from '@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings';
// eslint-disable-next-line import/extensions // eslint-disable-next-line import/extensions
import { dyRoutes } from '../../routes/config'; import { dyRoutes } from '../../routes/config';
const pkg = require('../../../package.json'); const pkg = require('../../../package.json');
const config = require('../../../config/config');
const defaultSetting = config.layout;
const { renderRoutes } = helpers; const { renderRoutes } = helpers;
const config = require('../../../config/config');
function App(props) { function App(props) {
// //
const metaSecurity = /https/.test(window.location.protocol) ? ( const metaSecurity = /https/.test(window.location.protocol) ? (
......
...@@ -3,7 +3,7 @@ import Cookies from 'js-cookie'; ...@@ -3,7 +3,7 @@ import Cookies from 'js-cookie';
import { AppConfig, store, event, Storage, helpers } from '@wisdom-utils/utils'; import { AppConfig, store, event, Storage, helpers } from '@wisdom-utils/utils';
import { Storeage as Store } from '@wisdom-utils/utils/lib/helpers'; import { Storeage as Store } from '@wisdom-utils/utils/lib/helpers';
import pkg from '../../../../package.json'; import pkg from '../../../../package.json';
import defaultSetting from '../../../../config/defaultSetting'; import defaultSetting from '@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings';
// import { transformWidgets } from '../../../utils/routes'; // import { transformWidgets } from '../../../utils/routes';
// eslint-disable-next-line import/no-duplicates // eslint-disable-next-line import/no-duplicates
import { import {
......
import React, { useEffect, useRef, useState, useContext, Suspense } from 'react'; import React, { useEffect, useRef, useState, Suspense } from 'react';
import { Anchor, Popover, Radio, Spin, ConfigProvider } from 'antd'; import { Anchor, Popover, Radio, Spin } from 'antd';
import Icon, { LoadingOutlined } from '@ant-design/icons'; import Icon, { LoadingOutlined } from '@ant-design/icons';
import { store, helpers } from '@wisdom-utils/utils'; import { store, helpers } from '@wisdom-utils/utils';
import classNames from 'classnames'; import classNames from 'classnames';
...@@ -11,22 +11,17 @@ import KeepAlive from 'react-activation'; ...@@ -11,22 +11,17 @@ import KeepAlive from 'react-activation';
import AMapLoader from '@amap/amap-jsapi-loader'; import AMapLoader from '@amap/amap-jsapi-loader';
import { BasicLayout } from '@wisdom-utils/components/lib/AppLayout' import { BasicLayout } from '@wisdom-utils/components/lib/AppLayout'
import RightContent from '@/components/GlobalHeader/ExtendRightContent'; import RightContent from '@/components/GlobalHeader/ExtendRightContent';
import defaultSetting from '@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings';
import { actionCreators } from '@/containers/App/store'; import { actionCreators } from '@/containers/App/store';
import { WEB_GIS_TYPE } from '../constants'; import { WEB_GIS_TYPE } from '../constants';
// eslint-disable-next-line import/no-duplicates
import SecurityLayout from './SecurityLayout'; import SecurityLayout from './SecurityLayout';
import Site from './Site'; import Site from './Site';
// import styles from './UserLayout.less';
import layoutStyles from './BasicLayout.less'; import layoutStyles from './BasicLayout.less';
const ArcgisMap = React.lazy(() => import('../pages/map/arcgis')); const ArcgisMap = React.lazy(() => import('../pages/map/arcgis'));
const AMap = React.lazy(() => import('../pages/map/amap')); const AMap = React.lazy(() => import('../pages/map/amap'));
const CesiumMap = React.lazy(() => import('../pages/map/cesiumMap')); const CesiumMap = React.lazy(() => import('../pages/map/cesiumMap'));
import actions from '../actions';
// eslint-disable-next-line import/extensions
const { params } = helpers; const { params } = helpers;
const { getParamsV1 } = params; const { getParamsV1 } = params;
const { layout: defaultSetting } = require('../../config/config');
// import Login from '../pages/user/login/login';
const antIcon = <LoadingOutlined style={{ fontSize: 12 }} spin />; const antIcon = <LoadingOutlined style={{ fontSize: 12 }} spin />;
const arrowSvg = ({ fillColor = '#fff' }) => ( const arrowSvg = ({ fillColor = '#fff' }) => (
<svg t="1543324489942" <svg t="1543324489942"
...@@ -38,17 +33,15 @@ const arrowSvg = ({ fillColor = '#fff' }) => ( ...@@ -38,17 +33,15 @@ const arrowSvg = ({ fillColor = '#fff' }) => (
</svg> </svg>
); );
const ArrowIcon = props => <Icon component={arrowSvg} {...props} />; const ArrowIcon = props => <Icon component={arrowSvg} {...props} />;
const optionsWith = [ const optionsWith = [
{ label: '按站点', value: 'site' }, { label: '按站点', value: 'site' },
{ label: '按城市', value: 'city' }, { label: '按城市', value: 'city' },
]; ];
const HOT = ['HOT', '县', '市', 'New']; const HOT = ['HOT', '县', '市', 'New'];
const StationsItem = (item, action) => { const StationsItem = (item, action, onChangeVisible) => {
const changeGroup = (event, data) => { const changeGroup = (event, data) => {
action.changeGroup && action.changeGroup(event, data); debugger
action.changeGroup && action.changeGroup(event, data, onChangeVisible);
}; };
return ( return (
<li <li
...@@ -93,7 +86,7 @@ const Stations = props => { ...@@ -93,7 +86,7 @@ const Stations = props => {
<div className={layoutStyles.focusStations}> <div className={layoutStyles.focusStations}>
<ul> <ul>
{Array.isArray(data) {Array.isArray(data)
? data.map(item => StationsItem(item, props.action)) ? data.map(item => StationsItem(item, props.action, props.setVisible))
: null} : null}
</ul> </ul>
</div> </div>
...@@ -164,11 +157,13 @@ const renderSite = ({ data, config, loading, setLoading, action }) => { ...@@ -164,11 +157,13 @@ const renderSite = ({ data, config, loading, setLoading, action }) => {
<Popover <Popover
placement="bottomLeft" placement="bottomLeft"
trigger="click" trigger="click"
visible={visible}
content={ content={
<Stations <Stations
data={data} data={data}
loading={loading} loading={loading}
setLoading={setLoading} setLoading={setLoading}
setVisible={setVisible}
action={action} action={action}
/> />
} }
...@@ -208,31 +203,17 @@ const renderSite = ({ data, config, loading, setLoading, action }) => { ...@@ -208,31 +203,17 @@ const renderSite = ({ data, config, loading, setLoading, action }) => {
} }
const Layout = props => { const Layout = props => {
/* eslint-disable no-unused-vars */
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
const prefixCls = props.prefixCls || getPrefixCls('');
// const [currentRoutes, setCurrentRoutes] = useState([]);
const [collapse, setCollapse] = useState(false); const [collapse, setCollapse] = useState(false);
const [cityData, setCityData] = useState({}); const [cityData, setCityData] = useState({});
const [siteLoading, setSiteLoading] = useState(false); const [siteLoading, setSiteLoading] = useState(false);
const [prevHistoryBase, setPrevHistoryBase] = useState(() => {
const pathname = props.location.pathname;
const argv = pathname.split('/');
return argv[1];
});
const [mapMode, setMapMode] = useState(WEB_GIS_TYPE.ARCGIS) const [mapMode, setMapMode] = useState(WEB_GIS_TYPE.ARCGIS)
const [siteAction, setSiteAction] = useState( const [siteAction, setSiteAction] = useState(
() => new Site(props, setSiteLoading), () => new Site(props, setSiteLoading),
); );
// const basename = getBaseName(); // const basename = getBaseName();
const history = useHistory(); const history = useHistory();
useEffect(() => { useEffect(() => {
siteAction.setGlobalConfig(props.global); siteAction.setGlobalConfig(props.global);
if (!Cookies.get('token')) { if (!Cookies.get('token')) {
let client = props.global && props.global.hasOwnProperty('client') ? props.global.get('client') : null; let client = props.global && props.global.hasOwnProperty('client') ? props.global.get('client') : null;
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city'; client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city';
...@@ -255,10 +236,6 @@ const Layout = props => { ...@@ -255,10 +236,6 @@ const Layout = props => {
} }
}, [props.global]); }, [props.global]);
/**
* web4全屏退出,切换三级菜单高亮
*/
const handlerPageChange = () => { const handlerPageChange = () => {
const params = getParamsV1(props.location.pathname); const params = getParamsV1(props.location.pathname);
......
...@@ -10,7 +10,7 @@ import { CitySelector } from '@wisdom-utils/components'; ...@@ -10,7 +10,7 @@ import { CitySelector } from '@wisdom-utils/components';
import { appService } from '../api'; import { appService } from '../api';
import Login from '../pages/user/login/login'; import Login from '../pages/user/login/login';
import styles from './BasicLayout.less'; import styles from './BasicLayout.less';
import { initMicroApps } from '../micro' // import { initMicroApps } from '../micro'
// import actions from '../actions'; // import actions from '../actions';
const { Link } = Anchor; const { Link } = Anchor;
...@@ -315,7 +315,7 @@ class Site { ...@@ -315,7 +315,7 @@ class Site {
return arr; return arr;
} }
writeCookie(token, site) { writeCookie(token, site, onChangeVisible) {
const date = new Date(); const date = new Date();
date.setTime(date.getTime() + 24 * 60 * 60 * 1000); date.setTime(date.getTime() + 24 * 60 * 60 * 1000);
// date = date.toGMTString(); // date = date.toGMTString();
...@@ -367,11 +367,12 @@ class Site { ...@@ -367,11 +367,12 @@ class Site {
self.props.updateCollapsed && self.props.updateCollapsed &&
self.props.updateCollapsed(false); self.props.updateCollapsed(false);
window.share.event.emit('triggerMicro', this.props.global); window.share.event.emit('triggerMicro', this.props.global);
onChangeVisible && onChangeVisible(false);
}); });
login.init(); login.init();
} }
changeGroup(event, item) { changeGroup(event, item, onChangeVisible) {
event.persist(); event.persist();
const site = item ? item.site : event.target.dataset.site; const site = item ? item.site : event.target.dataset.site;
const { loginName } = this.globalConfig.userInfo; const { loginName } = this.globalConfig.userInfo;
...@@ -386,7 +387,7 @@ class Site { ...@@ -386,7 +387,7 @@ class Site {
// eslint-disable-next-line no-debugger // eslint-disable-next-line no-debugger
const { token } = res; const { token } = res;
if (token) { if (token) {
this.beforeChangeCheck(token, site); this.beforeChangeCheck(token, site, onChangeVisible);
} }
}) })
.catch(error => { .catch(error => {
...@@ -395,7 +396,7 @@ class Site { ...@@ -395,7 +396,7 @@ class Site {
}); });
} }
beforeChangeCheck(token, site) { beforeChangeCheck(token, site, onChangeVisible) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
appService appService
.getUserInfo({ .getUserInfo({
...@@ -406,7 +407,7 @@ class Site { ...@@ -406,7 +407,7 @@ class Site {
}) })
.then(res => { .then(res => {
if (res && !res.errMsg) { if (res && !res.errMsg) {
this.writeCookie(token, site); this.writeCookie(token, site, onChangeVisible);
} else { } else {
message.warning('企业切换失败,请联系管理员排查问题!'); message.warning('企业切换失败,请联系管理员排查问题!');
this.setLoading(false); this.setLoading(false);
......
...@@ -8,7 +8,7 @@ import { useIntl } from '@wisdom-utils/components'; ...@@ -8,7 +8,7 @@ import { useIntl } from '@wisdom-utils/components';
import { useDocumentTitle } from '@ant-design/pro-utils'; import { useDocumentTitle } from '@ant-design/pro-utils';
import { useHistory } from '@wisdom-utils/runtime'; import { useHistory } from '@wisdom-utils/runtime';
import defaultSetting from '../../../config/defaultSetting'; import defaultSetting from '@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings'
import { actionCreators } from '../../containers/App/store'; import { actionCreators } from '../../containers/App/store';
import SecurityLayout from '../../layouts/SecurityLayout'; import SecurityLayout from '../../layouts/SecurityLayout';
import LoginAction from '../user/login/login'; import LoginAction from '../user/login/login';
......
import LoadingComponent from '@ant-design/pro-layout/es/PageLoading'; import LoadingComponent from '@wisdom-utils/components/lib/AppLayout/components/PageLoading';
import { dynamic } from '@wisdom-utils/runtime'; import { dynamic } from '@wisdom-utils/runtime';
import BasicLayout from '../layouts/BasicLayout'; import BasicLayout from '../layouts/BasicLayout';
......
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