Commit 3585ce0c authored by 邓晓峰's avatar 邓晓峰
parents 125efa35 a40b7b60
Pipeline #44680 passed with stages
in 4 minutes 36 seconds
This diff was suppressed by a .gitattributes entry.
import { appService } from './api'; import { appService } from './api';
import { initMicroApps } from './micro'; import { initMicroApps } from './micro';
import { params, Storeage } from 'kit_utils'; import { params, Storeage } from 'kit_utils';
import Cookies from 'js-cookie';
import { actionCreators } from './containers/App/store'; import { actionCreators } from './containers/App/store';
import { getToken, isString } from './utils/utils'; import { getToken, isString } from './utils/utils';
import loader, { render } from './render'; import loader, { render } from './render';
...@@ -59,7 +60,7 @@ export const initGlobalConfig = () => { ...@@ -59,7 +60,7 @@ export const initGlobalConfig = () => {
} }
}); });
// eslint-disable-next-line react-hooks/rules-of-hooks // eslint-disable-next-line react-hooks/rules-of-hooks
const client = params.getParams('client') const client = params.getParams('client') || Cookies.get('city')
appService appService
.queryConfig({ .queryConfig({
client: client || 'city', client: client || 'city',
...@@ -70,7 +71,7 @@ export const initGlobalConfig = () => { ...@@ -70,7 +71,7 @@ export const initGlobalConfig = () => {
store.dispatch(actionCreators.getConfig(Object.assign({}))); store.dispatch(actionCreators.getConfig(Object.assign({})));
const data = res; const data = res;
if (!data.client) { if (!data.client) {
data.client = params.getParams('client') || 'city'; data.client = params.getParams('client') || Cookies.get('city');
} }
// Cookies.set('city', data.client); // Cookies.set('city', data.client);
store.dispatch( store.dispatch(
......
...@@ -215,7 +215,7 @@ const renderSite = ({data, config, loading, setLoading, action}) => { ...@@ -215,7 +215,7 @@ const renderSite = ({data, config, loading, setLoading, action}) => {
onVisibleChange={visible => setVisible(visible)} onVisibleChange={visible => setVisible(visible)}
> >
{ {
Array.isArray(data.stations) && data.stations.length > 0 ? ( Array.isArray(data.stations) ? (
<div className={layoutStyles.toggleSite}> <div className={layoutStyles.toggleSite}>
<img src={require('../assets/basic/site.png')} className={layoutStyles.site}/> <img src={require('../assets/basic/site.png')} className={layoutStyles.site}/>
<span className={layoutStyles.name}>{data.currentStationName}</span> <span className={layoutStyles.name}>{data.currentStationName}</span>
......
...@@ -382,6 +382,7 @@ class Site { ...@@ -382,6 +382,7 @@ class Site {
} }
}) })
.catch(error => { .catch(error => {
this.setLoading(false);
message.warning('切换企业失败'); message.warning('切换企业失败');
}); });
} }
...@@ -400,10 +401,12 @@ class Site { ...@@ -400,10 +401,12 @@ class Site {
this.writeCookie(token, site); this.writeCookie(token, site);
} else { } else {
message.warning('企业切换失败,请联系管理员排查问题!'); message.warning('企业切换失败,请联系管理员排查问题!');
this.setLoading(false);
} }
}) })
.catch(e => { .catch(e => {
message.warning('企业切换失败,请联系管理员排查问题!'); message.warning('企业切换失败,请联系管理员排查问题!');
this.setLoading(false);
}); });
} }
......
...@@ -18,7 +18,8 @@ const industries = [ ...@@ -18,7 +18,8 @@ const industries = [
{ name: '农饮水', type: '农饮水', subTitle: 'RURAL POTABLE WATER' }, { name: '农饮水', type: '农饮水', subTitle: 'RURAL POTABLE WATER' },
{ name: '排水', type: '排水', subTitle: 'DRAINAGE' }, { name: '排水', type: '排水', subTitle: 'DRAINAGE' },
{ name: '能源', type: '能源', subTitle: 'ENERGY SOURCES' }, { name: '能源', type: '能源', subTitle: 'ENERGY SOURCES' },
{ name: '水资源', type: '水资源', subTitle: 'WATER RESOURCES' }, { name: '直饮水', type: '直饮水', subTitle: 'DRINGKING WATER' },
// { name: '水资源', type: '水资源', subTitle: 'WATER RESOURCES' },
{ name: '熊猫智能实验室', type: '实验室', subTitle: 'PANDA AI. LAB' }, { name: '熊猫智能实验室', type: '实验室', subTitle: 'PANDA AI. LAB' },
{ name: '大数据', type: '大数据', subTitle: 'BIG DATA' }, { name: '大数据', type: '大数据', subTitle: 'BIG DATA' },
{ name: '项目案例', type: '项目案例', subTitle: 'PROJECT CASE' }, { name: '项目案例', type: '项目案例', subTitle: 'PROJECT CASE' },
...@@ -54,7 +55,7 @@ const renderIndustries = (config, callback) => ...@@ -54,7 +55,7 @@ const renderIndustries = (config, callback) =>
}); });
const BootPage = props => { const BootPage = props => {
const [loadding, setLoadding] = useState(false); const [loadding, setLoadding] = useState(false);
const [scale, setScale] = useState(1); const [scale, setScale] = useState(1);
useDocumentTitle( useDocumentTitle(
......
...@@ -255,6 +255,7 @@ class Login { ...@@ -255,6 +255,7 @@ class Login {
// this.events.removeAllListeners('toggleIndustry') // this.events.removeAllListeners('toggleIndustry')
// window.share.event = this.events; // window.share.event = this.events;
if ( if (
self.globalConfig.userInfo &&
self.globalConfig.userInfo.site && self.globalConfig.userInfo.site &&
self.globalConfig.userInfo.site.length > 0 self.globalConfig.userInfo.site.length > 0
) { ) {
...@@ -332,7 +333,8 @@ class Login { ...@@ -332,7 +333,8 @@ class Login {
let MAX_BOTTOM = 0; let MAX_BOTTOM = 0;
let isScale = false; let isScale = false;
let widgetIndex = -1; let widgetIndex = -1;
this.globalConfig.uiwidgets.map((item, index) => { this.globalConfig.uiwidgets &&
this.globalConfig.uiwidgets.map((item, index) => {
// eslint-disable-next-line radix // eslint-disable-next-line radix
if (parseInt(item.bottom) > MAX_BOTTOM) { if (parseInt(item.bottom) > MAX_BOTTOM) {
// eslint-disable-next-line radix // eslint-disable-next-line radix
...@@ -347,7 +349,7 @@ class Login { ...@@ -347,7 +349,7 @@ class Login {
widgetIndex = index; widgetIndex = index;
}); });
const { layers } = this.globalConfig.mapsettings; const { layers = [] } = this.globalConfig.mapsettings || {};
if (layers.length === 0) { if (layers.length === 0) {
widgetIndex !== -1 && this.globalConfig.uiwidgets.splice(widgetIndex, 1); widgetIndex !== -1 && this.globalConfig.uiwidgets.splice(widgetIndex, 1);
return Promise.resolve({}); return Promise.resolve({});
......
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