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