Commit 6c9ce0a4 authored by 邓晓峰's avatar 邓晓峰

feat: 集成ARGGIS

parents fc08153e 2c95e174
......@@ -59,8 +59,8 @@ push:
- 'git clean -fd'
- 'git remote set-url origin "https://${GIT_ACCESS_USER}:${GIT_ACCESS_PASSWORD}@g.civnet.cn:8443/CivPublish/CivWebPublish2021.git"'
- 'git pull origin map'
- 'git rm -rf "${TARGET_REPO}/civbase"'
- 'git commit -m "chore: clear folder"'
#- 'git rm -rf "${TARGET_REPO}/civbase"'
#- 'git commit -m "chore: clear folder"'
#- 'git push origin map'
- 'robocopy "${CI_PROJECT_DIR}/../CivWebPublish2021/civbase" "${TARGET_REPO}/civbase" /S ;
IF ((${LASTEXITCODE} -le 8)) {cmd /c "exit /b 0"}'
......
const slash = require('slash2');
const proxy = require('./proxy');
const defaultSetting = require('./defaultSetting');
const { REACT_APP_ENV } = process.env;
const cesiumBuild = '../node_modules/cesium/Build/Cesium';
const pkgName = require('../package.json').name;
// eslint-disable-next-line import/order
const path = require('path');
const { REACT_APP_ENV } = process.env;
const pkgName = require('../package.json').name;
const path = require('path');
const CESIUM_BASE_URL = `/${pkgName}`;
module.exports = {
......@@ -33,7 +36,12 @@ module.exports = {
ignoreMomentLocale: true,
nodeModulesTransform: {
type: 'none',
exclude: ['@wisdom-map/arcgismap', 'swagger-ui-react'],
exclude: [
// '@wisdom-map/arcgismap',
// '@wisdom-map/arcgismap/lib/arcgisapi',
'swagger-ui-react',
'Cesium'
],
},
proxy: proxy[REACT_APP_ENV || 'dev'],
// openAPI: {
......@@ -105,5 +113,30 @@ module.exports = {
cesium: path.resolve(__dirname, cesiumBuild),
},
workerLoader: {},
copy: [
{
from: path.join(pkgName, cesiumBuild, './Workers'),
to: 'Workers',
},
{
from: path.join(pkgName, cesiumBuild, 'Assets'),
to: 'Assets',
},
{
from: path.join(pkgName, cesiumBuild, 'Widgets'),
to: 'Widgets',
},
{
from: path.join(pkgName, cesiumBuild, 'ThirdParty'),
to: 'ThirdParty',
},
],
define: {
CESIUM_BASE_URL: JSON.stringify(CESIUM_BASE_URL).replace(/\"/g, ''),
},
alias: {
cesium: path.resolve(__dirname, cesiumBuild),
},
// esbuild: {}
};
......@@ -16,10 +16,10 @@ export default {
// activeRule: '/civbase/civ_water',
// },
{
name: 'civ_pandawork',
entry: `//${window.location.hostname}:8081/civ_pandawork`,
name: 'civ_configuration',
entry: `//${window.location.hostname}:8080/civ_configuration`,
container: '#micro-container',
activeRule: '/civbase/civ_pandawork',
activeRule: '/civbase/civ_configuration',
},
{
name: 'report',
......@@ -48,6 +48,12 @@ export default {
container: '#micro-container',
activeRule: '/civbase/middleground',
},
{
name: 'civ_3d',
entry: `//${window.location.hostname}:12000/civ_3d`,
container: '#micro-container',
activeRule: '/civbase/civ_3d',
},
],
prod: [
{
......
......@@ -20,25 +20,18 @@ module.exports = opts => {
const preset = {
presets: [
opts.env && [
'@babel/preset-env',
require('@umijs/deps/compiled/babel/preset-env'),
{
...mergeConfig(defaultEnvConfig,{}),
modules: false,
...opts.env
},
],
// opts.react && ['@babel/preset-react'],
// opts.typescript && [
// '@babel/preset-typescript',
// {
// allowNamespaces: true,
// },
// ],
].filter(Boolean),
plugins: [
['@babel/plugin-proposal-optional-chaining', { loose: false }],
['@babel/plugin-proposal-nullish-coalescing-operator', { loose: false }],
'@babel/plugin-syntax-top-level-await',
require('@umijs/deps/compiled/babel/plugin-syntax-top-level-await').default,
['@babel/plugin-transform-destructuring', { loose: false }],
// opts.typescript && ['babel-plugin-transform-typescript-metadata'],
['@babel/plugin-proposal-decorators', { legacy: true }],
......@@ -58,7 +51,7 @@ module.exports = opts => {
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-react-jsx',
opts.transformRuntime && [
'@babel/plugin-transform-runtime',
require('@umijs/deps/compiled/babel/plugin-transform-runtime').default,
{
version: require('@babel/runtime/package.json').version,
absoluteRuntime: dirname(
......@@ -98,10 +91,23 @@ module.exports = opts => {
'@umijs/babel-plugin-import-to-await-require',
opts.importToAwaitRequire,
],
// opts.lockCoreJS3 && [
// '@umijs/babel-plugin-lock-core-js-3',
// opts.lockCoreJS3,
// ],
'react-activation/babel',
opts.lockCoreJS3 && [
'@umijs/babel-plugin-lock-core-js-3',
opts.lockCoreJS3,
],
opts.noAnonymousDefaultExport && [
require.resolve('@umijs/babel-plugin-no-anonymous-default-export'),
],
[
require('@umijs/deps/compiled/babel/plugin-proposal-record-and-tuple')
.default,
{
syntaxType: 'hash',
polyfillModuleName: '@umijs/deps/reexported/record-tuple-polyfill',
importPolyfill: true,
},
],
].filter(Boolean),
env: {
production: {
......
......@@ -18,7 +18,7 @@ const TYPE_ALL_EXCLUDE = [
'lodash',
'react',
'react-dom',
'@wisdom-map/arcgismap'
// '@wisdom-map/arcgismap'
];
......
......@@ -215,7 +215,7 @@ module.exports = options => {
chainConfig.module
.rule('js')
.test(/\.(js|mjs|jsx|ts|tsx)$/)
.include.add([cwd, ...(process.env.APP_ROOT ? [process.cwd()] : [])])
.include.add([/node_modules\/@esri/, cwd, ...(process.env.APP_ROOT ? [process.cwd()] : [])])
.end()
.exclude.add(/node_modules/)
.add(/\.mfsu/)
......
This diff is collapsed.
......@@ -19,7 +19,7 @@
"analyze": "cross-env ANALYZE=1 npm run build",
"npmcheckversion": "node ./internals/scripts/npmcheckversion.js",
"preinstall": "npm run npmcheckversion",
"build": "cross-env NODE_ENV=production node internals/webpack/build.js",
"build": "cross-env NODE_ENV=production node --max_old_space_size=4096 internals/webpack/build.js",
"build:clean": "rimraf ./build",
"openapi": "cross-env NODE_ENV=development node server/openapi/run.js",
"start": "cross-env REACT_APP_ENV=dev NODE_ENV=development node --max_old_space_size=8192 server --port=$port",
......@@ -90,6 +90,8 @@
"babel-core": "7.0.0-bridge.0"
},
"dependencies": {
"@esri/calcite-colors": "6.0.3",
"@esri/arcgis-html-sanitizer": "2.9.1",
"@amap/amap-jsapi-loader": "^1.0.1",
"@ant-design/colors": "^5.0.1",
"@ant-design/icons": "^4.0.0",
......@@ -100,9 +102,8 @@
"@ant-design/pro-utils": "^1.10.4",
"@babel/polyfill": "7.4.3",
"@babel/runtime": "^7.10.5",
"@esri/arcgis-html-sanitizer": "^2.9.1",
"@esri/calcite-colors": "^6.0.3",
"@wisdom-cesium/cesium": "^1.0.64",
"@wisdom-components/basictable": "^1.5.16",
"@wisdom-components/empty": "^1.4.1",
"@wisdom-map/arcgismap": "^1.0.75-0",
"@wisdom-map/util": "^1.0.27-0",
......@@ -113,6 +114,8 @@
"antd": "^4.17.4",
"compression": "1.7.4",
"connected-react-router": "6.4.0",
"echarts": "^5.3.0",
"echarts-for-react": "^3.0.2",
"fontfaceobserver": "2.1.0",
"history": "4.9.0",
"hoist-non-react-statics": "3.3.0",
......@@ -261,6 +264,7 @@
"prettier": "1.17.0",
"querystring-browser": "^1.0.4",
"raw-loader": "^4.0.2",
"react-activation": "^0.9.9",
"react-app-polyfill": "0.2.2",
"react-error-overlay": "6.0.8",
"react-inlinesvg": "^2.3.0",
......@@ -289,7 +293,7 @@
"traverse": "^0.6.6",
"umi-webpack-bundle-analyzer": "3.6.0",
"url-loader": "1.1.2",
"webpack": "^5.65.0",
"webpack": "^5.70.0",
"webpack-chain": "6.5.1",
"webpack-cli": "4.2.0",
"webpack-dev-middleware": "5.3.0",
......
// 主应用 和 子应用数据传递
import { initGlobalState } from 'qiankun';
export const initialState = {
globalConfig: {},
};
const actions = initGlobalState(initialState);
// action.setGlobalState({key: value}) 更新状态
// actions.onGlobalStateChange((newState, prevStaet) => {}) 监听状态
export default actions;
......@@ -5,6 +5,7 @@ import { event } from 'microser-data';
import { actionCreators } from '../containers/App/store';
import AppService from './service/base';
import notificationService from './service/notification';
import CloudService from './service/cloud';
const { warning } = Modal;
// eslint-disable-next-line no-return-await
instanceRequest.reportCodeError = true;
......@@ -74,4 +75,5 @@ instanceRequest.setErrorHandler(error => {
});
const appService = service(AppService);
const noticeService = service(notificationService);
export { appService, noticeService };
const cloudService = service(CloudService);
export { appService, noticeService, cloudService };
......@@ -3,11 +3,11 @@ import * as constants from '../../constants';
/**
* 兼容老接口
*/
const transformGateWay = (url) => {
if(!/^(cityinterface|CityInterface|CityServer)/) {
return url.replace(/GeteWay/, '')
const transformGateWay = url => {
if (!/^(cityinterface|CityInterface|CityServer)/) {
return url.replace(/GeteWay/, '');
}
}
};
export const API = {
AUTHORIZATION_TOKEN: '/Identity/AuthorizationToken',
......@@ -28,7 +28,8 @@ export const API = {
process.env.NODE_ENV !== 'production'
? '/cityjson?ie=utf-8'
: 'https://pv.sohu.com',
GET_ALL_GROUPS_INFO_FORUSER: '/CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_ALL_GROUPS_INFO_FORUSER:
'/CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather',
SEND_MESSAGE_CODE:
'CityInterface/rest/services/portal.svc/SendMessVerificationCode',
......@@ -87,9 +88,10 @@ const services = {
},
getUserInfo: {
url: () => {
return window.globalConfig && window.globalConfig.hasGateWay? API.GET_GATEWAY_USER_INFO: API.GET_USER_INFO
},
url: () =>
window.globalConfig && window.globalConfig.hasGateWay
? API.GET_GATEWAY_USER_INFO
: API.GET_USER_INFO,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
......@@ -218,30 +220,31 @@ export const searchAutoCity = keywords => {
return jsonp(url, params, options);
};
export const getUserInfo = (params) => {
const url = window.globalConfig && window.globalConfig.hasGateWay? API.GET_GATEWAY_USER_INFO: API.GET_USER_INFO
export const getUserInfo = params => {
const url =
window.globalConfig && window.globalConfig.hasGateWay
? API.GET_GATEWAY_USER_INFO
: API.GET_USER_INFO;
return request({
url: url,
url,
method: constants.REQUEST_METHOD_GET,
params: params,
params,
// params: param.query,
});
}
};
export const getWebSiteConfig = (params) => {
const url = window.globalConfig &&
window.globalConfig &&
window.globalConfig.hasGateWay
? API.GET_WEB_SITE_CONFIG_GEWAY
: API.GET_WEB_SITE_CONFIG;
export const getWebSiteConfig = params => {
const url =
window.globalConfig && window.globalConfig && window.globalConfig.hasGateWay
? API.GET_WEB_SITE_CONFIG_GEWAY
: API.GET_WEB_SITE_CONFIG;
return request({
url: url,
url,
method: constants.REQUEST_METHOD_GET,
params: params,
params,
// params: param.query,
});
}
};
// 更新常用页
export const savePagePartInfo = param =>
......@@ -252,5 +255,4 @@ export const savePagePartInfo = param =>
params: param.query,
});
export default services;
import { jsonp, request } from '@wisdom-utils/utils';
import * as constants from '../../constants';
const portalURL = 'CityInterface/rest/Services/Portal.svc';
export const API = {
GET_DATA_DICTIONARY_LIST:
'/CityInterface/Services/CityServer_WorkFlow/REST/WorkFlowREST.svc/GetDataDictionaryList',
GET_ACCOUNT_PAGELIST: `/CityInterface/Services/CityServer_CaseManage/REST/CaseManageREST.svc/GetAccountPageList`,
// 云平台使用分析
LOGIN_STATISTIC: `${portalURL}/OMManage/LoginStatisticServer`,
FUNCTIONS_STATISTIC: `${portalURL}/OMManage/FunctionStatisticServer`,
ENVIROMENT_STATISTIC: `${portalURL}/OMManage/EnviromentStatisticServer`,
USER_LOGIN_STATISTIC: `${portalURL}/OMManage/UserLoginStatisticServer`,
};
const services = {
getDataDictionaryList: {
url: API.GET_DATA_DICTIONARY_LIST,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getAccountPageList: {
url: API.GET_ACCOUNT_PAGELIST,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getLoginStatistic: {
url: API.LOGIN_STATISTIC,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getFunctionsStatistic: {
url: API.FUNCTIONS_STATISTIC,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getEnviromentStatistic: {
url: API.ENVIROMENT_STATISTIC,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getUserLoginStatistic: {
url: API.USER_LOGIN_STATISTIC,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
};
export default services;
This diff was suppressed by a .gitattributes entry.
......@@ -126,15 +126,15 @@ const GlobalHeaderRight = props => {
? props.global.get('homepage')
: props.global.get('homepage.url');
if(!props.global.get('home')) {
url = `civweb4/${url}`
url = `civweb4/${url.replace(/^\//, '').replace(/^civweb4\//, '')}`
}
window.share.event.emit('goHome', `/${url}`);
url ? (
window.share.event.emit('listenerMointer', {
label: '首页',
url: url,
})
) : null;
// url ? (
// window.share.event.emit('listenerMointer', {
// label: '首页',
// url: url.replace(/^civweb4\//, ''),
// })
// ) : null;
};
......@@ -224,10 +224,17 @@ const GlobalHeaderRight = props => {
<HomeIcon title={intl.formatMessage({id: 'component.header.icon.home'})} />
<span>首页</span>
</div>
<div className={classNames(styles.item)} onClick={handlerFavitor} ref={favitorRef}>
<FavitorIcon></FavitorIcon>
<span>常用</span>
</div>
{
// 云平台去掉常用菜单
props.global && props.global.userInfo && props.global.userInfo.Groups && props.global.userInfo.Groups.length
? null
: (
<div className={classNames(styles.item)} onClick={handlerFavitor} ref={favitorRef}>
<FavitorIcon></FavitorIcon>
<span>常用</span>
</div>
)
}
{/*<div className={classNames(styles.item)} onClick={handlerTheme}>*/}
{/* <ThemeIcon/>*/}
{/* <span>主题</span>*/}
......
......@@ -36,6 +36,10 @@ class NoticeIconView extends Component {
videoMessage: {},
};
// this.renderPlatform
try {
window.share && window.share.event && window.share.event.removeAllListeners('reloadNotice');
} catch (error) {
}
this.notifier = new Notifier(
this.props.global.userInfo,
this.renderVideo,
......@@ -48,6 +52,24 @@ class NoticeIconView extends Component {
async componentDidMount() {
this.notifier.subscribe(NEW_MESSAGE, this.onNewMessage.bind(this));
this.notifier.start();
window.share && window.share.event && window.share.event.on('reloadNotice', () => {
try {
// eslint-disable-next-line no-unused-expressions
this.notifier && this.notifier.stop();
} catch (error) {
// eslint-disable-next-line no-empty
} finally {
this.notifier = new Notifier(
this.props.global.userInfo,
this.renderVideo,
this.renderPlatform,
this.renderSysPlatform,
this.props,
);
this.notifier.subscribe(NEW_MESSAGE, this.onNewMessage.bind(this));
this.notifier.start();
}
});
}
componentWillUnmount() {
......@@ -57,6 +79,7 @@ class NoticeIconView extends Component {
} catch (error) {
// eslint-disable-next-line no-empty
} finally {
window.share.event.removeAllListeners('reloadNotice');
}
}
......
@import '~antd/es/style/themes/default.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%;
}
}
......@@ -23,7 +23,7 @@ import {
SLIDER_MENU_MODE,
VALIDATE_AUTH,
MAP_VIEW,
PD_VIEW
PD_VIEW,
} from './constants';
export function getConfig(data) {
......@@ -174,8 +174,8 @@ export function updageMapView(data) {
export function updatePdCesiumView(data) {
return {
type: PD_VIEW,
data
}
data,
};
}
export function logout(data) {
......@@ -188,13 +188,12 @@ export function logout(data) {
window.globalConfig.token = null;
window.globalConfig.access_token = null;
window.globalConfig.apiGatewayDomain = window.location.origin;
window.globalConfig.baseURI = window.location.origin;
window.globalConfig.baseURI = window.location.origin;
window.globalConfig.hasGateWay = false;
window.globalConfig.userInfo = null;
// window.globalConfig.hasGateWay = ;
}
Cookies.set('token', '', {
path: '/',
});
......@@ -219,7 +218,7 @@ export function logout(data) {
data: {
currentMenuIndex: 0,
complexConfig: {},
globalConfig: window.globalConfig
globalConfig: window.globalConfig,
},
};
}
......@@ -20,4 +20,4 @@ export const COMPLEX_PATHNAME = 'App/COMPLEX_PATHNAME';
export const GET_MICRO_MOUNTED_STATUS = 'App/GET_MICRO_MOUNTED_STATUS';
export const LOGINOUT = 'App/LOGINOUT';
export const MAP_VIEW = 'App/MAP_VIEW';
export const PD_VIEW = "App/PD_VIEW"
export const PD_VIEW = 'App/PD_VIEW';
......@@ -6,8 +6,10 @@ import { store, event } from 'microser-data';
import { Storage } from '@wisdom-utils/utils';
import pkg from '../../../../package.json';
import defaultSetting from '../../../../config/defaultSetting';
import generRoutes, { generFlatRoutes } from '../../../utils/routes';
import { transformWidgets } from '../../../utils/routes';
import generRoutes, {
generFlatRoutes,
transformWidgets,
} from '../../../utils/routes';
import {
CLEAR_RCENT_KEYWORD,
COMPLEX_CONFIG,
......@@ -31,7 +33,7 @@ import {
SLIDER_MENU_MODE,
VALIDATE_AUTH,
MAP_VIEW,
PD_VIEW
PD_VIEW,
} from './constants';
const proxy = require('../../../../config/proxy');
......@@ -72,14 +74,12 @@ export const initialState = fromJS({
complexPathName: null,
microMounted: true,
mapView: null,
pdView: null
});
/* eslint-disable default-case, no-param-reassign */
const appReducer = (state = initialState, action) => {
switch (action.type) {
case GET_CONFIG:
// eslint-disable-next-line no-debugger
// eslint-disable-next-line no-underscore-dangle
window.__INITIAL_STATE__ = Object.assign(
......@@ -92,7 +92,9 @@ const appReducer = (state = initialState, action) => {
env: process.env.NODE_ENV === 'development' ? 'daily' : 'prod',
},
);
window.arcgisAssetsPath = `${window.location.origin}/${pkg.name.toLocaleLowerCase()}/assets`;
window.arcgisAssetsPath = `${
window.location.origin
}/${pkg.name.toLocaleLowerCase()}/assets`;
// eslint-disable-next-line global-require,no-underscore-dangle
window.__INITIAL_STATE__.mdi = 'SDI';
window.__INITIAL_STATE__.menu = 'banner-left';
......@@ -105,43 +107,50 @@ const appReducer = (state = initialState, action) => {
// eslint-disable-next-line no-case-declarations
const { homepage } = window.globalConfig;
const modulePkg = {};
window.globalConfig && window.globalConfig.products && Array.isArray(window.globalConfig.products) && window.globalConfig.products.map(item => {
modulePkg[item.PackageName] = item;
});
config.widgets = transformWidgets(config.widgets);
window.globalConfig &&
window.globalConfig.products &&
Array.isArray(window.globalConfig.products) &&
window.globalConfig.products.map(item => {
modulePkg[item.PackageName] = item;
});
config.widgets = transformWidgets(config.widgets);
const generMenu = generRoutes(config.widgets || [], null, 0, modulePkg);
let flatMenu = [];
if(generMenu) {
if (generMenu) {
flatMenu = generFlatRoutes(generMenu || [], null, null, modulePkg);
}
const home = flatMenu.find(item => {
let path = decodeURI(item.path).split("|");
const path = decodeURI(item.path).split('|');
let currentPath = path[0];
if(/^\//.test(currentPath)) {
if (/^\//.test(currentPath)) {
currentPath = currentPath.replace(/^\//, '');
}
return currentPath === decodeURI(homepage)
return currentPath === decodeURI(homepage);
});
let currentMenuIndex = 0;
if(home) {
const parent = home.level >= 2 ? home.parent.parent: home.level >= 3 ? home.parent.parent.parent: home.parent;
if(parent) {
currentMenuIndex = generMenu.findIndex(item => item.name === parent.label);
if (home) {
const parent =
home.level >= 2
? home.parent.parent
: home.level >= 3
? home.parent.parent.parent
: home.parent;
if (parent) {
currentMenuIndex = generMenu.findIndex(
item => item.name === parent.label,
);
currentProduct.set('currentMenuIndex', currentMenuIndex);
store.set('updateMenuIndex', currentMenuIndex)
store.set('updateMenuIndex', currentMenuIndex);
}
}
// eslint-disable-next-line no-case-declarations
// eslint-disable-next-line no-case-declarations
window.globalConfig.home = home;
// eslint-disable-next-line no-case-declarations
window.globalConfig.home = home;
Cookies.set('city', Cookies.get('city') || window.globalConfig.client);
window.globalConfig = config;
......@@ -239,7 +248,7 @@ const appReducer = (state = initialState, action) => {
return state.merge({
complexConfig: action.data.complexConfig,
currentMenuIndex: action.data.currentMenuIndex,
globalConfig: action.data.globalConfig
globalConfig: action.data.globalConfig,
});
case MAP_VIEW:
store.set('view', action.data);
......@@ -247,10 +256,11 @@ const appReducer = (state = initialState, action) => {
mapView: action.data,
});
case PD_VIEW:
store.set('pdView', action.data)
store.set('pdView', action.data);
return state.merge({
pdView : action.data
})
pdView: action.data,
});
default:
return state;
}
......
......@@ -60,10 +60,12 @@ export const initGlobalConfig = () => {
}
});
// eslint-disable-next-line react-hooks/rules-of-hooks
const client = params.getParams('client') || Cookies.get('city')
let client = params.getParams('client') || Cookies.get('city')
client = client && client !== 'undefined' ? client : 'city';
appService
.queryConfig({
client: client || 'city',
ignoreSite: true,
})
.then(res => {
if (res) {
......@@ -71,7 +73,7 @@ export const initGlobalConfig = () => {
store.dispatch(actionCreators.getConfig(Object.assign({})));
const data = res;
if (!data.client) {
data.client = params.getParams('client') || Cookies.get('city');
data.client = client;
}
// Cookies.set('city', data.client);
store.dispatch(
......
......@@ -35,9 +35,9 @@ import { ReactSVG } from 'react-svg';
import Cookies from 'js-cookie';
import { connect } from 'react-redux';
import { Router, Switch, useHistory } from '@wisdom-utils/runtime';
import keepAlive, { KeepAlive } from 'react-activation';
import RightContent from '@/components/GlobalHeader/ExtendRightContent';
import Panel from '@/components/SliderPanel/MinPanel';
import CesiumMap from '../pages/cesiumMap';
import { actionCreators } from '@/containers/App/store';
import CreateBaseMap from '@/pages/map';
import CesiumMap from '@/pages/cesiumMap';
......@@ -297,10 +297,18 @@ const BasicLayout = props => {
currentChildrenRoute && currentChildrenRoute.routes ? setChildrenRoutes(currentChildrenRoute.routes) : setChildrenRoutes([currentChildrenRoute]);
} else {
let url = props.global && props.global.hasOwnProperty('get') && props.global.get('homepage')
? _.isString(props.global.get('homepage'))
? props.global.get('homepage')
: props.global.get('homepage.url')
: '';
if(!props.global.get('home')) {
url = `civweb4/${url.replace(/^\//, '').replace(/^civweb4\//, '')}`
}
setChildrenRoutes([
{
icon: <HomeIcon />,
path: props.location && props.location.pathname,
icon: <HomeIcon/>,
path: `/${url}`,
name: '首页'
}
])
......@@ -310,27 +318,49 @@ const BasicLayout = props => {
useEffect(() => {
console.log(props.route.routes);
}, [props.currentMenuIndex]);
window.share && window.share.event && window.share.event.on('event:updateCurrentChildrenRoutes', ({ currentPath, currentRoute, selectedIndex }) => {
currentRoute && currentRoute.parent && currentRoute.parent.routes ? setChildrenRoutes(currentRoute.parent.routes) : !currentRoute.parent ? setChildrenRoutes(currentRoute.routes) : setChildrenRoutes([currentRoute]);
setSelectIndex(selectedIndex);
setTabActiveKey(currentPath)
});
window.share && window.share.event && window.share.event.on('event:favitor', ({ icon, name, path }) => {
setChildrenRoutes([
{
icon: <HomeIcon />,
path: path,
name: name
}
])
})
useEffect(() => {
window.share && window.share.event && window.share.event.on('event:updateCurrentChildrenRoutes', ({currentPath, currentRoute, selectedIndex}) => {
currentRoute && currentRoute.parent && currentRoute.parent.routes ? setChildrenRoutes(currentRoute.parent.routes): !currentRoute.parent ? setChildrenRoutes(currentRoute.routes): setChildrenRoutes([currentRoute]);
setSelectIndex(selectedIndex);
setTabActiveKey(currentPath)
});
window.share && window.share.event && window.share.event.on('event:favitor', ({icon, name, path}) => {
setChildrenRoutes([
{
icon: <HomeIcon/>,
path: path,
name: name
}
])
});
window.share && window.share.event && window.share.event.on('goHome', url => {
setChildrenRoutes([
{
icon: <HomeIcon/>,
path: url,
name: '首页'
}
]);
setTabActiveKey(url);
window.history.pushState(null, '', `/civbase${url}`);
});
return () => {
window.share && window.share.event && window.share.event.removeAllListeners('event:updateCurrentChildrenRoutes');
window.share && window.share.event && window.share.event.removeAllListeners('event:favitor');
window.share && window.share.event && window.share.event.removeAllListeners('goHome');
};
}, []);
useEffect(() => {
siteAction.setGlobalConfig(props.global);
if (!Cookies.get('token')) {
let client = props.global && props.global.client;
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city';
let generateType = props.global && props.global.hasOwnProperty('get') && props.global.get('generateType');
let client = props.global && props.global.hasOwnProperty('client') ? props.global.get('client') : null;
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client: 'city';
let generateType = props.global && props.global.hasOwnProperty('get') ? props.global.get('generateType') : null;
generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : '';
history.replace(`/user/login?client=${client}${generateType}`);
props.logout();
......@@ -350,21 +380,6 @@ const BasicLayout = props => {
}, [props.global]);
// setChildrenRoutes(currentChildrenRoute)
window.share.event.on('goHome', url => {
setChildrenRoutes([
{
icon: <HomeIcon />,
path: url,
name: '首页'
}
]);
setTabActiveKey(url);
window.history.pushState(null, '', `/civbase${url}`);
});
/**
* web4全屏退出,切换三级菜单高亮
*/
......@@ -514,7 +529,7 @@ const BasicLayout = props => {
setCollapse(!collapse);
}
const logo = props.global && props.global.get('bannerLogo') ? (props.global && _.isFunction(props.global.transformDevAssetsBaseURL) && props.global.transformDevAssetsBaseURL(props.global.get('bannerLogo'))) : defaultSetting.logo;
const logo = props.global && _.isFunction(props.global.get) && props.global.get('bannerLogo')? (props.global && _.isFunction(props.global.transformDevAssetsBaseURL) && props.global.transformDevAssetsBaseURL(props.global.get('bannerLogo'))): defaultSetting.logo;
return (
<SecurityLayout loading>
......@@ -659,53 +674,52 @@ const BasicLayout = props => {
>
</TabPane>
</>
))}
</Tabs>
</div>
<PageContainer style={{ paddingTop: '0px', height: '100%' }}>
{
renderRoutes(props.route.routes)
}
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : null
}
{
))}
</Tabs>
</div>
<PageContainer style={{paddingTop: '0px', height: '100%'}}>
{
renderRoutes(props.route.routes)
}
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : null
}
{
window.location.pathname.startsWith('/civbase/civ_webgis') ? <CreateBaseMap /> : null
}
window.location.pathname.startsWith('/civbase/civ_webgis') ? <CreateBaseMap /> : null
}
<div id="micro-container" className="subapp-container">
{/* <CreateBaseMap/> */}
{props.children}
</div>
{props.children}
{props.children}
</div>
{props.children}
</PageContainer>
</div>
</div>
</div>
</div>
</div>) : (
<PageContainer style={{ paddingTop: '0px', height: '100%' }}>
{
renderRoutes(props.route.routes)
}
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : null
}
{
window.location.pathname.startsWith('/civbase/civ_webgis') ? <CreateBaseMap /> : null
}
<div id="micro-container" className="subapp-container">
{/*<CreateBaseMap/>*/}
{props.children}
</div>
</PageContainer>
)
}
</div>
</div>
</div>
): (
<PageContainer style={{paddingTop: '0px', height: '100%'}}>
{
renderRoutes(props.route.routes)
}
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : null
}
{
window.location.pathname.startsWith('/civbase/civ_webgis') ? <CreateBaseMap /> : null
}
<div id="micro-container" className="subapp-container">
{/*<CreateBaseMap/>*/}
{props.children}
</div>
</PageContainer>
)
}
</SecurityLayout>);
};
......
......@@ -5,8 +5,8 @@ import { Redirect } from '@wisdom-utils/runtime';
import { PageLoading } from '@ant-design/pro-layout';
import { event } from 'microser-data';
import { stringify } from 'querystring';
import _ from 'lodash';
import { getBaseName } from '../utils/utils';
import _ from 'lodash';
class SecurityLayout extends React.Component {
state = {
......@@ -27,19 +27,32 @@ class SecurityLayout extends React.Component {
// const queryString = stringify({
// redirect: window.location.href,
// });
if(_.isNull(global.token) || (global.hasGateWay && _.isNull(global.access_token))) {
if (
_.isNull(global.token) ||
(global.hasGateWay && _.isNull(global.access_token))
) {
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
let client = global.client || Cookies.get('city');
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client: 'city';
client =
client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client)
? client
: 'city';
// event.emit(?'event:initConfig');
let generateType = global.generateType;
generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : '';
let { generateType } = global;
generateType =
!_.isNull(generateType) &&
!_.isUndefined(generateType) &&
generateType !== 'undefined'
? `&generateType=${generateType}`
: '';
return (
<Redirect to={`/user/login?client=${client}${generateType}`} render={() => window.location.reload()}/>
<Redirect
to={`/user/login?client=${client}${generateType}`}
render={() => window.location.reload()}
/>
);
}
if ((!isLogin && loading) || !isReady) {
return <PageLoading />;
}
......
......@@ -14,6 +14,8 @@ import { appService } from '../api';
import CitySelector from '../components/CitySelector';
import Login from '../pages/user/login/login';
import styles from './UserLayout.less';
import { initMicroApps } from '@/micro';
const { Link } = Anchor;
......@@ -169,7 +171,7 @@ class Site {
self.globalConfig.userInfo.groupType = allStation[0].groupType;
}
}
if (allStation.length > 1) {
if (allStation.length > 0) {
self.currentStationName = arr[arr.length - 1];
self.citySelector = self.AvailableofRegionName(projectStation);
self.siteCityList = self.buildCitySelectTemple(projectStation);
......@@ -342,11 +344,32 @@ class Site {
self.setLoading(false);
// eslint-disable-next-line no-unused-expressions
self.props.updateCurrentIndex && self.props.updateCurrentIndex(0);
window.history.replaceState(
'',
'',
`/${self.globalConfig.homepage}`,
);
initMicroApps();
// 切换站点后,重置掉三级菜单
const homeType = self.globalConfig.homeType || 'civweb4';
const homePath =
self.globalConfig.homepage
? self.globalConfig.homepage.startsWith(homeType)
? self.globalConfig.homepage
: `/${homeType}/${self.globalConfig.homepage}`
: `/${homeType}`;
window.share && window.share.event && window.share.event.emit('event:favitor', {
name: "首页",
path: homePath,
icon: null,
});
// 重新加载订阅消息铃铛
window.share && window.share.event && window.share.event.emit('reloadNotice');
// window.history.replaceState(
// '',
// '',
// `/${self.globalConfig.homepage}`,
// );
self.getCityStationsForUser().then(res => {
window.share.event.emit('updateSite', res);
});
......@@ -357,6 +380,7 @@ class Site {
self.props &&
self.props.updateComplexConfig &&
self.props.updateComplexConfig({});
self.props.history && self.props.history.push(self.globalConfig.homepage ? `/${self.globalConfig.homepage}` : `/?client=${self.globalConfig.client}`);
// window.location.reload();
window.share.event.emit('triggerMicro', this.props.global);
});
......
import React from 'react';
import {
Helmet,
HelmetProvider,
} from 'react-helmet-async';
import { Helmet, HelmetProvider } from 'react-helmet-async';
import { connect } from 'react-redux';
import { getMenuData, getPageTitle } from '@ant-design/pro-layout';
import { renderRoutes } from '../utils/routes';
import {
getMenuData,
getPageTitle,
} from '@ant-design/pro-layout';
import styles from './UserLayout.less';
const UserLayout = props => {
......
......@@ -3,7 +3,6 @@ import 'kit_logger';
import _ from 'lodash';
import {
addGlobalUncaughtErrorHandler,
initGlobalState,
registerMicroApps,
runAfterFirstMounted,
setDefaultMountApp,
......@@ -17,6 +16,7 @@ import { actionCreators } from './containers/App/store';
import { FILTER_FOLER_REG } from './utils/constants';
import loader from './render';
import store from './stores';
import actions from './actions';
// eslint-disable-next-line no-undef
const Logger = logger('micro');
......@@ -119,16 +119,9 @@ export const initMicroApps = () => {
},
);
const globalStore = store.getState().toJS();
const { setGlobalState } = initGlobalState({
// eslint-disable-next-line no-undef
globalConfig: window.globalConfig,
//createStoreage.get('globalConfig'),
global: globalStore.global
});
const globalConfig = window.globalConfig;
globalConfig.homepage = globalConfig.homepage && /civweb4/.test(globalConfig.homepage) ? config.homepage.replace(/civweb4\//, '') : globalConfig.homepage;
console.log(globalConfig);
setGlobalState({
// globalConfig.homepage = globalConfig.homepage && /civweb4/.test(globalConfig.homepage) ? config.homepage.replace(/civweb4\//, ''): globalConfig.homepage;
actions.setGlobalState({
// eslint-disable-next-line no-undef
globalConfig: globalConfig,
//createStoreage.get('globalConfig'),
......@@ -228,7 +221,7 @@ export const defaultApp = () => {
// createStoreage.set('init_web4', true)
// }
// let homepage = config.homepage.replace('civweb4/', '');
const url = !config.home ? `/civbase/civweb4/${config.homepage.replace(/^\//, '')}` : `/civbase/${config.homepage.replace(/^\//, '')}`;
const url = !config.home ? `/civbase/civweb4/${config.homepage.replace(/^\//, '').replace(/^civweb4\//, '')}` : `/civbase/${config.homepage.replace(/^\//, '')}`;
setDefaultMountApp(url);
// if(config.homepage.indexOf('civweb4') > -1) createStoreage.set('init_web4', true);
}
......@@ -490,6 +483,7 @@ window.app.define('@wisdom-map/arcgismap', require.context('../node_modules/@wis
window.app.define('@ant-design/pro-form', require.context('../node_modules/@ant-design/pro-form/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('classnames', require.context('classnames', true, /^.\/index\.js$/), 'index.js');
window.app.define('@ant-design/icons', require.context('../node_modules/@ant-design/icons/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
......
......@@ -12,6 +12,10 @@ import { actionCreators } from '../../containers/App/store';
import SecurityLayout from '../../layouts/SecurityLayout';
import LoginAction from '../user/login/login';
import styles from './index.less';
import { useHistory } from '@wisdom-utils/runtime';
import { initMicroApps } from '@/micro';
import usingIcon from '@/assets/bootPage/using-icon.png';
import { appService } from '@/api';
const industries = [
{ name: '供水', type: '供水', subTitle: 'WATER SUPPLY' },
......@@ -20,8 +24,8 @@ const industries = [
{ name: '能源', type: '能源', subTitle: 'ENERGY SOURCES' },
{ name: '直饮水', type: '直饮水', subTitle: 'DRINGKING WATER' },
// { name: '水资源', type: '水资源', subTitle: 'WATER RESOURCES' },
{ name: '熊猫智能实验室', type: '实验室', subTitle: 'PANDA AI. LAB' },
{ name: '大数据', type: '大数据', subTitle: 'BIG DATA' },
{ name: '熊猫智能实验室', type: '实验室', subTitle: 'PANDA AI. LAB' },
{ name: '项目案例', type: '项目案例', subTitle: 'PROJECT CASE' },
];
const renderIndustries = (config, callback) =>
......@@ -54,10 +58,15 @@ const renderIndustries = (config, callback) =>
}
});
// let loginAction = null;
const BootPage = props => {
const [loadding, setLoadding] = useState(false);
const [hasRole, setHasRole] = useState(false);
const [scale, setScale] = useState(1);
const [loginAction, setAction] = useState(
() => new LoginAction(props),
);
const history = useHistory();
useDocumentTitle(
{ title: defaultSetting.title, id: '', pageName: '行业切换' },
props.global.title || defaultSetting.title,
......@@ -67,21 +76,13 @@ const BootPage = props => {
event.preventDefault();
setLoadding(true);
const config = props.global;
const loginAction = new LoginAction(props);
// const loginAction = new LoginAction(props);
config.uiwidgets = [];
config.widgets = [];
config.allWidgets = [];
props.instance && props.instance.updateConfig(config);
// props.instance && props.instance.getUserInfoAndConfig('', true, type);
loginAction.getUserInfoAndConfig('', true, type);
// eslint-disable-next-line no-shadow
loginAction.events.on('toggleIndustry', event => {
setLoadding(false);
props.history.push(`/?client=${props.global.client}`);
window.share.event.emit('triggerMicro', props.global);
props.updateCurrentIndex(0);
// window.location.reload();
});
loginAction && loginAction.getUserInfoAndConfig('', true, type);
}, []);
useEffect(() => {
// eslint-disable-next-line no-use-before-define
......@@ -96,15 +97,47 @@ const BootPage = props => {
};
useEffect(() => {
window.addEventListener('resize', handleResize);
const handleToggleIndustry = event => {
setLoadding(false);
props.history.push(`/?client=${props.global.client}`);
initMicroApps();
window.share.event.emit('triggerMicro', props.global);
props.updateCurrentIndex(0);
}
loginAction.events.on('toggleIndustry', handleToggleIndustry);
return () => {
window.removeEventListener('resize', handleResize);
loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
};
});
}, []);
const renderIndustr = useMemo(
() => renderIndustries(props.global, handlePage),
[],
);
const intl = useIntl();
const toOMSUsingAnalysis = e => {
e && e.stopPropagation();
props.history.push(`/usingAnalysis`);
};
useEffect(() => {
appService.getUserInfo({
token: props.global.token,
subOID: 'subOID',
site: 'cloud',
ignoreSite: true,
})
.then(res => {
const roles = res && !res.errMsg ? res.roles : null;
const _hasRole = roles && Array.isArray(roles) && roles.filter(r => {
return r.name == '客户运维管理员';
}).length;
setHasRole(!!_hasRole);
});
}, []);
return (
<SecurityLayout>
<div className={styles.bootPage}>
......@@ -145,6 +178,14 @@ const BootPage = props => {
<Spin spinning={loadding} size="large" />
</Space>
</div>
{hasRole ? (
<div className={styles.cloudMonitorBtns}>
<div class="cloud-using-anaylysis-btn" onClick={toOMSUsingAnalysis}>
<img src={usingIcon} alt="" title="点击查看平台使用监控" />
<span>平台使用分析</span>
</div>
</div>
) : null}
</div>
</SecurityLayout>
);
......
......@@ -56,8 +56,8 @@
display: flex;
width: 1280px;
flex-wrap: wrap;
list-style: none;
justify-content: center;
list-style: none;
transition: all .5s ease-out;
overflow: hidden;
padding-top: 10px;
......@@ -126,6 +126,36 @@
left: 50%;
transform: translate(-50%, -50%);
}
.cloudMonitorBtns {
position: fixed;
height: 120px;
width: 100%;
bottom: 0px;
padding: 0 20px;
display: flex;
justify-content: end;
:global {
.cloud-using-anaylysis-btn {
cursor: pointer;
width: 100px;
display: flex;
flex-direction: column;
justify-content: center;
& > img {
width: 50px;
margin: 0 25px;
}
& > span {
color: #fff;
font-size: 14px;
width: 100%;
text-align: center;
}
}
}
}
}
@media screen and (max-width: 1440px) {
......
......@@ -6,9 +6,9 @@ const cesiumMap = props => {
const ref = useRef(null)
const storeRef = useRef(null)
useEffect(() => {
if(storeRef.current) return
if(!(props.globalConfig.mapsettings?.areasettings && globalConfig.mapsettings?.basemaps?.length > 0)) return
const mapConfig3d = props.globalConfig?.mapConfig3d
if(!(props.globalConfig.mapsettings?.areasettings && globalConfig.mapsettings?.basemaps?.length > 0)) return
if(storeRef.current) return
const {widgets} = mapConfig3d
const schemes = parseScheme.parseSchemes(mapConfig3d)
const schemeData = parseScheme.parseDatas(schemes)
......@@ -38,4 +38,4 @@ const mapDispatchToProps = dispatch => ({
}
})
export default connect(mapStateToProps, mapDispatchToProps)(cesiumMap)
\ No newline at end of file
export default connect(mapStateToProps, mapDispatchToProps)(cesiumMap)
This diff is collapsed.
@import '~antd/es/style/themes/default.less';
@background-color-container: #f5f5f5;
@border-radius: 2px;
.usingAnalysis {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
background-color: @background-color-container;
:global {
.@{ant-prefix}-spin-nested-loading,
.@{ant-prefix}-spin-container {
height: 100%;
}
.anticon {
vertical-align: 0.125em;
}
.back-btn {
font-size: 16px;
opacity: 0.75;
cursor: pointer;
line-height: 32px;
user-select: none;
.anticon {
transform: translateX(0px);
transition: transform 0.3s;
}
&:hover {
.anticon {
transform: translateX(-4px);
}
}
}
.cua-content {
width: 100%;
height: 100%;
min-width: 1150px;
// padding: 5px 8px;
// 顶部筛选条件
.cua-header {
background-color: #FFF;
border-radius: @border-radius;
padding: 8px;
display: flex;
align-items: center;
gap: 20px;
.filter-item {
min-width: 220px;
.@{ant-prefix}-select {
width: 140px;
}
}
.sub-title {
margin-left: auto;
font-size: 12px;
color: #aaa;
}
}
.counter-list {
margin-top: 4px;
display: flex;
gap: 4px;
.@{ant-prefix}-card {
flex: 1 1;
.@{ant-prefix}-card-body {
padding: 8px;
}
}
}
.cua-main {
height: calc(100% - 136px);
margin-top: 4px;
display: flex;
flex-direction: column;
.cua-main-middle {
flex: 1;
overflow: hidden;
width: 100%;
min-height: 200px;
margin-bottom: 5px;
display: flex;
justify-content: space-between;
gap: 4px;
}
.cua-main-bottom {
flex: none;
height: 50%;
width: 100%;
min-height: 320px;
display: flex;
justify-content: space-between;
gap: 4px;
.cua-customer-view {
padding: 10px;
.table-cell-bold {
font-weight: bold;
}
.@{ant-prefix}-table-thead th {
text-align: center;
}
}
}
.cua-chart-box {
flex: 1;
background-color: #FFF;
padding: 4px 8px 8px 8px;
display: flex;
flex-direction: column;
.cua-chart-header {
flex: none;
display: flex;
align-items: center;
.cua-chart-title {
font-weight: bold;
line-height: 32px;
&::before {
content: "";
display: inline-block;
width: 3px;
height: 14px;
background-color: #1890ff;
vertical-align: -0.125em;
margin-right: 8px;
}
}
.cua-chart-subtitle {
margin-left: auto;
}
}
.cua-chart-content {
flex: 1;
overflow: hidden;
}
&.enviromentusing-chart-box {
.cua-chart-content {
overflow: visible;
}
}
}
}
}
}
}
.login-log-modal {
:global {
.login-log-modal-header {
display: flex;
margin-bottom: 16px;
.@{ant-prefix}-form-item {
margin-bottom: 0;
margin-right: 8px;
}
}
.login-log-modal-content {
height: 500px;
}
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ import Iframe from 'react-iframe';
import { connect } from 'react-redux';
const ShareFrame = props => {
const state = props.location.state || {};
debugger
if (!state.linkUrl) {
return null;
}
......
......@@ -223,11 +223,18 @@ class Login {
if (result && result.length > 0) {
const config = result.shift();
const homeType = config.productType || 'civweb4';
// 产品类型和首页路径同时有才行
const homepage =
homeType && (params.getParams('redirect') || config.homepage)
? homeType +
'/' +
(params.getParams('redirect') || config.homepage)
: '';
self.globalConfig = Object.assign(self.globalConfig, config, {
theme: self.globalConfig.theme,
menu: self.globalConfig.menu,
style: self.globalConfig.style,
homepage: homeType + '/' + (params.getParams('redirect') || self.globalConfig.homepage || config.homepage),
homepage: homepage,
});
if(self.globalConfig.hasOwnProperty('webConfig')) {
......@@ -255,6 +262,7 @@ class Login {
// this.events.removeAllListeners('toggleIndustry')
// window.share.event = this.events;
if (
self.globalConfig.userInfo &&
self.globalConfig.userInfo.site &&
self.globalConfig.userInfo.site.length > 0
) {
......@@ -317,7 +325,8 @@ class Login {
return false;
}
this.handleLoginError();
Logger.log('获取网络配置失败');
// Logger.log('获取网络配置失败');
console.log('获取网络配置失败');
}
})
.catch(error => {
......@@ -332,7 +341,8 @@ class Login {
let MAX_BOTTOM = 0;
let isScale = false;
let widgetIndex = -1;
this.globalConfig.uiwidgets && this.globalConfig.uiwidgets.map((item, index) => {
this.globalConfig.uiwidgets &&
this.globalConfig.uiwidgets.map((item, index) => {
// eslint-disable-next-line radix
if (parseInt(item.bottom) > MAX_BOTTOM) {
// eslint-disable-next-line radix
......@@ -347,7 +357,7 @@ class Login {
widgetIndex = index;
});
const { layers } = this.globalConfig.mapsettings;
const { layers = [] } = this.globalConfig.mapsettings || {};
if (layers.length === 0) {
widgetIndex !== -1 && this.globalConfig.uiwidgets.splice(widgetIndex, 1);
return Promise.resolve({});
......@@ -847,7 +857,6 @@ class Login {
}
login(usr, pwd, userPhone, isRememberPWD, mode = SERVICE_APP_LOGIN_MODE.password) {
this.events.removeAllListeners('loginError');
const self = this;
if(window.globalConfig && window.globalConfig.hasGateWay) {
usr = userPhone ? userPhone: usr;
......
......@@ -59,27 +59,14 @@ const Login = forwardRef((props, _ref) => {
setSubmitting(true);
props.updateCurrentIndex && props.updateCurrentIndex(-1);
action && action.events.on('loginSuccess', event => {
setSubmitting(false);
props.updateCurrentIndex && props.updateCurrentIndex(0);
props.history.push(`/`);
// debugger
// window.share.event.emit('triggerMicro', props.global);
initMicroApps();
});
action && action.events.on('loginError', event => {
setVisible(false);
setSubmitting(false);
});
action && action.events.on('loginVisible', status => {
setVisible(status);
});
};
useEffect(() => {
if (props.loginMode === LOGIN_WAY.WeChart) {
// if (props.loginMode === LOGIN_WAY.WeChart) {
action &&
action.events.on('loginSuccess', event => {
setSubmitting(false);
props.updateCurrentIndex && props.updateCurrentIndex(0);
props.history.push(`/?client=${props.global.client}`);
// window.share.event.emit('triggerMicro', props.global);
initMicroApps();
......@@ -89,6 +76,15 @@ const Login = forwardRef((props, _ref) => {
setVisible(false);
setSubmitting(false);
});
action &&
action.events.on('loginVisible', status => {
setVisible(status);
});
// }
return () => {
action && action.events && action.events.removeAllListeners('loginSuccess');
action && action.events && action.events.removeAllListeners('loginError');
action && action.events && action.events.removeAllListeners('loginVisible');
}
}, [props.loginMode]);
......
......@@ -8,6 +8,7 @@ import Iframe from '../pages/iframe';
import Login from '../pages/user/login';
import CommonMenu from '../pages/commonMenu';
import NoSecret from '../pages/user/login/noSecret';
import UsingAnalysis from '../pages/cloudOMS/usingAnalysis';
export const dyRoutes = (routes, layout) => {
// eslint-disable-next-line no-shadow
......@@ -34,6 +35,10 @@ export const dyRoutes = (routes, layout) => {
path: '/industry',
component: BootPage,
},
{
path: '/usingAnalysis',
component: UsingAnalysis,
},
{
path: '/',
component: 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