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

feat: 优化moment国际化

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