Commit 13b633f3 authored by 邓晓峰's avatar 邓晓峰

feat: es-build

parent 558dd7aa
Pipeline #47271 skipped with stages
...@@ -5,11 +5,14 @@ const cesiumBuild = '../node_modules/cesium/Build/Cesium'; ...@@ -5,11 +5,14 @@ const cesiumBuild = '../node_modules/cesium/Build/Cesium';
const pkgName = require('../package.json').name; const pkgName = require('../package.json').name;
// eslint-disable-next-line import/order // eslint-disable-next-line import/order
const { REACT_APP_ENV } = process.env; const { REACT_APP_ENV } = process.env;
// eslint-disable-next-line import/order
const path = require('path'); const path = require('path');
const CESIUM_BASE_URL = `/${pkgName}`; const CESIUM_BASE_URL = `/${pkgName}`;
module.exports = { module.exports = {
// mfsu: {}, // mfsu: {},
esbuild: {},
webpack5: {}, webpack5: {},
workerLoader: true,
base: '/civbase', base: '/civbase',
title: '熊猫智慧城市监控管理解决方案', title: '熊猫智慧城市监控管理解决方案',
hash: true, hash: true,
...@@ -39,7 +42,7 @@ module.exports = { ...@@ -39,7 +42,7 @@ module.exports = {
'@wisdom-map/Amap', '@wisdom-map/Amap',
'@wisdom-map/Map', '@wisdom-map/Map',
'swagger-ui-react', 'swagger-ui-react',
'Cesium' 'Cesium',
], ],
}, },
proxy: proxy[REACT_APP_ENV || 'dev'], proxy: proxy[REACT_APP_ENV || 'dev'],
......
/* eslint-disable */ /* eslint-disable */
// const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin; // const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin;
// const proxyURL = 'https://work.panda-water.cn'; const proxyURL = 'https://work.panda-water.cn';
const proxyURL = 'http://192.168.12.47:8082'; // const proxyURL = 'http://192.168.12.47:8082';
module.exports = { module.exports = {
......
const { deepmerge, createDebug, winPath, resolve } = require('@umijs/utils'); const { deepmerge, createDebug, winPath, resolve } = require('@umijs/utils');
// const { ESBuildPlugin, ESBuildMinifyPlugin } = require('esbuild-loader'); const { ESBuildPlugin, ESBuildMinifyPlugin } = require('esbuild-loader');
const fs = require('fs'); const fs = require('fs');
const terserOptions = require('./terserOptions');
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const { css, createCSSRule } = require('./css');
const Config = require('webpack-chain'); const Config = require('webpack-chain');
const lodash = require('lodash');
const {
getTargetsAndBrowsersList,
getBabelPresetOpts,
getBabelOpts,
} = require('@umijs/bundler-utils');
const { join } = require('lodash');
const terserOptions = require('./terserOptions');
const { css, createCSSRule } = require('./css');
const pkg = require('../../package.json'); const pkg = require('../../package.json');
const ASSET_PATH = process.env.ASSET_PATH || '/'; const ASSET_PATH = process.env.ASSET_PATH || '/';
const { const {
...@@ -21,13 +28,6 @@ const { ...@@ -21,13 +28,6 @@ const {
excludeToPkgs, excludeToPkgs,
es5ImcompatibleVersionsToPkg, es5ImcompatibleVersionsToPkg,
} = require('./nodeModulesTransform'); } = require('./nodeModulesTransform');
const lodash = require('lodash');
const {
getTargetsAndBrowsersList,
getBabelPresetOpts,
getBabelOpts,
} = require('@umijs/bundler-utils');
const { join } = require('lodash');
function getUserLibDir({ library }) { function getUserLibDir({ library }) {
if ( if (
...@@ -72,7 +72,7 @@ module.exports = options => { ...@@ -72,7 +72,7 @@ module.exports = options => {
const chainConfig = new Config(); const chainConfig = new Config();
chainConfig.mode(options.mode); chainConfig.mode(options.mode);
defineConfig = Object.assign(defineConfig, defaultConfig); defineConfig = Object.assign(defineConfig, defaultConfig);
const {env} = process; const { env } = process;
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isProd = process.env.NODE_ENV === 'production'; const isProd = process.env.NODE_ENV === 'production';
const disableCompress = process.env.COMPRESS === 'none'; const disableCompress = process.env.COMPRESS === 'none';
...@@ -87,7 +87,7 @@ module.exports = options => { ...@@ -87,7 +87,7 @@ module.exports = options => {
: devtool || 'cheap-module-source-map' : devtool || 'cheap-module-source-map'
: devtool, : devtool,
); );
const {mfsu} = defineConfig; const { mfsu } = defineConfig;
const useHash = defineConfig.hash && isProd; const useHash = defineConfig.hash && isProd;
const absOutputPath = process.env.npm_config_releasepath const absOutputPath = process.env.npm_config_releasepath
...@@ -277,7 +277,6 @@ module.exports = options => { ...@@ -277,7 +277,6 @@ module.exports = options => {
esModule: false, esModule: false,
}); });
chainConfig.module chainConfig.module
.rule('svg') .rule('svg')
.test(/\.(svg)(\?.*)?$/) .test(/\.(svg)(\?.*)?$/)
...@@ -447,7 +446,7 @@ module.exports = options => { ...@@ -447,7 +446,7 @@ module.exports = options => {
from: path.join(cwd, item.from), from: path.join(cwd, item.from),
to: path.resolve( to: path.resolve(
process.env.npm_config_releasepath || process.cwd(), process.env.npm_config_releasepath || process.cwd(),
pkg.name.toLocaleLowerCase() + '/' + item.to, `${pkg.name.toLocaleLowerCase()}/${item.to}`,
), ),
}; };
}) })
...@@ -531,10 +530,12 @@ module.exports = options => { ...@@ -531,10 +530,12 @@ module.exports = options => {
...excludeToPkgs({ exclude: nodeModulesTransform.exclude || [] }), ...excludeToPkgs({ exclude: nodeModulesTransform.exclude || [] }),
}; };
rule.include rule.include
.add(path => isMatch({ .add(path =>
isMatch({
path, path,
pkgs, pkgs,
})) }),
)
.end(); .end();
} }
...@@ -654,19 +655,19 @@ module.exports = options => { ...@@ -654,19 +655,19 @@ module.exports = options => {
}); });
} }
// if(defineConfig.esbuild) { if (defineConfig.esbuild) {
// const { target = 'es2015' } = defineConfig.esbuild || {}; const { target = 'es2015' } = defineConfig.esbuild || {};
// const optsMap = { const optsMap = {
// ['csr']: { csr: {
// minify: true, minify: true,
// target target
// } },
// }; };
// const opt = optsMap['csr']; const opt = optsMap.csr;
// chainConfig.optimization.minimize = true; chainConfig.optimization.minimize = true;
// // chainConfig.optimization.minimizer = [new ESBuildMinifyPlugin(opt)]; chainConfig.optimization.minimizer = [new ESBuildMinifyPlugin(opt)];
// // chainConfig.plugin('es-build').use(new ESBuildPlugin()) chainConfig.plugin('es-build').use(new ESBuildPlugin())
// } }
if (defineConfig.chainWebpack) { if (defineConfig.chainWebpack) {
defineConfig.chainWebpack(chainConfig, { defineConfig.chainWebpack(chainConfig, {
...@@ -704,7 +705,7 @@ module.exports = options => { ...@@ -704,7 +705,7 @@ module.exports = options => {
ret = smp.wrap(ret); ret = smp.wrap(ret);
} }
const {entry} = options; const { entry } = options;
if (defineConfig.runtimePublicPath) { if (defineConfig.runtimePublicPath) {
entry.push(require.resolve('./runtimePublicPathEntry')); entry.push(require.resolve('./runtimePublicPathEntry'));
} }
...@@ -714,7 +715,7 @@ module.exports = options => { ...@@ -714,7 +715,7 @@ module.exports = options => {
if (isWebpack5) { if (isWebpack5) {
ret.plugins.push( ret.plugins.push(
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
process: nodeLibs.process process: nodeLibs.process,
}), }),
); );
ret.resolve.fallback = { ret.resolve.fallback = {
......
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
"@wisdom-map/util": "^1.0.27-0", "@wisdom-map/util": "^1.0.27-0",
"@wisdom-utils/components": "0.0.14", "@wisdom-utils/components": "0.0.14",
"@wisdom-utils/runtime": "0.0.15", "@wisdom-utils/runtime": "0.0.15",
"@wisdom-utils/utils": "0.0.74", "@wisdom-utils/utils": "0.0.77",
"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",
...@@ -212,6 +212,7 @@ ...@@ -212,6 +212,7 @@
"cz-customizable": "^6.3.0", "cz-customizable": "^6.3.0",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"ejs": "^3.1.6", "ejs": "^3.1.6",
"esbuild-loader": "^2.18.0",
"eslint": "^5.16.0", "eslint": "^5.16.0",
"eslint-config-airbnb": "17.1.0", "eslint-config-airbnb": "17.1.0",
"eslint-config-airbnb-base": "13.1.0", "eslint-config-airbnb-base": "13.1.0",
......
// 主应用 和 子应用数据传递 // 主应用 和 子应用数据传递
import { initGlobalState } from 'qiankun'; import { initGlobalState } from 'qiankun';
import { event, store } from '@wisdom-utils/utils' import { event, store } from '@wisdom-utils/utils';
export const initialState = { export const initialState = {
globalConfig: {}, globalConfig: {},
event: event, event,
store: store store,
}; };
const actions = initGlobalState(initialState); const actions = initGlobalState(initialState);
// action.setGlobalState({key: value}) 更新状态 // action.setGlobalState({key: value}) 更新状态
// actions.onGlobalStateChange((newState, prevStaet) => {}) 监听状态 // actions.onGlobalStateChange((newState, prevStaet) => {}) 监听状态
export const setGlobalState = actions.setGlobalState; export const { setGlobalState } = actions;
export const onGlobalStateChange = actions.onGlobalStateChange; export const { onGlobalStateChange } = actions;
export default actions; export default actions;
import { Modal, notification } from 'antd'; import { Modal, notification } from 'antd';
import { instanceRequest, service } from '@wisdom-utils/utils'; import { instanceRequest, service, event } from '@wisdom-utils/utils';
import { event } from 'microser-data';
import { actionCreators } from '../containers/App/store';
import AppService from './service/base'; import AppService from './service/base';
import notificationService from './service/notification'; import notificationService from './service/notification';
import CloudService from './service/cloud'; import CloudService from './service/cloud';
...@@ -10,18 +8,32 @@ const { warning } = Modal; ...@@ -10,18 +8,32 @@ const { warning } = Modal;
// eslint-disable-next-line no-return-await // eslint-disable-next-line no-return-await
instanceRequest.reportCodeError = true; instanceRequest.reportCodeError = true;
instanceRequest.transformRequestURL = function(url) { instanceRequest.transformRequestURL = function(url) {
// url = url.replace(/\/GateWay/, '') // url = url.replace(/\/GateWay/, '')
const excludeURL = ['/PandaCore/GCK/Basis/GateWayConfig', '/CityInterface/rest/services.svc/GetConfig']; const excludeURL = [
if(excludeURL.includes(url)) { '/PandaCore/GCK/Basis/GateWayConfig',
'/CityInterface/rest/services.svc/GetConfig',
];
if (excludeURL.includes(url)) {
return url; return url;
} }
if (window.globalConfig && window.globalConfig.hasGateWay && /^\/(cityinterface|CityInterface|Cityinterface|CityServer|PandaInformatization)/.test(url)) { if (
return /\/CityInterface\/rest\/services.svc\/GetConfig/.test(url) ? url ? /^\/GateWay/.test(url) ? url : '/GateWay' + url: '/GateWay' + url: '/GateWay' + url; window.globalConfig &&
window.globalConfig.hasGateWay &&
/^\/(cityinterface|CityInterface|Cityinterface|CityServer|PandaInformatization)/.test(
url,
)
) {
return /\/CityInterface\/rest\/services.svc\/GetConfig/.test(url)
? url
? /^\/GateWay/.test(url)
? url
: `/GateWay${url}`
: `/GateWay${url}`
: `/GateWay${url}`;
} }
return url; return url;
} };
const codeMessage = { const codeMessage = {
200: '服务器成功返回请求的数据。', 200: '服务器成功返回请求的数据。',
201: '新建或修改数据成功。', 201: '新建或修改数据成功。',
...@@ -40,7 +52,7 @@ const codeMessage = { ...@@ -40,7 +52,7 @@ const codeMessage = {
504: '网关超时。', 504: '网关超时。',
}; };
let instance = null; const instance = null;
instanceRequest.setErrorHandler(error => { instanceRequest.setErrorHandler(error => {
const { response } = error; const { response } = error;
if (response && response.status) { if (response && response.status) {
......
import * as constants from '../../constants';
import { request } from '@wisdom-utils/utils'; import { request } from '@wisdom-utils/utils';
import * as constants from '../../constants';
const API = { const API = {
GET_INFORMATION: GET_INFORMATION:
'/CityInterface/rest/services/CountyProduct.svc/SCADAOper/GetInformationInfo', '/CityInterface/rest/services/CountyProduct.svc/SCADAOper/GetInformationInfo',
......
import 'whatwg-fetch'; import 'whatwg-fetch';
import './public-path' import './public-path';
import '!file-loader?name=[name].[ext]!./images/favicon.ico'; import '!file-loader?name=[name].[ext]!./images/favicon.ico';
import './global.less'; import './global.less';
import 'animate.css/animate.css'; import 'animate.css/animate.css';
...@@ -8,19 +8,19 @@ import 'file-loader?name=.htaccess!./.htaccess'; // eslint-disable-line import/e ...@@ -8,19 +8,19 @@ import 'file-loader?name=.htaccess!./.htaccess'; // eslint-disable-line import/e
import '@wisdom-utils/utils/lib/helpers/format'; import '@wisdom-utils/utils/lib/helpers/format';
import 'sanitize.css/sanitize.css'; import 'sanitize.css/sanitize.css';
import { event } from '@wisdom-utils/utils'; import { event } from '@wisdom-utils/utils';
import _ from 'lodash'; import { ConfigProvider } from 'antd';
import { ConfigProvider} from 'antd';
import { Storeage } from '@wisdom-utils/utils/lib/helpers'; import { Storeage } from '@wisdom-utils/utils/lib/helpers';
import { history } from '@wisdom-utils/runtime'; import { history } from '@wisdom-utils/runtime';
import { actionCreators } from './containers/App/store'; import { actionCreators } from './containers/App/store';
import { initGlobalConfig } from './initConfig' import { initGlobalConfig } from './initConfig';
import './utils/event'; import './utils/event';
import store from './stores' import store from './stores';
// eslint-disable-next-line no-restricted-globals
const namespace = `__PANDA_STORE__${location.hostname}`; const namespace = `__PANDA_STORE__${location.hostname}`;
window.createStoreage = new Storeage(namespace); window.createStoreage = new Storeage(namespace);
ConfigProvider.config({ ConfigProvider.config({
prefixCls: 'panda-console-base' prefixCls: 'panda-console-base',
}); });
const initLocale = () => { const initLocale = () => {
localStorage.setItem('umi_locale', 'zh-CN'); localStorage.setItem('umi_locale', 'zh-CN');
...@@ -33,10 +33,10 @@ const unlisten = (function() { ...@@ -33,10 +33,10 @@ const unlisten = (function() {
let prePathname = ''; let prePathname = '';
return history.listen(location => { return history.listen(location => {
if ( if (
location.pathname.indexOf('/civbase/user/login') > -1 && location.pathname.indexOf('/civbase/user/login') > -1 &&
location.pathname !== prePathname location.pathname !== prePathname
) { ) {
console.log('init config') console.log('init config');
initGlobalConfig(); initGlobalConfig();
} }
prePathname = location.pathname; prePathname = location.pathname;
...@@ -44,5 +44,5 @@ const unlisten = (function() { ...@@ -44,5 +44,5 @@ const unlisten = (function() {
})(); })();
event.on('event:logout', () => { event.on('event:logout', () => {
store.dispatch(actionCreators.logout()) store.dispatch(actionCreators.logout());
}); });
import React from 'react'; import React from 'react';
import { Redirect, Route } from 'umi'; import { Redirect, Route } from '@wisdom-utils/runtime';
import Authorized from './Authorized'; import Authorized from './Authorized';
......
...@@ -11,12 +11,8 @@ import { ...@@ -11,12 +11,8 @@ import {
Upload, Upload,
} from 'antd'; } from 'antd';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import Cookies from 'js-cookie';
import {
FormattedMessage,
useIntl,
} from '@/locales/localeExports';
import { request } from '@wisdom-utils/utils'; import { request } from '@wisdom-utils/utils';
import { FormattedMessage, useIntl } from '@/locales/localeExports';
import { appService } from '../../api'; import { appService } from '../../api';
// eslint-disable-next-line import/named // eslint-disable-next-line import/named
......
...@@ -2,15 +2,15 @@ import React, { useState, useRef } from 'react'; ...@@ -2,15 +2,15 @@ import React, { useState, useRef } from 'react';
import { message } from 'antd'; import { message } from 'antd';
import _, { words } from 'lodash'; import _, { words } from 'lodash';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { useIntl } from '@/locales/localeExports';
import Icon from '@ant-design/icons'; import Icon from '@ant-design/icons';
import classNames from 'classnames';
import { useHistory } from '@wisdom-utils/runtime';
import { useIntl } from '@/locales/localeExports';
import { actionCreators } from '../../containers/App/store'; import { actionCreators } from '../../containers/App/store';
import HeaderSearch from '../HeaderSearch'; import HeaderSearch from '../HeaderSearch';
import Avatar from './AvatarDropdown'; import Avatar from './AvatarDropdown';
import styles from './index.less'; import styles from './index.less';
import NoticeIconView from './NoticeIconView'; import NoticeIconView from './NoticeIconView';
import classNames from 'classnames';
import { useHistory } from '@wisdom-utils/runtime';
/* eslint-disable */ /* eslint-disable */
const orderSvg = () => ( const orderSvg = () => (
<svg <svg
...@@ -223,8 +223,8 @@ const GlobalHeaderRight = props => { ...@@ -223,8 +223,8 @@ const GlobalHeaderRight = props => {
</div> </div>
{ {
// 云平台去掉常用菜单 // 云平台去掉常用菜单
props.global && props.global.userInfo && props.global.userInfo.Groups && props.global.userInfo.Groups.length props.global && props.global.userInfo && props.global.userInfo.Groups && props.global.userInfo.Groups.length
? null ? null
: ( : (
<div className={classNames(styles.item)} onClick={handlerFavitor} ref={favitorRef}> <div className={classNames(styles.item)} onClick={handlerFavitor} ref={favitorRef}>
<FavitorIcon></FavitorIcon> <FavitorIcon></FavitorIcon>
......
...@@ -3,10 +3,8 @@ import React, { useState } from 'react'; ...@@ -3,10 +3,8 @@ import React, { useState } from 'react';
import { message } from 'antd'; import { message } from 'antd';
import _ from 'lodash'; import _ from 'lodash';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import { useIntl } from '@/locales/localeExports';
import Icon from '@ant-design/icons'; import Icon from '@ant-design/icons';
import { useIntl } from '@/locales/localeExports';
import { actionCreators } from '../../containers/App/store'; import { actionCreators } from '../../containers/App/store';
import HeaderSearch from '../HeaderSearch'; import HeaderSearch from '../HeaderSearch';
......
...@@ -7,7 +7,7 @@ import React, { ...@@ -7,7 +7,7 @@ import React, {
import classNames from 'classnames'; import classNames from 'classnames';
import PinyinMatch from 'pinyin-match'; import PinyinMatch from 'pinyin-match';
import { useHistory } from 'react-router-dom'; import { useHistory } from '@wisdom-utils/runtime';
import Icon, { RightCircleOutlined } from '@ant-design/icons'; import Icon, { RightCircleOutlined } from '@ant-design/icons';
...@@ -105,7 +105,7 @@ const SearchPanel = props => { ...@@ -105,7 +105,7 @@ const SearchPanel = props => {
} }
const goFeature = (path, rect, value) => { const goFeature = (path, rect, value) => {
// eslint-disable-next-line no-param-reassign // eslint-disable-next-line no-param-reassign
value = value || props.value; value = value || props.value;
const findKeywordIndex = const findKeywordIndex =
recentKeywords.length > 0 recentKeywords.length > 0
...@@ -126,10 +126,10 @@ const SearchPanel = props => { ...@@ -126,10 +126,10 @@ const SearchPanel = props => {
const routes = props.menu[findIndex]; const routes = props.menu[findIndex];
const selectedIndex = routes.routes.findIndex(item => item.name === rect.subSystem); const selectedIndex = routes.routes.findIndex(item => item.name === rect.subSystem);
let currentPath = void 0; let currentPath = void 0;
// props.updateOpenKeys && props.updateOpenKeys([parents.key]); // props.updateOpenKeys && props.updateOpenKeys([parents.key]);
if (rect && rect.routes && rect.routes.length > 0) { if (rect && rect.routes && rect.routes.length > 0) {
currentPath = rect.routes[0].path; currentPath = rect.routes[0].path;
} else { } else {
currentPath = path; currentPath = path;
......
...@@ -10,6 +10,7 @@ import useMergeValue from 'use-merge-value'; ...@@ -10,6 +10,7 @@ import useMergeValue from 'use-merge-value';
import { SearchOutlined } from '@ant-design/icons'; import { SearchOutlined } from '@ant-design/icons';
import styles from './index.less'; import styles from './index.less';
// eslint-disable-next-line import/no-unresolved
import SearchPanel from './Panel'; import SearchPanel from './Panel';
import ExtendPanel from './ExtendPanel'; import ExtendPanel from './ExtendPanel';
...@@ -208,7 +209,7 @@ const HeaderSearch = props => { ...@@ -208,7 +209,7 @@ const HeaderSearch = props => {
console={willMenu} console={willMenu}
/> />
} }
</div> </div>
); );
}; };
......
...@@ -3,41 +3,47 @@ import { Tooltip } from 'antd'; ...@@ -3,41 +3,47 @@ import { Tooltip } from 'antd';
import { CheckOutlined } from '@ant-design/icons'; import { CheckOutlined } from '@ant-design/icons';
import classNames from 'classnames'; import classNames from 'classnames';
const BlockCheckbox = ({ value, configType, onChange, list = [], prefixCls }) => { const BlockCheckbox = ({
const baseClassName = `${prefixCls}-drawer-block-checkbox`; value,
const [dom, setDom] = useState([]); configType,
useEffect(() => { onChange,
const domList = (list || []).map((item) => ( list = [],
<Tooltip title={item.title} key={item.key}> prefixCls,
<div }) => {
className={classNames( const baseClassName = `${prefixCls}-drawer-block-checkbox`;
`${baseClassName}-item`, const [dom, setDom] = useState([]);
`${baseClassName}-item-${item.key}`, useEffect(() => {
`${baseClassName}-${configType}-item`, const domList = (list || []).map(item => (
)} <Tooltip title={item.title} key={item.key}>
onClick={() => onChange(item.key)}
>
<CheckOutlined
className={`${baseClassName}-selectIcon`}
style={{
display: value === item.key ? 'block' : 'none',
}}
/>
</div>
</Tooltip>
));
setDom(domList);
}, [value, list.length]);
return (
<div <div
className={baseClassName} className={classNames(
style={{ `${baseClassName}-item`,
minHeight: 42, `${baseClassName}-item-${item.key}`,
}} `${baseClassName}-${configType}-item`,
)}
onClick={() => onChange(item.key)}
> >
{dom} <CheckOutlined
className={`${baseClassName}-selectIcon`}
style={{
display: value === item.key ? 'block' : 'none',
}}
/>
</div> </div>
); </Tooltip>
));
setDom(domList);
}, [value, list.length, list, baseClassName, configType, onChange]);
return (
<div
className={baseClassName}
style={{
minHeight: 42,
}}
>
{dom}
</div>
);
}; };
export default BlockCheckbox; export default BlockCheckbox;
\ No newline at end of file
import './index.less'; import './index.less';
import {
CloseOutlined,
SettingOutlined,
} from '@ant-design/icons';
import { isBrowser } from '@ant-design/pro-utils'; import { isBrowser } from '@ant-design/pro-utils';
import { useUrlSearchParams } from '@umijs/use-params'; import { useUrlSearchParams } from '@umijs/use-params';
import { Button, Divider, Drawer, List, Switch, message, Alert } from 'antd'; import { Divider, Drawer, message } from 'antd';
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import useMergedState from 'rc-util/lib/hooks/useMergedState'; import useMergedState from 'rc-util/lib/hooks/useMergedState';
import merge from 'lodash.merge'; import merge from 'lodash.merge';
...@@ -21,7 +17,7 @@ import LayoutSetting, { renderLayoutSettingItem } from './LayoutChange'; ...@@ -21,7 +17,7 @@ import LayoutSetting, { renderLayoutSettingItem } from './LayoutChange';
import RegionalSetting from './RegionalChange'; import RegionalSetting from './RegionalChange';
const Body = ({ children, prefixCls, title }) => ( const Body = ({ children, prefixCls, title }) => (
<div style={{ marginBottom: 24 }}> <div style={{ marginBottom: 24 }}>
<h3 className={`${prefixCls}-drawer-title`}>{title}</h3> <h3 className={`${prefixCls}-drawer-title`}>{title}</h3>
{children} {children}
</div> </div>
); );
......
import { isBrowser } from '@ant-design/pro-utils'; import { isBrowser } from '@ant-design/pro-utils';
import zhLocal from './zh-CN'; import zhLocal from './zh-CN';
const locales = { const locales = {
'zh-CN': zhLocal 'zh-CN': zhLocal,
}; };
const getLanguage = () => { const getLanguage = () => {
...@@ -18,4 +18,4 @@ export default ()=> { ...@@ -18,4 +18,4 @@ export default ()=> {
return locales[gLocale]; return locales[gLocale];
} }
return locales['zh-CN']; return locales['zh-CN'];
}; };
\ No newline at end of file
...@@ -2,14 +2,10 @@ import React, { Suspense } from 'react'; ...@@ -2,14 +2,10 @@ import React, { Suspense } from 'react';
import { Helmet } from 'react-helmet'; import { Helmet } from 'react-helmet';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
// import { renderRoutes } from 'react-router-config'; import { Router, Switch } from '@wisdom-utils/runtime';
import { Router, Switch, Route, Redirect } from '@wisdom-utils/runtime';
import { renderRoutes } from '../../utils/routes'; import { renderRoutes } from '../../utils/routes';
// import BootPage from '../../pages/bootpage';
import { dyRoutes } from '../../routes/config'; import { dyRoutes } from '../../routes/config';
// import routeContext from '@ant-design/pro-layout/lib/RouteContext';
// import { Route } from 'react-router-dom';
const pkg = require('../../../package.json'); const pkg = require('../../../package.json');
const config = require('../../../config/config'); const config = require('../../../config/config');
......
import Cookies from 'js-cookie';
import { appService } from './api'; import { appService } from './api';
import { initMicroApps } from './micro'; import { initMicroApps } from './micro';
import { params, Storeage } from '@wisdom-utils/utils/lib/helpers'; import { params, Storeage } from '@wisdom-utils/utils/lib/helpers';
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';
import store from './stores'; import store from './stores';
import Login from './pages/user/login/login'; import Login from './pages/user/login/login';
// eslint-disable-next-line no-restricted-globals
const namespace = `__PANDA_STORE__${location.hostname}`; const namespace = `__PANDA_STORE__${location.hostname}`;
window.createStoreage = new Storeage(namespace); window.createStoreage = new Storeage(namespace);
export const initGlobalConfig = () => { export const initGlobalConfig = () => {
...@@ -28,7 +29,7 @@ export const initGlobalConfig = () => { ...@@ -28,7 +29,7 @@ export const initGlobalConfig = () => {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
createStoreage.remove(namespace); createStoreage.remove(namespace);
} }
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
if (!createStoreage.get('globalConfig')) { if (!createStoreage.get('globalConfig')) {
window.createStoreage = new Storeage(namespace); window.createStoreage = new Storeage(namespace);
...@@ -36,7 +37,7 @@ export const initGlobalConfig = () => { ...@@ -36,7 +37,7 @@ export const initGlobalConfig = () => {
if (!getToken()) { if (!getToken()) {
localStorage.removeItem('loginSite'); localStorage.removeItem('loginSite');
} }
if (window.globalConfig.token !== null && Object.keys(window.globalConfig).length > 0) { if (window.globalConfig.token !== null && Object.keys(window.globalConfig).length > 0) {
store.dispatch(actionCreators.getConfig(window.globalConfig)); store.dispatch(actionCreators.getConfig(window.globalConfig));
// render({ appContent: '', loading: true }); // render({ appContent: '', loading: true });
...@@ -83,21 +84,21 @@ export const initGlobalConfig = () => { ...@@ -83,21 +84,21 @@ export const initGlobalConfig = () => {
store.dispatch( store.dispatch(
actionCreators.getConfig( actionCreators.getConfig(
Object.assign({}, data, { Object.assign({}, data, {
token: '', token: '',
access_token: '', access_token: '',
userInfo: null userInfo: null
}, gateWayConfig), }, gateWayConfig),
), ),
); );
//Cookies.set('city', params.getParams('client')) //Cookies.set('city', params.getParams('client'))
if (data.loginTemplate === '新春 - 智联.html') { if (data.loginTemplate === '新春 - 智联.html') {
updateTheme('#ff9600'); updateTheme('#ff9600');
} }
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
if (getToken()) { if (getToken()) {
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new Login( new Login(
{ {
...@@ -119,7 +120,7 @@ export const initGlobalConfig = () => { ...@@ -119,7 +120,7 @@ export const initGlobalConfig = () => {
true, true,
); );
} }
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
} }
return res; return res;
...@@ -139,4 +140,4 @@ export const initGlobalConfig = () => { ...@@ -139,4 +140,4 @@ export const initGlobalConfig = () => {
}); });
} }
}; };
\ No newline at end of file
...@@ -6,14 +6,7 @@ import React, { ...@@ -6,14 +6,7 @@ import React, {
useState, useState,
} from 'react'; } from 'react';
import { import { Anchor, Button, Popover, Radio, Result, Spin } from 'antd';
Anchor,
Button,
Popover,
Radio,
Result,
Spin,
} from 'antd';
import { store } from '@wisdom-utils/utils'; import { store } from '@wisdom-utils/utils';
import classNames from 'classnames'; import classNames from 'classnames';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
...@@ -21,14 +14,6 @@ import { dom } from '@wisdom-utils/utils/lib/helpers'; ...@@ -21,14 +14,6 @@ import { dom } from '@wisdom-utils/utils/lib/helpers';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { useMountedState } from 'react-use'; import { useMountedState } from 'react-use';
import RightContent from '@/components/GlobalHeader/RightContent';
import { Panel } from '@/components/SliderPanel';
import { actionCreators } from '@/containers/App/store';
import Authorized from '@/utils/Authorized';
import {
findPathByLeafId,
getBaseName,
} from '@/utils/utils';
import { import {
LeftOutlined, LeftOutlined,
LoadingOutlined, LoadingOutlined,
...@@ -36,9 +21,12 @@ import { ...@@ -36,9 +21,12 @@ import {
} from '@ant-design/icons'; } from '@ant-design/icons';
import ProLayout, { getPageTitle } from '@ant-design/pro-layout'; import ProLayout, { getPageTitle } from '@ant-design/pro-layout';
import { getMatchMenu } from '@umijs/route-utils'; import { getMatchMenu } from '@umijs/route-utils';
// import { renderRoutes } from 'react-router-config';
import { useHistory } from '@wisdom-utils/runtime'; import { useHistory } from '@wisdom-utils/runtime';
import RightContent from '@/components/GlobalHeader/RightContent';
import { Panel } from '@/components/SliderPanel';
import { actionCreators } from '@/containers/App/store';
import Authorized from '@/utils/Authorized';
import { findPathByLeafId, getBaseName } from '@/utils/utils';
import pkg from '../../package.json'; import pkg from '../../package.json';
import SecurityLayout from './SecurityLayout'; import SecurityLayout from './SecurityLayout';
import Site from './Site'; import Site from './Site';
...@@ -463,7 +451,7 @@ const BasicLayout = props => { ...@@ -463,7 +451,7 @@ const BasicLayout = props => {
useEffect(() => { useEffect(() => {
siteAction.setGlobalConfig(props.global); siteAction.setGlobalConfig(props.global);
if (!Cookies.get('token')) { if (!Cookies.get('token')) {
let client = props.global.get('client'); let client = props.global.get('client');
client = _.isNull(client) || _.isUndefined(client) || client === 'undefined' ? client: 'city'; client = _.isNull(client) || _.isUndefined(client) || client === 'undefined' ? client: 'city';
history.replace(`/user/login?client=${client}`); history.replace(`/user/login?client=${client}`);
......
import React, { import React, {
useCallback,
useEffect, useEffect,
useRef, useRef,
useState, useState,
...@@ -8,10 +7,8 @@ import React, { ...@@ -8,10 +7,8 @@ import React, {
import { import {
Anchor, Anchor,
Button,
Popover, Popover,
Radio, Radio,
Result,
Spin, Spin,
Tabs, Tabs,
Divider, Divider,
...@@ -19,10 +16,8 @@ import { ...@@ -19,10 +16,8 @@ import {
Menu, Menu,
Tooltip, Tooltip,
ConfigProvider, ConfigProvider,
Skeleton Skeleton,
} from 'antd'; } from 'antd';
// import { RouteWithSubRoutes, renderRoutes } from '../utils/routes';
// import { renderRoutes } from 'react-router-config';
import { PageContainer } from '@ant-design/pro-layout'; import { PageContainer } from '@ant-design/pro-layout';
import Icon, { import Icon, {
// LeftOutlined, // LeftOutlined,
...@@ -35,19 +30,15 @@ import classNames from 'classnames'; ...@@ -35,19 +30,15 @@ import classNames from 'classnames';
import { ReactSVG } from 'react-svg'; import { ReactSVG } from 'react-svg';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { useHistory } from '@wisdom-utils/runtime'; import { useHistory } from '@wisdom-utils/runtime';
import KeepAlive from 'react-activation';
import AMapLoader from '@amap/amap-jsapi-loader';
import RightContent from '@/components/GlobalHeader/ExtendRightContent'; import RightContent from '@/components/GlobalHeader/ExtendRightContent';
import Panel from '@/components/SliderPanel/MinPanel'; import Panel from '@/components/SliderPanel/MinPanel';
import { actionCreators } from '@/containers/App/store'; import { actionCreators } from '@/containers/App/store';
import CreateBaseMap from '@/pages/map'; import { ArcgisMap, AMap, CesiumMap } from '../pages/map';
import AMap from '@/pages/amap'; import { WEB_GIS_TYPE } from '../constants';
import CesiumMap from '@/pages/cesiumMap';
import KeepAlive from 'react-activation'
import AMapLoader from '@amap/amap-jsapi-loader';
import { WEB_GIS_TYPE } from '../constants'
// import Authorized from '@/utils/Authorized';
import { findPathByLeafId, getBaseName } from '@/utils/utils'; import { findPathByLeafId, getBaseName } from '@/utils/utils';
// import { renderRoutes } from 'react-router-config';
import { renderRoutes, getParams } from '../utils/routes'; import { renderRoutes, getParams } from '../utils/routes';
import SecurityLayout from './SecurityLayout'; import SecurityLayout from './SecurityLayout';
import Site from './Site'; import Site from './Site';
...@@ -273,7 +264,7 @@ const BasicLayout = props => { ...@@ -273,7 +264,7 @@ const BasicLayout = props => {
// 处理隐藏菜单 // 处理隐藏菜单
useEffect(() => { useEffect(() => {
const newRoutes = props.route.routes.filter(item => !item.hideInMenu)[props.currentMenuIndex] || {}; const newRoutes = props.route.routes.filter(item => !item.hideInMenu)[props.currentMenuIndex] || {};
if(!_.isEqual(currentRoutes, newRoutes)) { if(!_.isEqual(currentRoutes, newRoutes)) {
setCurrentRoutes({}) setCurrentRoutes({})
...@@ -283,13 +274,13 @@ const BasicLayout = props => { ...@@ -283,13 +274,13 @@ const BasicLayout = props => {
}, [props.route, props.currentMenuIndex]); }, [props.route, props.currentMenuIndex]);
// let currentRoutes = props.route.routes.filter(item => !item.hideInMenu)[props.currentMenuIndex]; // let currentRoutes = props.route.routes.filter(item => !item.hideInMenu)[props.currentMenuIndex];
//props.currentMenuIndex //props.currentMenuIndex
useEffect(() => { useEffect(() => {
const initSelectRoute = findPathByLeafId( const initSelectRoute = findPathByLeafId(
`${props.location && props.location.pathname || ''}`, `${props.location && props.location.pathname || ''}`,
[currentRoutes], [currentRoutes],
...@@ -316,7 +307,7 @@ const BasicLayout = props => { ...@@ -316,7 +307,7 @@ const BasicLayout = props => {
currentChildrenRoute && currentChildrenRoute.routes ? setChildrenRoutes(currentChildrenRoute.routes) : setChildrenRoutes([currentChildrenRoute]); currentChildrenRoute && currentChildrenRoute.routes ? setChildrenRoutes(currentChildrenRoute.routes) : setChildrenRoutes([currentChildrenRoute]);
} else { } else {
let url = props.global && props.global.hasOwnProperty('get') && props.global.get('homepage') let url = props.global && props.global.hasOwnProperty('get') && props.global.get('homepage')
? _.isString(props.global.get('homepage')) ? _.isString(props.global.get('homepage'))
? props.global.get('homepage') ? props.global.get('homepage')
: props.global.get('homepage.url') : props.global.get('homepage.url')
...@@ -506,7 +497,7 @@ const BasicLayout = props => { ...@@ -506,7 +497,7 @@ const BasicLayout = props => {
} }
const handlerSelectMenu = ({ item, key, keyPath, domEvent }) => { const handlerSelectMenu = ({ item, key, keyPath, domEvent }) => {
setSelectedKeys([key]); setSelectedKeys([key]);
window.history.pushState(null, '', `/civbase${key}`); window.history.pushState(null, '', `/civbase${key}`);
} }
...@@ -630,11 +621,11 @@ const BasicLayout = props => { ...@@ -630,11 +621,11 @@ const BasicLayout = props => {
</ul> </ul>
</React.Fragment> </React.Fragment>
} }
</div> </div>
} }
</div> </div>
<div className="ant-pro-sider-links" > <div className="ant-pro-sider-links" >
<ul className="ant-menu ant-menu-root ant-menu-inline ant-menu-dark ant-pro-sider-link-menu" role="menu" tabIndex="0" > <ul className="ant-menu ant-menu-root ant-menu-inline ant-menu-dark ant-pro-sider-link-menu" role="menu" tabIndex="0" >
...@@ -730,14 +721,14 @@ const BasicLayout = props => { ...@@ -730,14 +721,14 @@ const BasicLayout = props => {
} }
{ {
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : window.location.pathname.startsWith('/civbase/civ_webgis') ? ((mapMode === 'AMap' ? <AMap/>: <CreateBaseMap options={{ type: 'ArcgisMap' }}/>)) : null window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : window.location.pathname.startsWith('/civbase/civ_webgis') ? ((mapMode === 'AMap' ? <AMap/>: <ArcgisMap options={{ type: 'ArcgisMap' }}/>)) : null
} }
<div id="micro-container" className="subapp-container"> <div id="micro-container" className="subapp-container">
{props.children} {props.children}
</div> </div>
{props.children} {props.children}
...@@ -754,8 +745,8 @@ const BasicLayout = props => { ...@@ -754,8 +745,8 @@ const BasicLayout = props => {
} }
{ {
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : window.location.pathname.startsWith('/civbase/civ_webgis') ? ((mapMode === 'AMap' ? <AMap/>: <CreateBaseMap options={{ type: 'ArcgisMap' }}/>)) : null window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : window.location.pathname.startsWith('/civbase/civ_webgis') ? ((mapMode === 'AMap' ? <AMap/>: <ArcgisMap options={{ type: 'ArcgisMap' }}/>)) : null
} }
<div id="micro-container" className="subapp-container"> <div id="micro-container" className="subapp-container">
{/*<CreateBaseMap/>*/} {/*<CreateBaseMap/>*/}
{props.children} {props.children}
......
import React from 'react'; import React from 'react';
import { import { Anchor, message } from 'antd';
Anchor,
message,
} from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import { encode } from 'js-base64'; import { encode } from 'js-base64';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
...@@ -16,7 +13,6 @@ import Login from '../pages/user/login/login'; ...@@ -16,7 +13,6 @@ import Login from '../pages/user/login/login';
import styles from './UserLayout.less'; import styles from './UserLayout.less';
import { initMicroApps } from '@/micro'; import { initMicroApps } from '@/micro';
const { Link } = Anchor; const { Link } = Anchor;
const ERR_OK = '0000'; const ERR_OK = '0000';
...@@ -211,7 +207,7 @@ class Site { ...@@ -211,7 +207,7 @@ class Site {
stations, stations,
weathers: { weathers: {
icon: `https://panda-water.cn/web4/assets/images/weather2/${imgPath}`, icon: `https://panda-water.cn/web4/assets/images/weather2/${imgPath}`,
text: text + " " + firtValue.temperatureFirst, text: `${text} ${firtValue.temperatureFirst}`,
}, },
siteCityList: self.siteCityList, siteCityList: self.siteCityList,
citySelector: self.citySelector, citySelector: self.citySelector,
...@@ -321,7 +317,6 @@ class Site { ...@@ -321,7 +317,6 @@ class Site {
} }
writeCookie(token, site) { writeCookie(token, site) {
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();
...@@ -342,7 +337,6 @@ class Site { ...@@ -342,7 +337,6 @@ class Site {
const self = this; const self = this;
self.props.updateCurrentIndex && self.props.updateCurrentIndex(-1); self.props.updateCurrentIndex && self.props.updateCurrentIndex(-1);
const login = new Login(this.props, () => { const login = new Login(this.props, () => {
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);
...@@ -351,21 +345,23 @@ class Site { ...@@ -351,21 +345,23 @@ class Site {
// 切换站点后,重置掉三级菜单 // 切换站点后,重置掉三级菜单
const homeType = self.globalConfig.homeType || 'civweb4'; const homeType = self.globalConfig.homeType || 'civweb4';
const homePath = const homePath = self.globalConfig.homepage
self.globalConfig.homepage ? self.globalConfig.homepage.startsWith(homeType)
? self.globalConfig.homepage.startsWith(homeType)
? self.globalConfig.homepage ? self.globalConfig.homepage
: `/${homeType}/${self.globalConfig.homepage}` : `/${homeType}/${self.globalConfig.homepage}`
: `/${homeType}`; : `/${homeType}`;
window.share && window.share.event && window.share.event.emit('event:favitor', { window.share &&
name: "首页", window.share.event &&
path: homePath, window.share.event.emit('event:favitor', {
icon: null, name: '首页',
}); path: homePath,
icon: null,
});
// 重新加载订阅消息铃铛 // 重新加载订阅消息铃铛
window.share && window.share.event && window.share.event.emit('reloadNotice'); window.share &&
window.share.event &&
window.share.event.emit('reloadNotice');
// window.history.replaceState( // window.history.replaceState(
// '', // '',
...@@ -382,7 +378,12 @@ class Site { ...@@ -382,7 +378,12 @@ class Site {
self.props && self.props &&
self.props.updateComplexConfig && self.props.updateComplexConfig &&
self.props.updateComplexConfig({}); self.props.updateComplexConfig({});
self.props.history && self.props.history.push(self.globalConfig.homepage ? `/${self.globalConfig.homepage}` : `/?client=${self.globalConfig.client}`); self.props.history &&
self.props.history.push(
self.globalConfig.homepage
? `/${self.globalConfig.homepage}`
: `/?client=${self.globalConfig.client}`,
);
// window.location.reload(); // window.location.reload();
window.share.event.emit('triggerMicro', this.props.global); window.share.event.emit('triggerMicro', this.props.global);
}); });
......
...@@ -8,13 +8,13 @@ import { ...@@ -8,13 +8,13 @@ import {
setDefaultMountApp, setDefaultMountApp,
start, start,
} from 'qiankun'; } from 'qiankun';
import { event, store as microStore } from '@wisdom-utils/utils' import { event, store as microStore } from '@wisdom-utils/utils';
import micorConfig, { genActiveRule } from '../config/micor'; import micorConfig, { genActiveRule } from '../config/micor';
import { actionCreators } from './containers/App/store'; import { actionCreators } from './containers/App/store';
import loader from './render'; import loader from './render';
import store from './stores'; import store from './stores';
import actions from './actions'; import actions from './actions';
import { processComponentName } from './utils/utils' import { processComponentName } from './utils/utils';
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const Logger = logger('micro'); const Logger = logger('micro');
......
const mapSetting = {
zooms: [14],
mapSettings: {
mapStyle: 'amap://styles/74fae00a851749793870b658f9f22d55',
pipeStyle: 'image',
viewMode: '2D',
},
propertysName: ['所在位置', '开关状态', '编号', '口径'],
showSearchFileds: ['开关状态', '编号', '口径'],
showFileds: ['编号'],
contextMenu: true,
theme: 'dark',
radius: 120,
isEdit: false,
};
export default mapSetting;
\ No newline at end of file
import {PdRender, parseScheme} from '@wisdom-cesium/cesium'
import { useRef , useEffect } from 'react'
import { connect } from 'react-redux'
import { actionCreators } from '@/containers/App/store';
const cesiumMap = props => {
const ref = useRef(null)
const storeRef = useRef(null)
useEffect(() => {
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)
const pdView = new PdRender({
el: ref.current,
widgets,
...schemeData
})
storeRef.current = pdView
props.updatePdCesiumView(pdView)
}, [props.globalConfig?.mapConfig3d ?? {}])
return (<div style={{
inset: 0,
position : "absolute"
}} ref = {ref}></div>)
}
const mapStateToProps = state => ({
globalConfig : state.getIn(['global','globalConfig'])
})
const mapDispatchToProps = dispatch => ({
updatePdCesiumView(pdView) {
dispatch(actionCreators.updatePdCesiumView(pdView))
}
})
export default connect(mapStateToProps, mapDispatchToProps)(cesiumMap)
...@@ -6,9 +6,9 @@ import classnames from 'classnames'; ...@@ -6,9 +6,9 @@ import classnames from 'classnames';
import * as _ from 'lodash'; import * as _ from 'lodash';
import PinyinMatch from 'pinyin-match'; import PinyinMatch from 'pinyin-match';
import PandaEmpty from '@wisdom-components/empty'; import PandaEmpty from '@wisdom-components/empty';
import { useHistory } from '@wisdom-utils/runtime';
import { actionCreators } from '@/containers/App/store'; import { actionCreators } from '@/containers/App/store';
import { appService } from '@/api'; import { appService } from '@/api';
import { useHistory } from '@wisdom-utils/runtime';
import { savePagePartInfo } from '@/api/service/base'; import { savePagePartInfo } from '@/api/service/base';
import styles from './index.less'; import styles from './index.less';
......
const mapSetting = {
zooms: [14],
mapSettings: {
mapStyle: 'amap://styles/74fae00a851749793870b658f9f22d55',
pipeStyle: 'image',
viewMode: '2D',
},
propertysName: ['所在位置', '开关状态', '编号', '口径'],
showSearchFileds: ['开关状态', '编号', '口径'],
showFileds: ['编号'],
contextMenu: true,
theme: 'dark',
radius: 120,
isEdit: false,
};
export default mapSetting;
import React, { useEffect, useState } from 'react'; import React from 'react';
import { AMapScene } from '@wisdom-map/Amap'; import { AMapScene } from '@wisdom-map/Amap';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { store } from '@wisdom-utils/utils'; import { store } from '@wisdom-utils/utils';
const AMap = props => {
const AMap = (props) => {
const getMap = (obj, current) => { const getMap = (obj, current) => {
store.set('amapView', { store.set('amapView', {
Amap:obj, Amap: obj,
map:current map: current,
}) });
props.updageAMapView({ props.updageAMapView({
Amap:obj, Amap: obj,
map:current map: current,
}); });
}; };
const mapOptions = { const mapOptions = {
config:props.global.mapsettings, config: props.global.mapsettings,
theme:'amap://styles/74fae00a851749793870b658f9f22d55' theme: 'amap://styles/74fae00a851749793870b658f9f22d55',
} };
return ( return (
<div style={{ <div
style={{
position: 'absolute', position: 'absolute',
top: 0, top: 0,
right: 0, right: 0,
bottom: 0, bottom: 0,
left: 0, left: 0,
}}> }}
<AMapScene >
{...mapOptions} <AMapScene {...mapOptions} getMapInfo={getMap} />
getMapInfo={getMap}
/>
</div> </div>
); );
}; };
const mapStateToProps = state => ({ const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']) global: state.getIn(['global', 'globalConfig']),
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
updageAMapView(amapView) { updageAMapView(amapView) {
// eslint-disable-next-line no-undef
dispatch(actionCreators.updageAMapView(amapView)); dispatch(actionCreators.updageAMapView(amapView));
}, },
}); });
...@@ -50,7 +48,3 @@ export default connect( ...@@ -50,7 +48,3 @@ export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps, mapDispatchToProps,
)(AMap); )(AMap);
import React from 'react';
import _ from 'lodash';
import { connect } from 'react-redux';
import AMapLoader from '@amap/amap-jsapi-loader';
import { store } from '@wisdom-utils/utils';
import { actionCreators } from '@/containers/App/store';
import MapComponent from '@/components/mapView';
class CreateMap extends React.Component {
constructor(props) {
super(props);
this.mapManganerRef = React.createRef();
[
'_AMap_vectorlayer',
'_AMap_AMap.MouseTool',
'_AMap_AMap.DistrictSearch',
'_AMap_AMap.Autocomplete',
'_AMap_sync',
'_AMap_AMap.PlaceSearch',
'_AMap_wgl',
'_AMap_overlay',
'_AMap_mouse',
].forEach(item => {
localStorage.removeItem(item);
});
AMapLoader.reset();
}
getView = view => {
store.set('view', view);
this.props.updageMapView(view);
};
render() {
if (_.isNull(this.props.global.mapsettings.areasettings)) {
return null;
}
const props = {
loading: true,
config: this.props.global.mapsettings,
widgets: this.props.global.uiwidgets,
};
return (
<>
<MapComponent {...props} getMapInfo={this.getView} />
</>
);
}
}
const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']),
});
const mapDispatchToProps = dispatch => ({
updageMapView(mapView) {
dispatch(actionCreators.updageMapView(mapView));
},
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(CreateMap);
import { PdRender, parseScheme } from '@wisdom-cesium/cesium';
import { useRef, useEffect } from 'react';
import { connect } from 'react-redux';
import { actionCreators } from '@/containers/App/store';
const cesiumMap = props => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const ref = useRef(null);
// eslint-disable-next-line react-hooks/rules-of-hooks
const storeRef = useRef(null);
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
const mapConfig3d = props.globalConfig?.mapConfig3d;
if (
!(
props.globalConfig.mapsettings?.areasettings &&
// eslint-disable-next-line no-undef
globalConfig.mapsettings?.basemaps?.length > 0
)
)
return;
if (storeRef.current) return;
const { widgets } = mapConfig3d;
const schemes = parseScheme.parseSchemes(mapConfig3d);
const schemeData = parseScheme.parseDatas(schemes);
const pdView = new PdRender({
el: ref.current,
widgets,
...schemeData,
});
storeRef.current = pdView;
props.updatePdCesiumView(pdView);
}, [props]);
return (
// eslint-disable-next-line react/react-in-jsx-scope
<div
style={{
inset: 0,
position: 'absolute',
}}
ref={ref}
/>
);
};
const mapStateToProps = state => ({
globalConfig: state.getIn(['global', 'globalConfig']),
});
const mapDispatchToProps = dispatch => ({
updatePdCesiumView(pdView) {
dispatch(actionCreators.updatePdCesiumView(pdView));
},
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(cesiumMap);
import React from 'react'; import ArcgisMap from './arcgis';
import _ from 'lodash' import AMap from './amap';
import { connect } from 'react-redux'; import CesiumMap from './cesiumMap';
import { actionCreators } from '@/containers/App/store'; export { ArcgisMap, AMap, CesiumMap };
import MapComponent from '@/components/mapView';
import AMapLoader from '@amap/amap-jsapi-loader';
import { store } from '@wisdom-utils/utils';
class CreateMap extends React.Component {
constructor(props) {
super(props);
this.mapManganerRef = React.createRef();
['_AMap_vectorlayer', '_AMap_AMap.MouseTool', '_AMap_AMap.DistrictSearch', '_AMap_AMap.Autocomplete', '_AMap_sync', '_AMap_AMap.PlaceSearch', '_AMap_wgl', '_AMap_overlay', '_AMap_mouse'].forEach(item => {
localStorage.removeItem(item)
});
AMapLoader.reset();
}
getView = view => {
store.set('view', view);
this.props.updageMapView(view);
};
render() {
if(_.isNull(this.props.global.mapsettings.areasettings)) {
return null;
}
const props = {
loading: true,
config: this.props.global.mapsettings,
widgets: this.props.global.uiwidgets,
}
return (
<>
<MapComponent {...props}
getMapInfo={this.getView}
/>
</>
);
}
}
const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig'])
});
const mapDispatchToProps = dispatch => ({
updageMapView(mapView) {
dispatch(actionCreators.updageMapView(mapView));
},
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(CreateMap);
import 'kit_logger'; import 'kit_logger';
import { params } from 'kit_utils'; import { params } from '@wisdom-utils/utils/lib/helpers';
import { message } from 'antd'; import { message } from 'antd';
import { decode, encode } from 'js-base64'; import { decode, encode } from 'js-base64';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
...@@ -14,17 +14,26 @@ import { ...@@ -14,17 +14,26 @@ import {
WX_REDIRECT_URI, WX_REDIRECT_URI,
} from '@/constants'; } from '@/constants';
import store from '@/stores'; import store from '@/stores';
import { DEFAULT_MQTT_PATH, DEFAULT_TCP_IP, DEFAULT_TCP_PORT, DEFAULT_PARSE_LEVEL } from '@/components/Notifier/constants'; import {
DEFAULT_MQTT_PATH,
DEFAULT_TCP_IP,
DEFAULT_TCP_PORT,
DEFAULT_PARSE_LEVEL,
} from '@/components/Notifier/constants';
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const Logger = logger('login'); const Logger = logger('login');
const getGlobalConfig = () => store.getState().toJS().global?.globalConfig ?? {}; const getGlobalConfig = () =>
store.getState().toJS().global?.globalConfig ?? {};
class Login { class Login {
constructor(props, callback, isInit) { constructor(props, callback, isInit) {
this.events = window.share.event; this.events = window.share.event;
this.globalConfig = props.global; this.globalConfig = props.global;
// this.updateConfig = props.updateConfig; // this.updateConfig = props.updateConfig;
this.updateConfig = (config) => { props.updateConfig(config); this.globalConfig = getGlobalConfig(); } this.updateConfig = config => {
props.updateConfig(config);
this.globalConfig = getGlobalConfig();
};
this.createContext = props.createContext; this.createContext = props.createContext;
this.history = props.history; this.history = props.history;
this.callback = callback; this.callback = callback;
...@@ -218,47 +227,60 @@ class Login { ...@@ -218,47 +227,60 @@ class Login {
client: self.globalConfig.client, client: self.globalConfig.client,
token, token,
'request.preventCache': Date.now(), 'request.preventCache': Date.now(),
}) }),
]).then(results => { ])
const res = results[0] ?? {}; .then(results => {
if (res && res.say.statusCode === '0000') { const res = results[0] ?? {};
let mqttConfig = { if (res && res.say.statusCode === '0000') {
mqtt_mess: {}, const mqttConfig = {
mqtt_path: DEFAULT_MQTT_PATH, mqtt_mess: {},
nginxStart: false, mqtt_path: DEFAULT_MQTT_PATH,
mqtt_IsSSL: true nginxStart: false,
}; mqtt_IsSSL: true,
if (Array.isArray(res.getMe) && res.getMe.length > 0) { };
if (res.getMe[0]) { if (Array.isArray(res.getMe) && res.getMe.length > 0) {
const data = res.getMe[0]; if (res.getMe[0]) {
mqttConfig.mqtt_IsSSL = data.IsSSL ? data.IsSSL : false; const data = res.getMe[0];
mqttConfig.mqtt_mess.site_code = data.SiteCode || self.globalConfig.userInfo.site; mqttConfig.mqtt_IsSSL = data.IsSSL ? data.IsSSL : false;
mqttConfig.mqtt_mess.TcpIP = data.TcpIP; mqttConfig.mqtt_mess.site_code =
mqttConfig.mqtt_mess.TcpPort = data.TcpPort ? parseInt(data.TcpPort) : 8083; data.SiteCode || self.globalConfig.userInfo.site;
mqttConfig.mqtt_mess.MessageLevel = data.MessageLevel ? data.MessageLevel : DEFAULT_PARSE_LEVEL; mqttConfig.mqtt_mess.TcpIP = data.TcpIP;
mqttConfig.mqtt_mess.TcpPort = data.TcpPort
if (data.NginxStart) { ? parseInt(data.TcpPort)
mqttConfig.NginxStart = data.NginxStart; : 8083;
mqttConfig.mqtt_mess.TcpIP = window.location.hostname; mqttConfig.mqtt_mess.MessageLevel = data.MessageLevel
mqttConfig.mqtt_mess.TcpPort = parseInt(window.location.port); ? data.MessageLevel
mqttConfig.mqtt_path = '/ws/'; : DEFAULT_PARSE_LEVEL;
if (data.NginxStart) {
mqttConfig.NginxStart = data.NginxStart;
mqttConfig.mqtt_mess.TcpIP = window.location.hostname;
mqttConfig.mqtt_mess.TcpPort = parseInt(window.location.port);
mqttConfig.mqtt_path = '/ws/';
} else {
mqttConfig.nginxStart = data.NginxStart;
}
} else { } else {
mqttConfig.nginxStart = data.NginxStart mqttConfig.mqtt_mess.TcpIP = DEFAULT_TCP_IP;
mqttConfig.mqtt_mess.TcpPort = DEFAULT_TCP_PORT;
mqttConfig.mqtt_IsSSL = `${mqttConfig.mqtt_mess.TcpIP}:${
mqttConfig.mqtt_mess.TcpPort
}`;
} }
}else { mqttConfig.mqtt_iotIP = `${mqttConfig.mqtt_mess.TcpIP}:${
mqttConfig.mqtt_mess.TcpIP = DEFAULT_TCP_IP; mqttConfig.mqtt_mess.TcpPort
mqttConfig.mqtt_mess.TcpPort = DEFAULT_TCP_PORT; }`;
mqttConfig.mqtt_IsSSL = mqttConfig.mqtt_mess.TcpIP + ":" + mqttConfig.mqtt_mess.TcpPort;
}
mqttConfig.mqtt_iotIP = mqttConfig.mqtt_mess.TcpIP + ":" + mqttConfig.mqtt_mess.TcpPort;
self.globalConfig = Object.assign(self.globalConfig, { ...mqttConfig }); self.globalConfig = Object.assign(self.globalConfig, {
...mqttConfig,
});
}
} else {
Logger.info('获取mqtt服务器参数失败');
} }
} else { return results;
Logger.info('获取mqtt服务器参数失败'); })
} .then(results => {
return results;
}).then(results => {
const response = results[1] ?? {}; const response = results[1] ?? {};
const result = const result =
response && response.code === SERVICE_INTERFACE_SUCCESS_CODE response && response.code === SERVICE_INTERFACE_SUCCESS_CODE
...@@ -284,7 +306,7 @@ class Login { ...@@ -284,7 +306,7 @@ class Login {
// eslint-disable-next-line no-prototype-builtins // eslint-disable-next-line no-prototype-builtins
if (self.globalConfig.hasOwnProperty('webConfig')) { if (self.globalConfig.hasOwnProperty('webConfig')) {
self.globalConfig = Object.assign(self.globalConfig ,{ self.globalConfig = Object.assign(self.globalConfig, {
// ...self.globalConfig, // ...self.globalConfig,
...self.globalConfig.webConfig.basicConfig, ...self.globalConfig.webConfig.basicConfig,
...self.globalConfig.webConfig.optionalConfig, ...self.globalConfig.webConfig.optionalConfig,
......
import 'kit_utils/lib/format'; import '@wisdom-utils/utils/lib/helpers/format';
import React, { forwardRef, useEffect, useRef, useState } from 'react'; import React, { forwardRef, useEffect, useState } from 'react';
import { params } from 'kit_utils';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { useHistory, withRouter } from '@wisdom-utils/runtime'; import { useHistory } from '@wisdom-utils/runtime';
import { actionCreators } from '@/containers/App/store'; import { actionCreators } from '@/containers/App/store';
import LoginAction from './login'; import LoginAction from './login';
import { initMicroApps } from '../../../micro'; import { initMicroApps } from '../../../micro';
const Login = forwardRef((props, _ref) => { const Login = forwardRef((props, _ref) => {
const history = useHistory(); const history = useHistory();
const [action, setAction] = useState( const [action, setAction] = useState(
() => new LoginAction(Object.assign({}, props, {history}), () => {}, true), () =>
new LoginAction(Object.assign({}, props, { history }), () => {}, true),
); );
useEffect(() => { useEffect(() => {
action.globalConfig = props.global; action.globalConfig = props.global;
}, [props.global]); }, [action.globalConfig, props.global]);
useEffect(() => { useEffect(() => {
action && action &&
action.events.on('loginSuccess', event => { action.events.on('loginSuccess', event => {
//http://127.0.0.1:8080/civbase/civweb4/ // http://127.0.0.1:8080/civbase/civweb4/
// props.updateConfig(Object.assign({}, props.global, { // props.updateConfig(Object.assign({}, props.global, {
// homepage: params.getParams('redirect') // homepage: params.getParams('redirect')
// })); // }));
// props.history.push('/' + params.getParams('redirect')) // props.history.push('/' + params.getParams('redirect'))
props.history.push(`/?client=${props.global.client}&generateType=${props.global.generateType}`); props.history.push(
// window.share.event.emit('triggerMicro', props.global); `/?client=${props.global.client}&generateType=${
initMicroApps(); props.global.generateType
}); }`,
}, [props.globalConfig && props.globalConfig.userInfo]) );
// window.share.event.emit('triggerMicro', props.global);
initMicroApps();
});
}, [action, props.global.client, props.global.generateType, props.history]);
return <div>{props.children}</div>; return <div>{props.children}</div>;
}); });
......
...@@ -4,12 +4,10 @@ import React, { forwardRef, useEffect, useRef, useState } from 'react'; ...@@ -4,12 +4,10 @@ import React, { forwardRef, useEffect, useRef, useState } from 'react';
import { Modal } from 'antd'; import { Modal } from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import { dom } from 'kit_utils'; import { dom } from '@wisdom-utils/utils/lib/helpers';
import { Helmet, HelmetProvider } from 'react-helmet-async'; import { Helmet, HelmetProvider } from 'react-helmet-async';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { useHistory, withRouter } from '@wisdom-utils/runtime'; import { useHistory, withRouter } from '@wisdom-utils/runtime';
import { LOGIN_DISPLAY, LOGIN_WAY } from '@/constants';
import { actionCreators } from '@/containers/App/store'; import { actionCreators } from '@/containers/App/store';
import defaultSetting from '../../../../../config/defaultSetting'; import defaultSetting from '../../../../../config/defaultSetting';
import LoginAction from '../login'; import LoginAction from '../login';
...@@ -35,7 +33,8 @@ const Login = forwardRef((props, _ref) => { ...@@ -35,7 +33,8 @@ const Login = forwardRef((props, _ref) => {
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const history = useHistory(); const history = useHistory();
const [action, setAction] = useState( const [action, setAction] = useState(
() => new LoginAction(Object.assign({}, props, {history}), setVisible, true), () =>
new LoginAction(Object.assign({}, props, { history }), setVisible, true),
); );
// useEffect(() => { // useEffect(() => {
...@@ -76,7 +75,7 @@ const Login = forwardRef((props, _ref) => { ...@@ -76,7 +75,7 @@ const Login = forwardRef((props, _ref) => {
setVisible(false); setVisible(false);
setSubmitting(false); setSubmitting(false);
}); });
action && action &&
action.events.on('loginVisible', status => { action.events.on('loginVisible', status => {
setVisible(status); setVisible(status);
}); });
......
import 'kit_utils/lib/format'; import 'kit_utils/lib/format';
import React, { import React, { forwardRef, useEffect, useRef, useState } from 'react';
forwardRef,
useEffect,
useRef,
useState,
} from 'react';
import { import { Alert, Checkbox, Form, Modal, Popover } from 'antd';
Alert,
Checkbox,
Form,
Modal,
Popover,
} from 'antd';
import classNames from 'classnames'; import classNames from 'classnames';
import { encode } from 'js-base64'; import { encode } from 'js-base64';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { dom } from 'kit_utils'; import { dom } from '@wisdom-utils/utils/lib/helpers';
import QRCode from 'qrcode.react'; import { Helmet, HelmetProvider } from 'react-helmet-async';
import {
Helmet,
HelmetProvider,
} from 'react-helmet-async';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom'; import { withRouter } from 'react-router-dom';
import { import { LOGIN_DISPLAY, LOGIN_WAY } from '@/constants';
LOGIN_DISPLAY,
LOGIN_WAY,
} from '@/constants';
import { actionCreators } from '@/containers/App/store'; import { actionCreators } from '@/containers/App/store';
import { import { FormattedMessage, useIntl } from '@/locales/localeExports';
FormattedMessage,
useIntl,
} from '@/locales/localeExports';
import defaultSetting from '../../../../../config/defaultSetting'; import defaultSetting from '../../../../../config/defaultSetting';
import LoginForm from '../components/Login'; import LoginForm from '../components/Login';
......
import { store } from '@wisdom-utils/utils'; import { store } from '@wisdom-utils/utils';
import { appService } from '../api'; import { appService } from '../api';
store.on('event:route', (url) => { store.on('event:route', url => {
history.pushState(null, `/civbase/${url}`, `/civbase/${url}`); // eslint-disable-next-line no-restricted-globals
history.pushState(null, `/civbase/${url}`, `/civbase/${url}`);
}); });
window.share && window.share.event && window.share.event.on('event:logs', params => { window.share &&
window.share.event &&
window.share.event.on('event:logs', params => {
delete params.site; delete params.site;
appService.pvLogs(params); appService.pvLogs(params);
}); });
// store.on('event:logout', () => { // store.on('event:logout', () => {
// window.globalConfig = {}; // window.globalConfig = {};
......
import { transformURL } from './utils'; import React from 'react';
import { guid, params, urlHelpers } from '@wisdom-utils/utils/lib/helpers';
import LoadingComponent from '@ant-design/pro-layout/es/PageLoading'; import LoadingComponent from '@ant-design/pro-layout/es/PageLoading';
import { import { dynamic } from '@wisdom-utils/runtime';
dynamic
} from '@wisdom-utils/runtime';
import { matchPath, Route, Switch} from 'react-router'; import { matchPath, Route, Switch} from 'react-router';
import React, { Suspense, Fragment } from 'react'; const { getParamsV1 } = params;
export const isURL = function(url) { const { isURL, isAbsoluteURL, getURL, transformURL } = urlHelpers
// eslint-disable-next-line no-useless-escape export const getParams = getParamsV1;
return /^(http|https)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/.test(url);
};
const DEFAULT_APPLICATION = 'civweb4'; const DEFAULT_APPLICATION = 'civweb4';
/* eslint-disable */
export const guid = function(prefix) {
let date = new Date().getTime();
if (window.performance && typeof window.performance.now === 'function') {
date += performance.now();
}
const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(
c,
) {
const r = (date + Math.random() * 16) % 16 | 0;
date = Math.floor(date / 16);
return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
});
return prefix + uuid.replace(/-/g, '.') + new Date().getTime();
};
export function getParams(pathname) {
let ret = {};
const url = pathname ? pathname : decodeURIComponent(window.location.pathname);
if (url.indexOf('|') > -1) {
const params = url.split('|')[1];
params.split('&').map(item => ret[item.split("=")[0]] = item.split("=")[1])
return ret;
}
return ret;
}
function isAbsoluteURL(url) {
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
};
const level = 0; const level = 0;
const getURL = url => {
const i = url.indexOf('#');
const href = i >= 0 ? url.slice(0, i) : url;
return href;
};
const generRotes = (widgets, parent, level = 0) => { const generRotes = (widgets, parent, level = 0) => {
......
const camelizeRE = /-(\w)/g
export function camelize (str) {
str = String(str)
return str.replace(camelizeRE, function (m, c) {
return c ? c.toUpperCase() : ''
})
}
export function kebab (str) {
str = String(str)
return str.replace(/([A-Z])/g, '-$1').toLowerCase()
}
\ No newline at end of file
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import pathRegexp from 'path-to-regexp'; import pathRegexp from 'path-to-regexp';
import { parse } from 'querystring'; import { parse } from 'querystring';
import { camelize } from './strings';
import pkg from '../../package.json'; import pkg from '../../package.json';
const { toString } = Object.prototype; const { toString } = Object.prototype;
...@@ -86,14 +85,6 @@ export function findPathByLeafId(leafId, nodes, path, key, clear) { ...@@ -86,14 +85,6 @@ export function findPathByLeafId(leafId, nodes, path, key, clear) {
} }
} }
export function transformURL(path) {
//civweb4/
// path = path.replace(/[(\\|)|(&)]widget=[0-9]*/, '');
const el = document.createElement('input');
el.value = path;
String.fromCharCode(92);
return el.value.replace(/\\/g, '/');
}
export function findPathByWidget(leafId, nodes, path, key) { export function findPathByWidget(leafId, nodes, path, key) {
if (path === undefined) { if (path === undefined) {
...@@ -168,14 +159,3 @@ export function getToken() { ...@@ -168,14 +159,3 @@ export function getToken() {
export function setToken(token) { export function setToken(token) {
Cookies.set(token); Cookies.set(token);
} }
export const closeTabAction = (history, returnUrl, callback) => {};
export function processComponentName(name, { prefix = '', firstUpperCase = false } = {}) {
const pureName = name;
let camelizeName = `${camelize(`${prefix}${pureName}`)}`
if (firstUpperCase) {
camelizeName = camelizeName.charAt(0).toUpperCase() + camelizeName.slice(1)
}
return camelizeName
}
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