Commit 2c711627 authored by 邓晓峰's avatar 邓晓峰

fix: gitlab-ci.yml

parent 4bfa0ce4
Pipeline #22188 passed with stages
in 27 minutes 50 seconds
...@@ -13,7 +13,7 @@ stages: ...@@ -13,7 +13,7 @@ stages:
install: install:
stage: install stage: install
script: script:
- npm install - npm run init
cache: cache:
key: ${CI_COMMIT_REF_SLUG} key: ${CI_COMMIT_REF_SLUG}
paths: paths:
......
...@@ -25,11 +25,5 @@ export default { ...@@ -25,11 +25,5 @@ export default {
activeRule: genActiveRule('/civbase/civweb4'), activeRule: genActiveRule('/civbase/civweb4'),
props: {}, props: {},
}, },
// {
// name: 'civweb5',
// entry: `//${window.location.host}/civweb5`,
// container: '#micro-container',
// activeRule: genActiveRule('/civbase/civweb5'),
// },
], ],
}; };
...@@ -34,6 +34,20 @@ module.exports = { ...@@ -34,6 +34,20 @@ module.exports = {
'/cityinterface': '/cityinterface', '/cityinterface': '/cityinterface',
}, },
}, },
'/cityjson': {
target: 'https://pv.sohu.com',
// target: 'http://192.168.19.102:8055',
// target: 'https://panda-water.com',
// target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888',
changeOrigin: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
pathRewrite: {
'/cityjson': '/cityjson',
},
},
'/Publish': { '/Publish': {
// target: 'http://192.168.12.8:8098', // target: 'http://192.168.12.8:8098',
// target: 'http://192.168.10.20:8888', // target: 'http://192.168.10.20:8888',
......
This diff is collapsed.
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
"author": "dengxiaofeng", "author": "dengxiaofeng",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"init": "npm install --registry=https://g.civnet.cn:4873",
"analyze:clean": "rimraf stats.json", "analyze:clean": "rimraf stats.json",
"preanalyze": "npm run analyze:clean", "preanalyze": "npm run analyze:clean",
"analyze": "node ./internals/scripts/analyze.js", "analyze": "node ./internals/scripts/analyze.js",
...@@ -84,8 +85,8 @@ ...@@ -84,8 +85,8 @@
"dependencies": { "dependencies": {
"@babel/polyfill": "7.4.3", "@babel/polyfill": "7.4.3",
"@babel/runtime": "^7.10.5", "@babel/runtime": "^7.10.5",
"@wisdom-utils/components": "0.0.4", "@wisdom-utils/components": "0.0.6",
"@wisdom-utils/utils": "0.0.19", "@wisdom-utils/utils": "0.0.23",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"chalk": "2.4.2", "chalk": "2.4.2",
"compression": "1.7.4", "compression": "1.7.4",
...@@ -101,7 +102,7 @@ ...@@ -101,7 +102,7 @@
"ip": "1.1.5", "ip": "1.1.5",
"js-base64": "^3.5.2", "js-base64": "^3.5.2",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"kit_global_config": "^1.0.12", "kit_global_config": "^1.0.19",
"kit_logger": "^1.0.2", "kit_logger": "^1.0.2",
"kit_utils": "^1.3.6", "kit_utils": "^1.3.6",
"lodash": "4.17.11", "lodash": "4.17.11",
...@@ -149,8 +150,7 @@ ...@@ -149,8 +150,7 @@
"@umijs/fabric": "^2.2.0", "@umijs/fabric": "^2.2.0",
"@umijs/hooks": "^1.9.3", "@umijs/hooks": "^1.9.3",
"add-asset-html-webpack-plugin": "3.1.3", "add-asset-html-webpack-plugin": "3.1.3",
"antd": "^4.9.4", "antd": "^4.10.1",
"axios": "^0.19.2",
"babel-core": "7.0.0-bridge.0", "babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1", "babel-eslint": "10.0.1",
"babel-loader": "8.0.5", "babel-loader": "8.0.5",
......
import baseService from './service/base';
import notificationService from './service/notification';
export { baseService, notificationService };
...@@ -11,7 +11,8 @@ export const API = { ...@@ -11,7 +11,8 @@ export const API = {
GET_USER_INFO: '/CityInterface/rest/services.svc/getUserInfo', GET_USER_INFO: '/CityInterface/rest/services.svc/getUserInfo',
GET_OA: '/CityInterface/rest/services/OA.svc/getLoginInfo', GET_OA: '/CityInterface/rest/services/OA.svc/getLoginInfo',
GET_LOGS: '/CityInterface/rest/services/portal.svc/OMMonitor/SaveLoginInfo', GET_LOGS: '/CityInterface/rest/services/portal.svc/OMMonitor/SaveLoginInfo',
GET_CITY: 'https://pv.sohu.com/cityjson?ie=utf-8', //https://pv.sohu.com
GET_CITY: '/cityjson?ie=utf-8',
GET_ALL_GROUPS_INFO_FORUSER: GET_ALL_GROUPS_INFO_FORUSER:
'CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser', 'CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather', GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather',
......
...@@ -94,6 +94,9 @@ const initGlobalConfig = () => { ...@@ -94,6 +94,9 @@ const initGlobalConfig = () => {
actionCreators.getConfig( actionCreators.getConfig(
Object.assign({}, data, { Object.assign({}, data, {
hasGateWay, hasGateWay,
apiGatewayDomain: `${
window.location.origin
}/Publish/GateWay`,
}), }),
), ),
); );
......
...@@ -139,16 +139,22 @@ const GlobalHeaderRight = props => { ...@@ -139,16 +139,22 @@ const GlobalHeaderRight = props => {
const goHome = event => { const goHome = event => {
event.stopPropagation(); event.stopPropagation();
const url = _.isString(props.global.homepage) const url = _.isString(props.global.get('homepage'))
? props.global.homepage ? props.global.get('homepage')
: props.global.homepage.url; : props.global.get('homepage.url');
props.global.homepage ? props.history.replace(`/civweb4/${url}`) : null; // // props.history.replace(`/civweb4/${url}`)
url ? (
window.share.event.emit('listenerMointer', {
label: '首页',
url: url,
})
) : null;
}; };
const handleOrder = event => { const handleOrder = event => {
event.stopPropagation(); event.stopPropagation();
const widgetConfig = getConfig( const widgetConfig = getConfig(
props.global.widgets.concat(props.global.uiwidgets), props.global.get('widgets').concat(props.global.get('uiwidgets')),
MESSAGE_BOX_URL, MESSAGE_BOX_URL,
'url', 'url',
); );
......
...@@ -146,18 +146,10 @@ const SearchPanel = props => { ...@@ -146,18 +146,10 @@ const SearchPanel = props => {
const handlerMore = event => { const handlerMore = event => {
event.persist && event.persist(); event.persist && event.persist();
event && event.nativeEvent.stopImmediatePropagation(); event && event.nativeEvent.stopImmediatePropagation();
setVisible(true); setVisible(!visible);
props.onClose && props.onClose(event); props.onClose && props.onClose(event);
}; };
// const historyProduct = (event, item) => {
// event.persist && event.persist()
// event && event.stopPropagation();
// const findIndex = props.menu.findIndex(k => k.name === item.name);
// props.updateCurrentIndex && props.updateCurrentIndex(findIndex);
// }
const handlerDelHistory = () => { const handlerDelHistory = () => {
props.clearRecentProduct && props.clearRecentProduct(); props.clearRecentProduct && props.clearRecentProduct();
}; };
...@@ -353,16 +345,14 @@ const SearchPanel = props => { ...@@ -353,16 +345,14 @@ const SearchPanel = props => {
</> </>
)} )}
</div> </div>
{visible ? ( <Modal
<Modal visible={visible}
visible={visible} triggerElRef={props.target}
triggerElRef={props.target} {...props}
{...props} matchValue={matchValue}
matchValue={matchValue} goFeature={goFeature}
goFeature={goFeature} goProduct={goProduct}
goProduct={goProduct} />
/>
) : null}
</div> </div>
); );
}; };
......
...@@ -22,6 +22,7 @@ import { ...@@ -22,6 +22,7 @@ import {
} from './constants'; } from './constants';
import createMessage from './message'; import createMessage from './message';
import service from '../../api/service/notification'; import service from '../../api/service/notification';
import { isJSON } from '../../utils/utils';
/* eslint-disable */ /* eslint-disable */
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
const Logger = logger('mqtt'); const Logger = logger('mqtt');
...@@ -627,7 +628,7 @@ class Notifier { ...@@ -627,7 +628,7 @@ class Notifier {
: '刚刚'; : '刚刚';
const message = { const message = {
id: hisMessage.HisID, id: hisMessage.HisID,
infoContent: this._siteConfig.MessageLevel === DEFAULT_PARSE_LEVEL ? hisMessage.InfoContent: JSON.parse(hisMessage.InfoContent), infoContent: this._siteConfig.MessageLevel === DEFAULT_PARSE_LEVEL ? hisMessage.InfoContent: isJSON(hisMessage.InfoContent) ? JSON.parse(hisMessage.InfoContent): hisMessage.InfoContent,
time: `${timeMss}`, time: `${timeMss}`,
infoType: this.getMessageType(hisMessage.InfoType), infoType: this.getMessageType(hisMessage.InfoType),
dateTime: hisMessage.HisCreateTime, dateTime: hisMessage.HisCreateTime,
......
import { Tabs } from 'antd'; import React, { useState, useRef, useCallback } from 'react';
import { Sticky } from 'react-sticky'; import { useHistory, useLocation } from 'react-router-dom';
import React from 'react'; const TabPanes = props => {
const [activeKey, setActiveKey] = useState('');
const [panes, setPanes] = useState([
{
title: '首页',
key: 'home',
closable: false,
path: '/',
},
]);
const { TabPane } = Tabs; const [isReload, setIsReload] = useState(false);
const [selectedPanel, setSelectedPanel] = useState({});
const pathRef = useRef(null);
const renderTabBar = (props, DefaultTabBar) => ( const {
<Sticky bottomOffset={80}> storeData: { curTab, reloadPath },
{({ stylle }) => <DefaultTabBar {...props} style={{ ...stylle }} />} setStoreData,
</Sticky> defaultActiveKey,
); panesItem,
tabActiveKey,
} = props;
const TabRoute = () => {}; const history = useHistory();
const { pathnname, search } = useLocation();
const fullPath = pathnname + search;
const storeTabs = useCallback(
ps => {
const pathArr = ps.reduce((prev, next) => [...prev, next.path], []);
// setStoreData('SET_CURTAB', pathArr)
},
[setStoreData],
);
const resetTabs = useCallback(() => {
const initPanes = curTab.reduce((prev, next) => {});
});
};
...@@ -13,8 +13,8 @@ import Icon, { ...@@ -13,8 +13,8 @@ import Icon, {
import Draggable from './draggable'; import Draggable from './draggable';
import styles from './index.less'; import styles from './index.less';
//
const { TabPane } = Tabs; // const { TabPane } = Tabs;
const HistorySvg = () => ( const HistorySvg = () => (
<svg <svg
className="icon" className="icon"
...@@ -54,7 +54,7 @@ function itemRender(current, type, originalElement) { ...@@ -54,7 +54,7 @@ function itemRender(current, type, originalElement) {
} }
const Modal = props => { const Modal = props => {
const dragRef = useRef(null); const dragRef = useRef(null);
const [isWidgetShow, setIsWidgetShow] = useState(false); const [isWidgetShow, setIsWidgetShow] = useState(props.visible);
const [keyword, setKeyWord] = useState(props.value); const [keyword, setKeyWord] = useState(props.value);
const [searchProduct, setSearchProduct] = useState([]); const [searchProduct, setSearchProduct] = useState([]);
// const [tabIndex] // const [tabIndex]
...@@ -97,6 +97,10 @@ const Modal = props => { ...@@ -97,6 +97,10 @@ const Modal = props => {
}); });
setFasts(searchResult); setFasts(searchResult);
}, [keyword]); }, [keyword]);
useEffect(() => {
setIsWidgetShow(props.visible);
}, [props.visible]);
const transformSearchHistory = () => { const transformSearchHistory = () => {
const label = keyword !== '' ? '你是不是想搜:' : '搜索历史:'; const label = keyword !== '' ? '你是不是想搜:' : '搜索历史:';
const data = keyword !== '' ? searchProduct : recentKeywords; const data = keyword !== '' ? searchProduct : recentKeywords;
...@@ -243,60 +247,61 @@ const Modal = props => { ...@@ -243,60 +247,61 @@ const Modal = props => {
setKeyWord(value); setKeyWord(value);
}; };
const onClose = () => { const onClose = () => {
setIsWidgetShow(true); setIsWidgetShow(false);
}; };
if (isWidgetShow) { if (!isWidgetShow) {
return null; return null;
} }
const children = ( if (props.visible) {
<Draggable const children = (
dragHandleClassName={styles.header} <Draggable
default={Object.assign( dragHandleClassName={styles.header}
Object.assign({}, target), default={Object.assign(
{}, Object.assign({}, target),
{ {},
width: 420, {
height: 680, width: 420,
}, height: 680,
)} },
bounds="window" )}
minHeight={400} bounds="window"
minWidth={360} minHeight={400}
enableUserSelectHack={false} minWidth={360}
> enableUserSelectHack={false}
<div className={styles['base-wedget']} ref={dragRef}> >
<div className={styles.header}> <div className={styles['base-wedget']} ref={dragRef}>
搜索更多 <div className={styles.header}>
{/* eslint-disable-next-line react/button-has-type */} 搜索更多
<button {/* eslint-disable-next-line react/button-has-type */}
className={classNames(styles.btn, styles.close)} <button
onClick={onClose} className={classNames(styles.btn, styles.close)}
> onClick={onClose}
<CloseOutlined />
</button>
</div>
<div className={styles.body}>
<div className={styles.search}>
<AutoComplete
options={transformSearchHistory()}
dropdownClassName={styles.searchList}
value={keyword}
onSelect={onSelect}
onSearch={handleSearch}
onChange={handleChange}
onFocus={handleFocus}
> >
<Input <CloseOutlined />
size="middle" </button>
placeholder="请输入"
allowClear
suffix={<SearchOutlined className="site-form-item-icon" />}
/>
</AutoComplete>
</div> </div>
<div className={styles.result}> <div className={styles.body}>
{transformSearchFasts()} <div className={styles.search}>
{/* <Tabs defaultActiveKey="1" size="small"> <AutoComplete
options={transformSearchHistory()}
dropdownClassName={styles.searchList}
value={keyword}
onSelect={onSelect}
onSearch={handleSearch}
onChange={handleChange}
onFocus={handleFocus}
>
<Input
size="middle"
placeholder="请输入"
allowClear
suffix={<SearchOutlined className="site-form-item-icon" />}
/>
</AutoComplete>
</div>
<div className={styles.result}>
{transformSearchFasts()}
{/* <Tabs defaultActiveKey="1" size="small">
<TabPane tab="产品功能入口" key="1"> <TabPane tab="产品功能入口" key="1">
{ {
transformSeachProductList() transformSeachProductList()
...@@ -310,12 +315,13 @@ const Modal = props => { ...@@ -310,12 +315,13 @@ const Modal = props => {
</TabPane> </TabPane>
</Tabs> */} </Tabs> */}
</div>
</div> </div>
</div> </div>
</div> </Draggable>
</Draggable> );
); return ReactDOM.createPortal(children, document.body);
return ReactDOM.createPortal(children, document.body); }
}; };
export default Modal; export default Modal;
...@@ -74,10 +74,6 @@ const appReducer = (state = initialState, action) => { ...@@ -74,10 +74,6 @@ const appReducer = (state = initialState, action) => {
action.data, action.data,
{ {
allWidgets: action.data.widgets || [], allWidgets: action.data.widgets || [],
baseURL: {
dev: window.location.origin,
prod: window.location.origin,
},
env: process.env.NODE_ENV === 'development' ? 'daily' : 'prod', env: process.env.NODE_ENV === 'development' ? 'daily' : 'prod',
}, },
); );
......
...@@ -359,8 +359,8 @@ const BasicLayout = props => { ...@@ -359,8 +359,8 @@ const BasicLayout = props => {
}, [props.currentMenuIndex]); }, [props.currentMenuIndex]);
useEffect(() => { useEffect(() => {
if (_.isEmpty(props.global.token)) { if (_.isEmpty(props.global.get('token'))) {
history.replace(`/user/login?client=${props.global.client}`); history.replace(`/user/login?client=${props.global.get('client')}`);
return; return;
} }
siteAction.getCityStationsForUser().then(res => { siteAction.getCityStationsForUser().then(res => {
...@@ -370,9 +370,9 @@ const BasicLayout = props => { ...@@ -370,9 +370,9 @@ const BasicLayout = props => {
useMemo(() => { useMemo(() => {
window.share.event.on('listenerRemoveTab', () => { window.share.event.on('listenerRemoveTab', () => {
props.updateSelectedKeys(`/civweb4/?client=${props.global.client}`); props.updateSelectedKeys(`/civweb4/?client=${props.global.get('client')}`);
props.updatePathname(`/civweb4/?client=${props.global.client}`); props.updatePathname(`/civweb4/?client=${props.global.get('client')}`);
history.push(`/civweb4/?client=${props.global.client}`); history.push(`/civweb4/?client=${props.global.get('client')}`);
}); });
window.share.event.removeAllListeners('listenerRemoveSigleTab'); window.share.event.removeAllListeners('listenerRemoveSigleTab');
}, [props.pathname]); }, [props.pathname]);
...@@ -426,7 +426,7 @@ const BasicLayout = props => { ...@@ -426,7 +426,7 @@ const BasicLayout = props => {
}; };
const handleLogo = event => { const handleLogo = event => {
props.global.userInfo.site ? history.replace(`/industry`) : null; props.global.get('userInfo.site') ? history.replace(`/industry`) : null;
}; };
const transformPopupMenu = useCallback(key => { const transformPopupMenu = useCallback(key => {
...@@ -449,7 +449,7 @@ const BasicLayout = props => { ...@@ -449,7 +449,7 @@ const BasicLayout = props => {
collapsed: collapse, collapsed: collapse,
}; };
const headerContentRender = renderTitle( const headerContentRender = renderTitle(
props.global.title, props.global.get('title'),
siteAction, siteAction,
cityData, cityData,
siteLoading, siteLoading,
...@@ -506,7 +506,7 @@ const BasicLayout = props => { ...@@ -506,7 +506,7 @@ const BasicLayout = props => {
return ( return (
<ProLayout <ProLayout
logo={false} logo={false}
title={props.global && props.global.title} title={props.global && props.global.get('title')}
headerRender={false} headerRender={false}
rightContentRender={() => null} rightContentRender={() => null}
collapsedButtonRender={false} collapsedButtonRender={false}
...@@ -620,12 +620,12 @@ const BasicLayout = props => { ...@@ -620,12 +620,12 @@ const BasicLayout = props => {
<SecurityLayout loading updateCurrentIndex={props.updateCurrentIndex}> <SecurityLayout loading updateCurrentIndex={props.updateCurrentIndex}>
<ProLayout <ProLayout
logo={`http://panda-water.cn/web4/${ logo={`http://panda-water.cn/web4/${
props.global.bannerLogo props.global.get('bannerLogo')
? props.global.bannerLogo ? props.global.get('bannerLogo')
: 'assets/images/logo/单独图案-白色.svg' : 'assets/images/logo/单独图案-白色.svg'
}`} }`}
siderWidth="145px" siderWidth="145px"
title={props.global && props.global.title} title={props.global && props.global.get('title')}
onCollapse={collapse => handlerCollapsed(collapse)} onCollapse={collapse => handlerCollapsed(collapse)}
onMenuHeaderClick={event => handleLogo(event)} onMenuHeaderClick={event => handleLogo(event)}
menuExtraRender={props.menu.length > 0 ? extraRender.render : null} menuExtraRender={props.menu.length > 0 ? extraRender.render : null}
......
...@@ -353,6 +353,7 @@ class Site { ...@@ -353,6 +353,7 @@ class Site {
ignoreSite: true, ignoreSite: true,
}) })
.then(res => { .then(res => {
// eslint-disable-next-line no-debugger
const { token } = res; const { token } = res;
if (token) { if (token) {
this.beforeChangeCheck(token, site); this.beforeChangeCheck(token, site);
...@@ -364,6 +365,7 @@ class Site { ...@@ -364,6 +365,7 @@ class Site {
} }
beforeChangeCheck(token, site) { beforeChangeCheck(token, site) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
services services
.getUserInfo({ .getUserInfo({
......
...@@ -135,6 +135,7 @@ export const defaultApp = () => { ...@@ -135,6 +135,7 @@ export const defaultApp = () => {
const config = createStoreage.get('globalConfig'); const config = createStoreage.get('globalConfig');
if (config && config.token) { if (config && config.token) {
// const startWith = config.homepage ? config.homepage.split('/') : []; // const startWith = config.homepage ? config.homepage.split('/') : [];
// console.log(findPathByLeafId(config.homepage, '', 'url'))
const basePath = const basePath =
config.homepage !== '' && FILTER_FOLER_REG.test(config.homepage) config.homepage !== '' && FILTER_FOLER_REG.test(config.homepage)
? 'civweb4' ? 'civweb4'
......
...@@ -70,6 +70,7 @@ class Login { ...@@ -70,6 +70,7 @@ class Login {
subOID: 'subOID', subOID: 'subOID',
site: this.getLocalSiteBytoken(token), site: this.getLocalSiteBytoken(token),
'request.preventCache': Date.now(), 'request.preventCache': Date.now(),
ignoreSite: true,
}) })
.then(response => { .then(response => {
if (response && !response.errMsg) { if (response && !response.errMsg) {
...@@ -434,6 +435,7 @@ class Login { ...@@ -434,6 +435,7 @@ class Login {
referer: self.globalConfig.client, referer: self.globalConfig.client,
skipMenuTest: 1, skipMenuTest: 1,
qrcode: code, qrcode: code,
cacheBust: true,
}) })
.then(response => { .then(response => {
if (response.token) { if (response.token) {
......
...@@ -13,7 +13,7 @@ export const guid = function(prefix) { ...@@ -13,7 +13,7 @@ export const guid = function(prefix) {
) { ) {
const r = (date + Math.random() * 16) % 16 | 0; const r = (date + Math.random() * 16) % 16 | 0;
date = Math.floor(date / 16); date = Math.floor(date / 16);
return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16); return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
}); });
return prefix + uuid.replace(/-/g, '.'); return prefix + uuid.replace(/-/g, '.');
}; };
...@@ -58,11 +58,8 @@ const generRotes = (widgets, parent, level = 0) => { ...@@ -58,11 +58,8 @@ const generRotes = (widgets, parent, level = 0) => {
}, },
}); });
} else { } else {
const baseURL = FILTER_FOLER_REG.test(item.url) const baseURL = item.product || 'civweb4';
? 'civweb4' //item.product ? item.product : item.url.replace(/\s/g, '') === '' ? '' : 'civweb5';
: item.url.replace(/\s/g, '') === ''
? ''
: 'civweb5';
let url = let url =
item.hasOwnProperty('url') && !isUrl(url) && baseURL !== '' item.hasOwnProperty('url') && !isUrl(url) && baseURL !== ''
? `/${baseURL}/${item.url.replace(/\s*/g, '')}` ? `/${baseURL}/${item.url.replace(/\s*/g, '')}`
...@@ -84,6 +81,7 @@ const generRotes = (widgets, parent, level = 0) => { ...@@ -84,6 +81,7 @@ const generRotes = (widgets, parent, level = 0) => {
target: isUrl(url) ? '_blank' : '', target: isUrl(url) ? '_blank' : '',
key: guid('panda'), key: guid('panda'),
hideInMenu: l > 3, hideInMenu: l > 3,
application: item.product,
extData: { extData: {
...item, ...item,
icon: (item && item.icon.replace(/\s*/g, '')) || '_', icon: (item && item.icon.replace(/\s*/g, '')) || '_',
......
...@@ -131,3 +131,26 @@ export function isJSON(str) { ...@@ -131,3 +131,26 @@ export function isJSON(str) {
export function isString(str) { export function isString(str) {
return toString.call(str) === '[object String]'; return toString.call(str) === '[object String]';
} }
export const getKeyName = path => {
const truePath = path.split('?')[0];
const curRoute = [].filter(item => item.path.includes(truePath));
if (!curRoute[0]) {
return {
title: '暂无权限',
tabKey: '403',
};
}
const { name, key, component } = curRoute[0];
return { title: name, tabKey: key, component };
};
export const asyncAction = action => {
const wait = new Promise(resolve => resolve(action));
return callback => {
wait.then(() => setTimeout(() => callback()));
};
};
export const closeTabAction = (history, returnUrl, callback) => {};
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