Commit a0f7a260 authored by 曾婧's avatar 曾婧
parents 70e4a7ee d3abaa37
Pipeline #48600 skipped with stages
...@@ -9,7 +9,7 @@ import { connect } from 'react-redux'; ...@@ -9,7 +9,7 @@ import { connect } from 'react-redux';
import { useHistory } from '@wisdom-utils/runtime'; import { useHistory } from '@wisdom-utils/runtime';
import KeepAlive from 'react-activation'; import KeepAlive from 'react-activation';
import AMapLoader from '@amap/amap-jsapi-loader'; import AMapLoader from '@amap/amap-jsapi-loader';
import { BasicLayout } from '@wisdom-utils/components/lib/AppLayout' import { BasicLayout } from '@wisdom-utils/components/lib/AppLayout';
import RightContent from '@/components/GlobalHeader/ExtendRightContent'; import RightContent from '@/components/GlobalHeader/ExtendRightContent';
import defaultSetting from '@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings'; import defaultSetting from '@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings';
import { actionCreators } from '@/containers/App/store'; import { actionCreators } from '@/containers/App/store';
...@@ -24,30 +24,33 @@ const { params } = helpers; ...@@ -24,30 +24,33 @@ const { params } = helpers;
const { getParamsV1 } = params; const { getParamsV1 } = params;
const antIcon = <LoadingOutlined style={{ fontSize: 12 }} spin />; const antIcon = <LoadingOutlined style={{ fontSize: 12 }} spin />;
const arrowSvg = ({ fillColor = '#fff' }) => ( const arrowSvg = ({ fillColor = '#fff' }) => (
<svg t="1543324489942" <svg
className="icon" viewBox="0 0 1024 1024" t="1543324489942"
version="1.1" xmlns="http://www.w3.org/2000/svg" className="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xlink"
width="16" height="16"> width="16"
<path d="M511.700683 639.423111 191.917496 319.596945 319.830771 319.596945 511.700683 511.715521 703.570595 319.596945 831.48387 319.596945Z" p-id="8626" fill={fillColor}></path> height="16"
>
<path
d="M511.700683 639.423111 191.917496 319.596945 319.830771 319.596945 511.700683 511.715521 703.570595 319.596945 831.48387 319.596945Z"
p-id="8626"
fill={fillColor}
/>
</svg> </svg>
); );
const ArrowIcon = props => <Icon component={arrowSvg} {...props} />; const ArrowIcon = props => <Icon component={arrowSvg} {...props} />;
const optionsWith = [ const optionsWith = [{ label: '按站点', value: 'site' }, { label: '按城市', value: 'city' }];
{ label: '按站点', value: 'site' },
{ label: '按城市', value: 'city' },
];
const HOT = ['HOT', '县', '市', 'New']; const HOT = ['HOT', '县', '市', 'New'];
const StationsItem = (item, action, onChangeVisible) => { const StationsItem = (item, action, onChangeVisible) => {
const changeGroup = (event, data) => { const changeGroup = (event, data) => {
debugger debugger;
action.changeGroup && action.changeGroup(event, data, onChangeVisible); action.changeGroup && action.changeGroup(event, data, onChangeVisible);
}; };
return ( return (
<li <li key={item.groupID} style={{ marginRight: `${item.style.marginRight}px` }}>
key={item.groupID}
style={{ marginRight: `${item.style.marginRight}px` }}
>
<a <a
className={classNames(layoutStyles.city_select, layoutStyles.showTip)} className={classNames(layoutStyles.city_select, layoutStyles.showTip)}
title={item.city} title={item.city}
...@@ -56,9 +59,7 @@ const StationsItem = (item, action, onChangeVisible) => { ...@@ -56,9 +59,7 @@ const StationsItem = (item, action, onChangeVisible) => {
onClick={event => changeGroup(event, item)} onClick={event => changeGroup(event, item)}
> >
{item.groupName} {item.groupName}
{item.promoteTip && HOT.includes(item.promoteTip) && ( {item.promoteTip && HOT.includes(item.promoteTip) && <div title={`${item.promoteTip}`}>{item.promoteTip}</div>}
<div title={`${item.promoteTip}`}>{item.promoteTip}</div>
)}
</a> </a>
</li> </li>
); );
...@@ -84,11 +85,7 @@ const Stations = props => { ...@@ -84,11 +85,7 @@ const Stations = props => {
return ( return (
<> <>
<div className={layoutStyles.focusStations}> <div className={layoutStyles.focusStations}>
<ul> <ul>{Array.isArray(data) ? data.map(item => StationsItem(item, props.action, props.setVisible)) : null}</ul>
{Array.isArray(data)
? data.map(item => StationsItem(item, props.action, props.setVisible))
: null}
</ul>
</div> </div>
<Radio.Group <Radio.Group
options={optionsWith} options={optionsWith}
...@@ -101,10 +98,7 @@ const Stations = props => { ...@@ -101,10 +98,7 @@ const Stations = props => {
/> />
<div style={{ maxWidth: '520px', position: 'relative' }}> <div style={{ maxWidth: '520px', position: 'relative' }}>
{defaultTab === 'site' ? ( {defaultTab === 'site' ? (
<div <div className={classNames(layoutStyles.city_pane, layoutStyles.station_container)} ref={cityPane}>
className={classNames(layoutStyles.city_pane, layoutStyles.station_container)}
ref={cityPane}
>
<Anchor <Anchor
affix={false} affix={false}
onClick={handleClick} onClick={handleClick}
...@@ -112,25 +106,15 @@ const Stations = props => { ...@@ -112,25 +106,15 @@ const Stations = props => {
getContainer={() => cityContent.current} getContainer={() => cityContent.current}
> >
<ul className={layoutStyles.py}> <ul className={layoutStyles.py}>
{props.data && {props.data && props.data.siteCityList && props.data.siteCityList.letters}
props.data.siteCityList &&
props.data.siteCityList.letters}
</ul> </ul>
<div <div className={layoutStyles.cityContent} style={{ height: '335px' }} ref={cityContent}>
className={layoutStyles.cityContent} {props.data && props.data.siteCityList && props.data.siteCityList.content}
style={{ height: '335px' }}
ref={cityContent}
>
{props.data &&
props.data.siteCityList &&
props.data.siteCityList.content}
</div> </div>
</Anchor> </Anchor>
</div> </div>
) : ( ) : (
<div className="city_pane city_container"> <div className="city_pane city_container">{props.data.citySelector}</div>
{props.data.citySelector}
</div>
)} )}
<Spin spinning={props.loading} tip="加载中" /> <Spin spinning={props.loading} tip="加载中" />
</div> </div>
...@@ -143,7 +127,7 @@ const renderSite = ({ data, config, loading, setLoading, action }) => { ...@@ -143,7 +127,7 @@ const renderSite = ({ data, config, loading, setLoading, action }) => {
let loaded = !!((data && !data.stations) || (Array.isArray(data.weathers) && data.weathers.length === 0)); let loaded = !!((data && !data.stations) || (Array.isArray(data.weathers) && data.weathers.length === 0));
if (config && config.userInfo && config.userInfo.site === '') { if (config && config.userInfo && config.userInfo.site === '') {
loaded = false; loaded = false;
}; }
return ( return (
<> <>
<Spin <Spin
...@@ -152,38 +136,33 @@ const renderSite = ({ data, config, loading, setLoading, action }) => { ...@@ -152,38 +136,33 @@ const renderSite = ({ data, config, loading, setLoading, action }) => {
size="small" size="small"
style={{ marginLeft: '10px' }} style={{ marginLeft: '10px' }}
tip="" tip=""
wrapperClassName={layoutStyles.spinLoadding}> wrapperClassName={layoutStyles.spinLoadding}
>
<> <>
<Popover <Popover
placement="bottomLeft" placement="bottomLeft"
trigger="click" trigger="click"
visible={visible} visible={visible}
content={ content={
<Stations <Stations data={data} loading={loading} setLoading={setLoading} setVisible={setVisible} action={action} />
data={data}
loading={loading}
setLoading={setLoading}
setVisible={setVisible}
action={action}
/>
} }
arrowPointAtCenter arrowPointAtCenter
overlayClassName={classNames(layoutStyles.stationsWrapper, layoutStyles.stationsTop)} overlayClassName={classNames(layoutStyles.stationsWrapper, layoutStyles.stationsTop)}
onVisibleChange={visible => setVisible(visible)} onVisibleChange={visible => setVisible(visible)}
> >
{ {Array.isArray(data.stations) ? (
Array.isArray(data.allStation) && data.allStation.length > 1 ? ( <div className={layoutStyles.toggleSite}>
<div className={layoutStyles.toggleSite}> <img src={require('../assets/basic/site.png')} className={layoutStyles.site} />
<img src={require('../assets/basic/site.png')} className={layoutStyles.site} /> <span className={layoutStyles.name}>{data.currentStationName}</span>
<span className={layoutStyles.name}>{data.currentStationName}</span> <ArrowIcon
<ArrowIcon className={layoutStyles.arrow} fillColor="#fff" className={layoutStyles.arrow}
style={{ fillColor="#fff"
transform: !visible ? `rotate(0deg)` : `rotate(180deg)`, style={{
}} transform: !visible ? `rotate(0deg)` : `rotate(180deg)`,
/> }}
</div> />
) : null </div>
} ) : null}
</Popover> </Popover>
</> </>
</Spin> </Spin>
...@@ -191,25 +170,23 @@ const renderSite = ({ data, config, loading, setLoading, action }) => { ...@@ -191,25 +170,23 @@ const renderSite = ({ data, config, loading, setLoading, action }) => {
<span <span
className={layoutStyles.weatcher} className={layoutStyles.weatcher}
style={{ style={{
borderLeft: borderLeft: data.stations.length === 0 ? '0px' : '1px solid rgba(256, 256, 256, 0.3)',
data.stations.length === 0 ? '0px' : '1px solid rgba(256, 256, 256, 0.3)', }}
}}> >
<img src={data.weathers && data.weathers.icon} className={layoutStyles.icon} /> <img src={data.weathers && data.weathers.icon} className={layoutStyles.icon} />
<span className={layoutStyles.text}>{data.weathers && data.weathers.text}</span> <span className={layoutStyles.text}>{data.weathers && data.weathers.text}</span>
</span> </span>
) : null} ) : null}
</> </>
) );
} };
const Layout = props => { const Layout = props => {
const [collapse, setCollapse] = useState(false); const [collapse, setCollapse] = useState(false);
const [cityData, setCityData] = useState({}); const [cityData, setCityData] = useState({});
const [siteLoading, setSiteLoading] = useState(false); const [siteLoading, setSiteLoading] = useState(false);
const [mapMode, setMapMode] = useState(WEB_GIS_TYPE.ARCGIS) const [mapMode, setMapMode] = useState(WEB_GIS_TYPE.ARCGIS);
const [siteAction, setSiteAction] = useState( const [siteAction, setSiteAction] = useState(() => new Site(props, setSiteLoading));
() => new Site(props, setSiteLoading),
);
// const basename = getBaseName(); // const basename = getBaseName();
const history = useHistory(); const history = useHistory();
useEffect(() => { useEffect(() => {
...@@ -218,13 +195,14 @@ const Layout = props => { ...@@ -218,13 +195,14 @@ const Layout = props => {
let client = props.global && props.global.hasOwnProperty('client') ? props.global.get('client') : null; let client = props.global && props.global.hasOwnProperty('client') ? props.global.get('client') : null;
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city'; client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city';
let generateType = props.global && props.global.hasOwnProperty('get') ? props.global.get('generateType') : null; let generateType = props.global && props.global.hasOwnProperty('get') ? props.global.get('generateType') : null;
generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : ''; generateType =
!_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined'
? `&generateType=${generateType}`
: '';
history.replace(`/user/login?client=${client}${generateType}`); history.replace(`/user/login?client=${client}${generateType}`);
props.logout(); props.logout();
return;
} }
}, [history, props, props.global, siteAction]);
}, [props.global]);
useEffect(() => { useEffect(() => {
if ( if (
...@@ -238,55 +216,49 @@ const Layout = props => { ...@@ -238,55 +216,49 @@ const Layout = props => {
setCityData(res); setCityData(res);
}); });
} }
}, [props.global.userInfo]) }, [cityData, props.global, props.global.userInfo, siteAction]);
const handlerPageChange = () => { const handlerPageChange = () => {
const params = getParamsV1(props.location.pathname); const params = getParamsV1(props.location.pathname);
if (params.hasOwnProperty('mapType') && params.mapType === WEB_GIS_TYPE.AMAP) { if (params.hasOwnProperty('mapType') && params.mapType === WEB_GIS_TYPE.AMAP) {
AMapLoader.reset(); AMapLoader.reset();
setMapMode(WEB_GIS_TYPE.AMAP) setMapMode(WEB_GIS_TYPE.AMAP);
} else { } else if (!/civweb4/.test(location.pathname)) {
if (!/civweb4/.test(location.pathname)) { AMapLoader.reset();
AMapLoader.reset(); setMapMode(WEB_GIS_TYPE.ARCGIS);
setMapMode(WEB_GIS_TYPE.ARCGIS)
}
} }
} };
useEffect(() => { useEffect(() => {
window.share.event.on('updateSite', res => { window.share.event.on('updateSite', res => {
debugger debugger;
setCityData(res) setCityData(res);
}); });
return () => { return () => {
window.share.event.removeAllListeners('updateSite'); window.share.event.removeAllListeners('updateSite');
}; };
}, []); }, []);
const handleUpdateCurrentIndex = index => { const handleUpdateCurrentIndex = index => {
props.updateCurrentIndex(index); props.updateCurrentIndex(index);
window.share && window.share.event.emit('trigger:updateMenuIndex', index); window.share && window.share.event.emit('trigger:updateMenuIndex', index);
store.set('updateMenuIndex', index); store.set('updateMenuIndex', index);
} };
const handlerIndustry = event => { const handlerIndustry = event => {
props.global.get('userInfo.site') && props.global.get('userInfo.site') ? history.push(`/industry`) : void 0;
props.global.get('userInfo.Industries') &&
props.global.get('userInfo.Industries').length > 1
? history.push(`/industry`)
: void 0;
}; };
const handlerCollapsed = () => { const handlerCollapsed = () => {
setCollapse(!collapse); setCollapse(!collapse);
} };
const logo = props.global && _.isFunction(props.global.get) && props.global.get('bannerLogo') ? (props.global && _.isFunction(props.global.transformDevAssetsBaseURL) && props.global.transformDevAssetsBaseURL(props.global.get('bannerLogo'))) : defaultSetting.logo; const logo =
props.global && _.isFunction(props.global.get) && props.global.get('bannerLogo')
? props.global &&
_.isFunction(props.global.transformDevAssetsBaseURL) &&
props.global.transformDevAssetsBaseURL(props.global.get('bannerLogo'))
: defaultSetting.logo;
return ( return (
<SecurityLayout loading {...props}> <SecurityLayout loading {...props}>
...@@ -309,20 +281,37 @@ const Layout = props => { ...@@ -309,20 +281,37 @@ const Layout = props => {
loading: siteLoading, loading: siteLoading,
setLoading: setSiteLoading, setLoading: setSiteLoading,
action: siteAction, action: siteAction,
})}> })
}
>
<> <>
<Suspense fallback={<></>}> <Suspense fallback={<></>}>
{ {/* {window.location.pathname.startsWith('/civbase/civ_3d') ? ( */}
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 {/* <KeepAlive> */}
} {/* <CesiumMap /> */}
{/* </KeepAlive> */}
{/* ) : window.location.pathname.startsWith('/civbase/civ_webgis') ? ( */}
{/* mapMode === 'AMap' ? ( */}
{/* <AMap /> */}
{/* ) : ( */}
{/* <ArcgisMap options={{ type: 'ArcgisMap' }} /> */}
{/* ) */}
{/* ) : null} */}
{window.location.pathname.startsWith('/civbase/civ_3d') ? (
<KeepAlive>
<CesiumMap />
</KeepAlive>
) : (
window.location.pathname.startsWith('/civbase/civ_webgis') && null
)}
</Suspense> </Suspense>
<div id="micro-container" className="subapp-container"> <div id="micro-container" className="subapp-container">
{props.children} {props.children}
</div> </div>
</> </>
</BasicLayout> </BasicLayout>
</SecurityLayout>
</SecurityLayout>); );
}; };
const mapStateToProps = state => ({ const mapStateToProps = state => ({
...@@ -373,7 +362,7 @@ const mapDispatchToProps = dispatch => ({ ...@@ -373,7 +362,7 @@ const mapDispatchToProps = dispatch => ({
}, },
logout() { logout() {
dispatch(actionCreators.logout()); dispatch(actionCreators.logout());
} },
}); });
export default connect( export default connect(
mapStateToProps, mapStateToProps,
......
...@@ -3,6 +3,7 @@ import { AMapScene } from '@wisdom-map/Amap'; ...@@ -3,6 +3,7 @@ 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';
import { actionCreators } from '../../../containers/App/store'; import { actionCreators } from '../../../containers/App/store';
const AMap = props => { const AMap = props => {
const getMap = (obj, current) => { const getMap = (obj, current) => {
store.set('amapView', { store.set('amapView', {
...@@ -14,10 +15,15 @@ const AMap = props => { ...@@ -14,10 +15,15 @@ const AMap = props => {
map: current, map: current,
}); });
}; };
const mapOptions = { const mapOptions = {
config: props.global.mapsettings, config: window.globalConfig.mapsettings,
theme: 'amap://styles/74fae00a851749793870b658f9f22d55', theme: 'amap://styles/74fae00a851749793870b658f9f22d55',
mapOptions: {
plugins: ['AMap.MarkerClusterer'],
},
}; };
return ( return (
<div <div
style={{ style={{
...@@ -32,9 +38,9 @@ const AMap = props => { ...@@ -32,9 +38,9 @@ const AMap = props => {
</div> </div>
); );
}; };
const mapStateToProps = state => ({ const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']), global: state.getIn(['global', 'globalConfig']),
amapView: state.getIn(['global', 'amapView']),
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
......
...@@ -21,11 +21,11 @@ const LoginTemplate = { ...@@ -21,11 +21,11 @@ const LoginTemplate = {
}; };
/* eslint-disable */ /* eslint-disable */
export default (props) => { export default (props) => {
const redirect = getParams('redirect'); // const redirect = getParams('redirect');
useEffect(() => { // useEffect(() => {
if(getParams('loginName') && getParams('password')) return // if(getParams('loginName') && getParams('password')) return
initGlobalConfig(); // initGlobalConfig();
}, [redirect]); // }, [redirect]);
const template = window.globalConfig && window.globalConfig.loginTemplate; const template = window.globalConfig && window.globalConfig.loginTemplate;
const RenderComponent = LoginTemplate[template] ? LoginTemplate[template]: LoginTemplate['default']; const RenderComponent = LoginTemplate[template] ? LoginTemplate[template]: LoginTemplate['default'];
return <RenderComponent {...props}/> return <RenderComponent {...props}/>
......
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