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

fix: 云平台下切换站点bug

parent 8a13e303
File added
...@@ -14046,7 +14046,7 @@ ...@@ -14046,7 +14046,7 @@
"micromatch": { "micromatch": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-4.0.2.tgz", "resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-4.0.2.tgz",
"integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", "integrity": "sha1-T8sJmb+fvC/L3SEvbWKbmlbDklk=",
"dev": true, "dev": true,
"requires": { "requires": {
"braces": "^3.0.1", "braces": "^3.0.1",
...@@ -16099,7 +16099,7 @@ ...@@ -16099,7 +16099,7 @@
"micromatch": { "micromatch": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-4.0.2.tgz", "resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-4.0.2.tgz",
"integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", "integrity": "sha1-T8sJmb+fvC/L3SEvbWKbmlbDklk=",
"dev": true, "dev": true,
"requires": { "requires": {
"braces": "^3.0.1", "braces": "^3.0.1",
...@@ -18793,9 +18793,9 @@ ...@@ -18793,9 +18793,9 @@
"dev": true "dev": true
}, },
"kit_global_config": { "kit_global_config": {
"version": "1.0.21", "version": "1.0.22",
"resolved": "https://g.civnet.cn:4873/kit_global_config/-/kit_global_config-1.0.21.tgz", "resolved": "https://g.civnet.cn:4873/kit_global_config/-/kit_global_config-1.0.22.tgz",
"integrity": "sha512-iMSXpoYdFAKPHf1we0f0KZo5DJFYa+Bwz3shEcPdiD1hwttalVnvLTP6tW7RHFLgktZMcnx24HclDukeFAPbug==", "integrity": "sha512-L/JsC2eL5pRGociJ1ZT3gZK5mJbR28uh9h5drgNcBJK313GcRQSFMzk5AAif14LGwbIBM1zi7k8uUQXseDAsyg==",
"requires": { "requires": {
"@babel/runtime": "^7.10.5", "@babel/runtime": "^7.10.5",
"js-base64": "^3.5.2", "js-base64": "^3.5.2",
...@@ -20380,7 +20380,7 @@ ...@@ -20380,7 +20380,7 @@
"micromatch": { "micromatch": {
"version": "3.1.10", "version": "3.1.10",
"resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-3.1.10.tgz", "resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-3.1.10.tgz",
"integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "integrity": "sha1-cIWbyVyYQJUvNZoGij/En57PrCM=",
"dev": true, "dev": true,
"requires": { "requires": {
"arr-diff": "^4.0.0", "arr-diff": "^4.0.0",
...@@ -28512,7 +28512,7 @@ ...@@ -28512,7 +28512,7 @@
"micromatch": { "micromatch": {
"version": "3.1.10", "version": "3.1.10",
"resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-3.1.10.tgz", "resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-3.1.10.tgz",
"integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", "integrity": "sha1-cIWbyVyYQJUvNZoGij/En57PrCM=",
"dev": true, "dev": true,
"requires": { "requires": {
"arr-diff": "^4.0.0", "arr-diff": "^4.0.0",
...@@ -28737,7 +28737,7 @@ ...@@ -28737,7 +28737,7 @@
"micromatch": { "micromatch": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-4.0.2.tgz", "resolved": "https://g.civnet.cn:4873/micromatch/-/micromatch-4.0.2.tgz",
"integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", "integrity": "sha1-T8sJmb+fvC/L3SEvbWKbmlbDklk=",
"dev": true, "dev": true,
"requires": { "requires": {
"braces": "^3.0.1", "braces": "^3.0.1",
...@@ -56,12 +56,12 @@ const services = { ...@@ -56,12 +56,12 @@ const services = {
}, },
getWebSiteConfig: { getWebSiteConfig: {
url: () => url: () => API.GET_WEB_SITE_CONFIG_GEWAY,
window.globalConfig && // window.globalConfig &&
window.globalConfig && // window.globalConfig &&
window.globalConfig.hasGateWay // window.globalConfig.hasGateWay
? API.GET_WEB_SITE_CONFIG_GEWAY // ? API.GET_WEB_SITE_CONFIG_GEWAY
: API.GET_WEB_SITE_CONFIG, // : API.GET_WEB_SITE_CONFIG,
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
......
...@@ -65,12 +65,12 @@ const initLocale = () => { ...@@ -65,12 +65,12 @@ const initLocale = () => {
}; };
const initGlobalConfig = () => { const initGlobalConfig = () => {
debugger
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const config = createStoreage.get('globalConfig') || {}; let config = {};
if (!Cookies.get('token') || config.token == null) { if (!Cookies.get('token') || config.token == null) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
createStoreage.remove(namespace); createStoreage.remove(namespace);
config = {};
} }
if (!params.getParams('client', window.location.search) && config) { if (!params.getParams('client', window.location.search) && config) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
...@@ -81,45 +81,11 @@ const initGlobalConfig = () => { ...@@ -81,45 +81,11 @@ const initGlobalConfig = () => {
if (!createStoreage.get('globalConfig')) { if (!createStoreage.get('globalConfig')) {
window.createStoreage = new Storeage(namespace); window.createStoreage = new Storeage(namespace);
} }
if(!Cookies.get('token')) { if (!Cookies.get('token')) {
localStorage.removeItem('loginSite'); localStorage.removeItem('loginSite');
} }
if (params.getParams('client')) {
appService
.queryConfig({ client: params.getParams('client') || 'city' })
.then(res => {
if (res) {
const data = res;
if (!data.client) {
delete data.client;
}
store.dispatch(
actionCreators.getConfig(
Object.assign({}, window.globalConfig, data),
),
);
// eslint-disable-next-line no-shadow
}
return res;
})
// eslint-disable-next-line no-shadow
.then(res => {
render({ appContent: '', loading: true });
})
.catch(error => {
store.dispatch(actionCreators.getConfigError(error));
});
}
if (config.token !== null && Object.keys(config).length > 0) { if (config.token !== null && Object.keys(config).length > 0) {
// eslint-disable-next-line no-new
new Login(
{
global: config,
updateConfig: data => store.dispatch(actionCreators.getConfig(data)),
},
() => {},
true,
);
store.dispatch(actionCreators.getConfig(config)); store.dispatch(actionCreators.getConfig(config));
render({ appContent: '', loading: true }); render({ appContent: '', loading: true });
} else { } else {
...@@ -143,24 +109,36 @@ const initGlobalConfig = () => { ...@@ -143,24 +109,36 @@ const initGlobalConfig = () => {
if (res) { if (res) {
const data = res; const data = res;
if (!data.client) { if (!data.client) {
delete data.client; data.client = 'city';
} }
store.dispatch( store.dispatch(
actionCreators.getConfig( actionCreators.getConfig(
Object.assign({}, window.globalConfig, data), Object.assign({}, window.globalConfig, data),
), ),
); );
// eslint-disable-next-line no-new
if (Cookies.get('token')) {
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new Login( new Login(
{ {
global: Object.assign({}, window.globalConfig, data), global: Object.assign({}, data, {
token: Cookies.get('token'),
}),
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
updateConfig: data => updateConfig: data =>
store.dispatch(actionCreators.getConfig(data)), store.dispatch(actionCreators.getConfig(data)),
}, },
() => {}, () => {
(async () => {
(await (Cookies.get('token') &&
window.globalConfig &&
window.globalConfig.token)) && initMicroApps(loader);
})();
},
true, true,
); );
}
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
} }
return res; return res;
...@@ -173,9 +151,6 @@ const initGlobalConfig = () => { ...@@ -173,9 +151,6 @@ const initGlobalConfig = () => {
store.dispatch(actionCreators.getConfigError(error)); store.dispatch(actionCreators.getConfigError(error));
}); });
} }
if (config.token) {
initMicroApps(loader);
}
}; };
initGlobalConfig(); initGlobalConfig();
......
...@@ -3,7 +3,7 @@ import React, { useEffect, useRef, useState } from 'react'; ...@@ -3,7 +3,7 @@ import React, { useEffect, useRef, useState } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import propTypes from 'prop-types'; import propTypes from 'prop-types';
import KeyCode from 'rc-util/lib/KeyCode'; import KeyCode from 'rc-util/lib/KeyCode';
import { Spin } from 'antd';
import Icon, { MenuOutlined } from '@ant-design/icons'; import Icon, { MenuOutlined } from '@ant-design/icons';
import Categories from './Categories'; import Categories from './Categories';
...@@ -29,14 +29,13 @@ const Panel = props => { ...@@ -29,14 +29,13 @@ const Panel = props => {
props.visible ? styles.visible : styles.hidden, props.visible ? styles.visible : styles.hidden,
); );
const domRef = useRef(); const domRef = useRef();
const [currentMenu, setCurrentMenu] = useState( // eslint-disable-next-line no-debugger;
() => const [currentMenu, setCurrentMenu] = useState(null);
(props.data &&
Array.isArray(props.data) && useEffect(() => {
props.data.length > 0 && setCurrentMenu(props.data[props.currentMenuIndex]);
props.data[0]) || }, [props.data, props.currentMenuIndex]);
{},
);
// eslint-disable-next-line no-underscore-dangle // eslint-disable-next-line no-underscore-dangle
let _clickEvents = null; let _clickEvents = null;
const handleKeyDown = event => { const handleKeyDown = event => {
...@@ -136,7 +135,9 @@ const Panel = props => { ...@@ -136,7 +135,9 @@ const Panel = props => {
/> />
</div> </div>
<div className={styles['main-menus']}> <div className={styles['main-menus']}>
<Spin spinning={!currentMenu}>
<Menu data={currentMenu || []} handleClick={selectItem} /> <Menu data={currentMenu || []} handleClick={selectItem} />
</Spin>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -50,7 +50,10 @@ const noMatch = ( ...@@ -50,7 +50,10 @@ const noMatch = (
const renderIcon = (icon, size, alias) => { const renderIcon = (icon, size, alias) => {
const transformIcon = () => icon.replace(/\s*/g, ''); const transformIcon = () => icon.replace(/\s*/g, '');
const url = `${baseURI}/${alias}/${transformIcon()}`; const isURL = /^(http|https)/;
const url = isURL.test(transformIcon())
? transformIcon()
: `${baseURI}/${alias}/${transformIcon()}`;
return ( return (
<img <img
src={url} src={url}
...@@ -66,20 +69,22 @@ const menuExtraRender = currentRoutes => { ...@@ -66,20 +69,22 @@ const menuExtraRender = currentRoutes => {
return { return {
render: ({ collapsed }) => { render: ({ collapsed }) => {
if (currentRoutes) { if (currentRoutes) {
const iconURL =
currentRoutes && currentRoutes.extData && currentRoutes.extData.icon
? `${baseURI}/civweb4/${currentRoutes.extData.icon}`
: '';
return ( return (
<> <>
<Spin <Spin
spinning={currentRoutes.extData && !currentRoutes.extData.icon} spinning={currentRoutes.extData && !currentRoutes.extData.icon}
> >
{currentRoutes.extData && currentRoutes.extData.icon && ( {iconURL && (
<a <a
style={{ display: 'flex', alignItems: 'center' }} style={{ display: 'flex', alignItems: 'center' }}
onClick={() => setToggleSystem(!toggleSystem)} onClick={() => setToggleSystem(!toggleSystem)}
> >
<img <img
src={`${baseURI}/civweb4/${currentRoutes && src={iconURL}
currentRoutes.extData &&
currentRoutes.extData.icon}`}
style={{ width: '20px', height: '20px' }} style={{ width: '20px', height: '20px' }}
alt="" alt=""
/> />
...@@ -211,7 +216,7 @@ const Stations = props => { ...@@ -211,7 +216,7 @@ const Stations = props => {
); );
}; };
const renderTitle = ( const renderTitle = ({
title, title,
action, action,
data, data,
...@@ -219,8 +224,9 @@ const renderTitle = ( ...@@ -219,8 +224,9 @@ const renderTitle = (
setLoading, setLoading,
collapsed, collapsed,
fixedHeader, fixedHeader,
config config,
) => { }) => {
// eslint-disable-next-line react-hooks/rules-of-hooks,no-debugger
// eslint-disable-next-line react-hooks/rules-of-hooks // eslint-disable-next-line react-hooks/rules-of-hooks
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const header = document.querySelector('.ant-pro-fixed-header'); const header = document.querySelector('.ant-pro-fixed-header');
...@@ -244,8 +250,7 @@ const renderTitle = ( ...@@ -244,8 +250,7 @@ const renderTitle = (
if(config && config.userInfo && config.userInfo.site === "") { if(config && config.userInfo && config.userInfo.site === "") {
loaded = false; loaded = false;
} }
return { return (
render: (
<> <>
<span className={styles['header-title']} style={{ marginLeft }}> <span className={styles['header-title']} style={{ marginLeft }}>
{title} {title}
...@@ -296,8 +301,7 @@ const renderTitle = ( ...@@ -296,8 +301,7 @@ const renderTitle = (
</Spin> </Spin>
</> </>
), );
};
}; };
const BasicLayout = props => { const BasicLayout = props => {
/* eslint-disable no-unused-vars */ /* eslint-disable no-unused-vars */
...@@ -336,7 +340,7 @@ const BasicLayout = props => { ...@@ -336,7 +340,7 @@ const BasicLayout = props => {
useEffect(() => { useEffect(() => {
setTimeout(() => { setTimeout(() => {
if (isMounted) setPageLoading(!pageLoading); if (isMounted) setPageLoading(!pageLoading);
}, 1000); }, 2000);
}, []); }, []);
useEffect(() => { useEffect(() => {
...@@ -371,23 +375,31 @@ const BasicLayout = props => { ...@@ -371,23 +375,31 @@ const BasicLayout = props => {
useEffect(() => { useEffect(() => {
setLoading(true); setLoading(true);
clearTime = setTimeout(() => { clearTime = setTimeout(() => {
if(props.route && props.route.routes.length > 0) {
setCurrentRoutes(props.route.routes[props.currentMenuIndex]); setCurrentRoutes(props.route.routes[props.currentMenuIndex]);
setLoading(false); setLoading(false);
}, 20); }
}, 400);
return () => clearTimeout && clearTimeout(clearTime); return () => clearTimeout && clearTimeout(clearTime);
}, [props.currentMenuIndex]); }, [props.currentMenuIndex, props.route]);
useEffect(() => { useEffect(() => {
siteAction.setGlobalConfig(props.global);
if (!Cookies.get('token')) { if (!Cookies.get('token')) {
history.replace(`/user/login?client=${props.global.get('client')}`); history.replace(`/user/login?client=${props.global.get('client')}`);
return; return;
} }
if(props.global && props.global.userInfo && props.global.userInfo.token !== null && Object.keys(cityData).length === 0) { if(props.global && props.global.userInfo && props.global.userInfo.token !== null && props.global.userInfo.loginName && Object.keys(cityData).length === 0) {
siteAction.getCityStationsForUser().then(res => { siteAction.getCityStationsForUser().then(res => {
setCityData(res); setCityData(res);
}); });
} }
}, [props.global]); }, [props.global]);
useEffect(() => {
window.share.event.on('updateSite', res => setCityData(res));
return () => window.share.event.removeAllListeners('updateSite')
}, [])
useMemo(() => { useMemo(() => {
window.share.event.on('listenerRemoveTab', () => { window.share.event.on('listenerRemoveTab', () => {
...@@ -469,16 +481,17 @@ const BasicLayout = props => { ...@@ -469,16 +481,17 @@ const BasicLayout = props => {
fixSiderbar: true, fixSiderbar: true,
collapsed: collapse, collapsed: collapse,
}; };
const headerContentRender = renderTitle(
props.global.get('title'), const headerContentRender = renderTitle({
siteAction, title: props.global.get('title'),
cityData, action: siteAction,
siteLoading, data: cityData,
setSiteLoading, loading: siteLoading,
collapse, setLoading: setSiteLoading,
others.fixedHeader, collapsed: collapse,
props.global, fixedHeader: others.fixedHeader,
); config: props.global,
});
const menuComplexDataRender = menuList => const menuComplexDataRender = menuList =>
menuList.map(item => { menuList.map(item => {
...@@ -657,7 +670,7 @@ const BasicLayout = props => { ...@@ -657,7 +670,7 @@ const BasicLayout = props => {
onMenuHeaderClick={event => handleLogo(event)} onMenuHeaderClick={event => handleLogo(event)}
menuExtraRender={props.menu.length > 0 ? extraRender.render : null} menuExtraRender={props.menu.length > 0 ? extraRender.render : null}
rightContentRender={() => <RightContent {...props} />} rightContentRender={() => <RightContent {...props} />}
headerContentRender={() => headerContentRender.render} headerContentRender={() => headerContentRender}
menu={{ menu={{
loading, loading,
}} }}
......
import React from 'react'; import React from 'react';
import Cookies from 'js-cookie';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Redirect } from 'react-router-dom'; import { Redirect } from 'react-router-dom';
import PageLoading from '@ant-design/pro-layout'; import PageLoading from '@ant-design/pro-layout';
...@@ -20,7 +20,7 @@ class SecurityLayout extends React.Component { ...@@ -20,7 +20,7 @@ class SecurityLayout extends React.Component {
const { isReady } = this.state; const { isReady } = this.state;
const { children, global, loading } = this.props; const { children, global, loading } = this.props;
const isLogin = const isLogin =
global.token !== null || Cookies.get('token') !== null ||
((global.qrcodeData && ((global.qrcodeData &&
global.qrcodeData.state !== '' && global.qrcodeData.state !== '' &&
global.qrcodeData.code !== '') || global.qrcodeData.code !== '') ||
...@@ -32,8 +32,8 @@ class SecurityLayout extends React.Component { ...@@ -32,8 +32,8 @@ class SecurityLayout extends React.Component {
// <Redirect to={`/user/login?client=${global.client}`} /> // <Redirect to={`/user/login?client=${global.client}`} />
// ); // );
// } // }
if((!isLogin && loading) || !isReady) { if ((!isLogin && loading) || !isReady) {
return <PageLoading/> return <PageLoading />;
} }
if ( if (
!isLogin && !isLogin &&
......
...@@ -28,6 +28,10 @@ class Site { ...@@ -28,6 +28,10 @@ class Site {
// this.initWeatherCity(); // this.initWeatherCity();
} }
setGlobalConfig(config) {
this.globalConfig = config;
}
initWeatherCity() { initWeatherCity() {
try { try {
if ( if (
...@@ -64,6 +68,7 @@ class Site { ...@@ -64,6 +68,7 @@ class Site {
ignoreSite: true, ignoreSite: true,
}) })
.then(res => { .then(res => {
debugger
if (res && res.say.errMsg === '' && res.say.statusCode === ERR_OK) { if (res && res.say.errMsg === '' && res.say.statusCode === ERR_OK) {
const result = res.getMe; const result = res.getMe;
let city = self.weatherCity; let city = self.weatherCity;
...@@ -161,7 +166,7 @@ class Site { ...@@ -161,7 +166,7 @@ class Site {
self.globalConfig.userInfo.groupType = allStation[0].groupType; self.globalConfig.userInfo.groupType = allStation[0].groupType;
} }
} }
debugger
if (allStation.length > 1) { if (allStation.length > 1) {
self.currentStationName = arr[arr.length - 1]; self.currentStationName = arr[arr.length - 1];
self.citySelector = self.AvailableofRegionName(projectStation); self.citySelector = self.AvailableofRegionName(projectStation);
...@@ -334,8 +339,16 @@ class Site { ...@@ -334,8 +339,16 @@ class Site {
self.setLoading(false); self.setLoading(false);
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
self.props.updateCurrentIndex && self.props.updateCurrentIndex(0); self.props.updateCurrentIndex && self.props.updateCurrentIndex(0);
window.history.replaceState('', '', `/civbase/`); window.history.replaceState(
window.location.reload(); '',
'',
`/civbase/civweb4/${self.globalConfig.homepage}`,
);
self.getCityStationsForUser().then(res => {
window.share.event.emit('updateSite', res);
});
// window.location.reload();
window.share.event.emit('triggerMicro', this.props.global);
}); });
login.init(); login.init();
} }
......
...@@ -378,6 +378,14 @@ ...@@ -378,6 +378,14 @@
:global(.@{ant-prefix}-pro-basicLayout .@{ant-prefix}-pro-sider-logo h1) { :global(.@{ant-prefix}-pro-basicLayout .@{ant-prefix}-pro-sider-logo h1) {
display: none; display: none;
} }
:global(.@{ant-prefix}-pro-basicLayout .@{ant-prefix}-layout-sider-children .@{ant-prefix}-spin-lg .@{ant-prefix}-spin-dot) {
font-size: 20px;
}
:global(.@{ant-prefix}-pro-basicLayout .@{ant-prefix}-layout-sider-children .@{ant-prefix}-spin-lg .@{ant-prefix}-spin-dot i) {
width: 9px;
height: 9px;
}
//:global(.@{ant-prefix}-layout-sider-collapsed //:global(.@{ant-prefix}-layout-sider-collapsed
//// .@{ant-prefix}-menu-dark.@{ant-prefix}-menu-vertical //// .@{ant-prefix}-menu-dark.@{ant-prefix}-menu-vertical
......
...@@ -25,5 +25,4 @@ export default { ...@@ -25,5 +25,4 @@ export default {
'component.header.icon.home': '首页', 'component.header.icon.home': '首页',
'component.header.icon.order': '工单', 'component.header.icon.order': '工单',
'component.header.icon.alarm': '报警', 'component.header.icon.alarm': '报警',
}; };
...@@ -26,6 +26,36 @@ const MICRO_STATUS = { ...@@ -26,6 +26,36 @@ const MICRO_STATUS = {
SKIP_BECAUSE_BROKEN: 'SKIP_BECAUSE_BROKEN', SKIP_BECAUSE_BROKEN: 'SKIP_BECAUSE_BROKEN',
LOAD_ERROR: 'LOAD_ERROR', LOAD_ERROR: 'LOAD_ERROR',
}; };
const excludeAssetFilter = [
'framework/amap/AMap.UI',
'framework/amap/init.js',
'configuration/js',
'framework/three.js',
'threedimensional/frameworkthree',
'iframe/Civ3DLLab/js',
'framework/jquery/gridify-min.js',
'framework/jquery/gridify.qrcode.js',
'echarts',
'lbs.amap.com',
'restapi.amap.com',
'lbs.amap.com',
'restapi.amap.com',
'webapi.amap.com',
'webapi.amap.com/count',
'api.map.baidu.com',
'map.baidu.com',
'pv.sohu.com',
'mt0.google.cn',
'mt1.google.cn',
'mt2.google.cn',
'mt3.google.cn',
'hm.baidu.com',
'https://maponline0.bdimg.com',
'https://maponline1.bdimg.com',
'https://maponline2.bdimg.com',
'https://maponline3.bdimg.com',
'https://api.map.baidu.com/getscript',
];
export const initMicroApps = loader => { export const initMicroApps = loader => {
const entrys = const entrys =
process.env.NODE_ENV !== 'production' ? micorConfig.dev : micorConfig.prod; process.env.NODE_ENV !== 'production' ? micorConfig.dev : micorConfig.prod;
...@@ -85,33 +115,7 @@ export const initMicroApps = loader => { ...@@ -85,33 +115,7 @@ export const initMicroApps = loader => {
// prefetch: 'all', // prefetch: 'all',
// eslint-disable-next-line no-underscore-dangle // eslint-disable-next-line no-underscore-dangle
getPublicPath: window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__, getPublicPath: window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__,
excludeAssetFilter: url => excludeAssetFilter: url => excludeAssetFilter.includes(url),
url.indexOf('framework/amap/AMap.UI') !== -1 ||
url.indexOf('framework/amap/init.js') !== -1 ||
url.indexOf('configuration/js') !== -1 ||
url.indexOf('framework/three.js') !== -1 ||
url.indexOf('threedimensional/frameworkthree') !== -1 ||
url.indexOf('iframe/Civ3DLLab/js') !== -1 ||
url.indexOf('framework/jquery/gridify-min.js') !== -1 ||
url.indexOf('framework/jquery/gridify.qrcode.js') !== -1 ||
url.indexOf('echarts') !== -1 ||
url.indexOf('lbs.amap.com') !== -1 ||
url.indexOf('restapi.amap.com') !== -1 ||
url.indexOf('webapi.amap.com') !== -1 ||
url.indexOf('webapi.amap.com/count') !== -1 ||
url.indexOf('api.map.baidu.com') !== -1 ||
url.indexOf('map.baidu.com') !== -1 ||
url.indexOf('pv.sohu.com') !== -1 ||
url.indexOf('mt0.google.cn') !== -1 ||
url.indexOf('mt1.google.cn') !== -1 ||
url.indexOf('mt2.google.cn') !== -1 ||
url.indexOf('mt3.google.cn') !== -1 ||
url.indexOf('hm.baidu.com') !== -1 ||
url.indexOf('https://maponline0.bdimg.com') !== -1 ||
url.indexOf('https://maponline1.bdimg.com') !== -1 ||
url.indexOf('https://maponline2.bdimg.com') !== -1 ||
url.indexOf('https://maponline3.bdimg.com') !== -1 ||
url.indexOf('https://api.map.baidu.com/getscript') !== -1,
}); });
runAfterFirstMounted(() => { runAfterFirstMounted(() => {
Logger.info('[MainApp] first app mounted'); Logger.info('[MainApp] first app mounted');
......
...@@ -540,7 +540,8 @@ class Login { ...@@ -540,7 +540,8 @@ class Login {
} }
getUserInfoAndConfig(failCallback, flag, industry) { getUserInfoAndConfig(failCallback, flag, industry) {
const { token } = this.globalConfig; // const { token } = this.globalConfig;
const token = Cookies.get('token');
const site = Cookies.get('site'); const site = Cookies.get('site');
const self = this; const self = this;
/* eslint-disable */ /* eslint-disable */
......
...@@ -57,6 +57,7 @@ const generRotes = (widgets, parent, level = 0) => { ...@@ -57,6 +57,7 @@ const generRotes = (widgets, parent, level = 0) => {
component: 'BasicLayout', component: 'BasicLayout',
parent, parent,
alias: alias, alias: alias,
hideInMenu: item.hideInMenu || false,
routes: generRotes( routes: generRotes(
item.widgets, item.widgets,
Object.assign({}, item, { path, key: subKey }), Object.assign({}, item, { path, key: subKey }),
...@@ -64,7 +65,7 @@ const generRotes = (widgets, parent, level = 0) => { ...@@ -64,7 +65,7 @@ const generRotes = (widgets, parent, level = 0) => {
), ),
extData: { extData: {
...item, ...item,
icon: (item && item.icon && item.icon !== null && item.icon.replace(/\s*/g, '')) || '_', icon: (item && item.icon && item.icon !== null && item.icon.replace(/\s*/g, '')) || '',
}, },
}); });
} else { } else {
...@@ -91,11 +92,11 @@ const generRotes = (widgets, parent, level = 0) => { ...@@ -91,11 +92,11 @@ const generRotes = (widgets, parent, level = 0) => {
href: url, href: url,
target: isURL(url) ? '_blank' : '', target: isURL(url) ? '_blank' : '',
key: guid('panda'), key: guid('panda'),
hideInMenu: l > 3, hideInMenu: l > 3 ? true: item.hideInMenu || false,
alias: item.product || DEFAULT_APPLICATION, alias: item.product || DEFAULT_APPLICATION,
extData: { extData: {
...item, ...item,
icon: (item && item.icon.replace(/\s*/g, '')) || '_', icon: (item && item.icon.replace(/\s*/g, '')) || '',
}, },
parent, parent,
}; };
......
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