Commit 443dc2d6 authored by yzl's avatar yzl

- 调整进度条逻辑

parent 3f60616f
Pipeline #57666 passed with stages
...@@ -21,7 +21,6 @@ import { connect } from 'react-redux'; ...@@ -21,7 +21,6 @@ import { connect } from 'react-redux';
import { matchRoutes } from 'react-router-dom'; import { matchRoutes } from 'react-router-dom';
import Loading from '../components/Loading'; import Loading from '../components/Loading';
import RightContent from '@/components/GlobalHeader/SimpleRiightContent'; import RightContent from '@/components/GlobalHeader/SimpleRiightContent';
import BootPage from '../pages/bootpage';
import defaultSetting from '@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings'; import defaultSetting from '@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings';
// import SettingDrawer from '@wisdom-utils/components/lib/layout/components/SettingDrawer'; // import SettingDrawer from '@wisdom-utils/components/lib/layout/components/SettingDrawer';
import { actionCreators } from '@/containers/App/store'; import { actionCreators } from '@/containers/App/store';
...@@ -34,7 +33,7 @@ import { ...@@ -34,7 +33,7 @@ import {
import { import {
helpers, helpers,
store, store,
event, event
} from '@wisdom-utils/utils'; } from '@wisdom-utils/utils';
import { waterMark } from '../utils/mark'; import { waterMark } from '../utils/mark';
...@@ -259,7 +258,6 @@ const Layout = (props) => { ...@@ -259,7 +258,6 @@ const Layout = (props) => {
const history = useHistory(); const history = useHistory();
const location = useLocation(); const location = useLocation();
const { routeConfig = {}, matchPath } = pickRoutes(props.flatMenu, location.pathname); const { routeConfig = {}, matchPath } = pickRoutes(props.flatMenu, location.pathname);
const [visible, setVisible] = useState(true);
// useEffect(() => { // useEffect(() => {
// setRouteConfig(routeConfig); // setRouteConfig(routeConfig);
...@@ -270,25 +268,8 @@ const Layout = (props) => { ...@@ -270,25 +268,8 @@ const Layout = (props) => {
event.on('loading', ret => { event.on('loading', ret => {
setSubLoading(ret); setSubLoading(ret);
}); });
event.on('visible', (ret) => {
setTimeout(() => {
setVisible(ret);
}, 2000);
});
}, []); }, []);
useEffect(() => {
let flag = false;
if (props.location.pathname.indexOf('industry') !== -1 || props.location.pathname.indexOf('Industry') !== -1) {
flag = true;
setCityData({});
}
setVisible(flag);
}, [props.location.pathname]);
useEffect(() => { useEffect(() => {
siteAction.setGlobalConfig(props.global); siteAction.setGlobalConfig(props.global);
...@@ -360,8 +341,6 @@ const Layout = (props) => { ...@@ -360,8 +341,6 @@ const Layout = (props) => {
const Industries = props.global.get('userInfo.Industries'); const Industries = props.global.get('userInfo.Industries');
if (Industries && Industries.length > 1) { if (Industries && Industries.length > 1) {
history.push('/Industry'); history.push('/Industry');
setCityData({});
setVisible(true);
} }
}; };
// useEffect(async () => { // useEffect(async () => {
...@@ -414,104 +393,87 @@ const Layout = (props) => { ...@@ -414,104 +393,87 @@ const Layout = (props) => {
}, []); }, []);
return ( return (
<> <SecurityLayout {...props}>
<div style={{ <BasicLayout
position: 'absolute', title={props.global.title}
top: '0', route={props.route}
right: '0', location={location}
bottom: '0', navTheme={props.global?.variableTheme?.navTheme ?? 'dark'}
left: '0', mode='MDI'
zIndex: 1000, fixedHeader
display: visible ? 'block' : 'none', headerHeight={52}
}}> routeConfig={routeConfig}
<BootPage visible={visible} /> matchPath={matchPath}
</div> actionRef={actionRef}
menu={{
<div style={{ display: visible ? 'none' : 'block' }}> loading: menuLoading,
<SecurityLayout {...props}> // onLoadingChange: (loading) => setMenuLoading(loading)
<BasicLayout }}
title={props.global.title} logo={logo}
route={props.route} topMenuActiveKey={props.currentMenuIndex}
location={location} rightContentRender={() => <RightContent />}
navTheme={props.global?.variableTheme?.navTheme ?? 'dark'} onPageChange={() => {
mode='MDI' // if(!props.global.token) {
fixedHeader // history.push('/user/login')
headerHeight={52} // }
routeConfig={routeConfig} }}
matchPath={matchPath} onMenuHeaderClick={onMenuHeaderClick}
actionRef={actionRef} onTopMenuHeaderClick={onTopMenuHeaderClick}
menu={{ menuProps={{
loading: menuLoading, popupClassName: 'testpop',
// onLoadingChange: (loading) => setMenuLoading(loading) popupOffset: [0, 15],
}} }}
logo={logo} headerSiteRender={() =>
topMenuActiveKey={props.currentMenuIndex} renderSite({
rightContentRender={() => <RightContent />} data: cityData,
onPageChange={() => { config: props.global,
// if(!props.global.token) { loading: siteLoading,
// history.push('/user/login') setLoading: setSiteLoading,
// } action: siteAction,
}} actionRef,
onMenuHeaderClick={onMenuHeaderClick} setMenuLoading,
onTopMenuHeaderClick={onTopMenuHeaderClick} })
menuProps={{ }
popupClassName: 'testpop', menuItemRender={(item, dom) => (
popupOffset: [0, 15], <a
}} onClick={(event) => {
headerSiteRender={() => { event.preventDefault();
return !visible && renderSite({ window.history.pushState(null, '', '/civbase' + item.path);
data: cityData,
config: props.global,
loading: siteLoading,
setLoading: setSiteLoading,
action: siteAction,
actionRef,
setMenuLoading,
})
}} }}
menuItemRender={(item, dom) => (
<a
onClick={(event) => {
event.preventDefault();
window.history.pushState(null, '', '/civbase' + item.path);
}}
>
{dom}
</a>
)}
> >
{dom}
</a>
)}
>
<Suspense fallback={<></>}> <Suspense fallback={<></>}>
{/* {window.location.pathname.startsWith('/civbase/civ_3d') ? ( */} {/* {window.location.pathname.startsWith('/civbase/civ_3d') ? ( */}
{/* <KeepAlive> */} {/* <KeepAlive> */}
{/* <CesiumMap /> */} {/* <CesiumMap /> */}
{/* </KeepAlive> */} {/* </KeepAlive> */}
{/* ) : window.location.pathname.startsWith('/civbase/civ_webgis') ? ( */} {/* ) : window.location.pathname.startsWith('/civbase/civ_webgis') ? ( */}
{/* mapMode === 'AMap' ? ( */} {/* mapMode === 'AMap' ? ( */}
{/* <AMap /> */} {/* <AMap /> */}
{/* ) : ( */} {/* ) : ( */}
{/* <ArcgisMap options={{ type: 'ArcgisMap' }} /> */} {/* <ArcgisMap options={{ type: 'ArcgisMap' }} /> */}
{/* ) */} {/* ) */}
{/* ) : null} */} {/* ) : null} */}
{window.location.pathname.startsWith('/civbase/civ_3d/map') ? ( {window.location.pathname.startsWith('/civbase/civ_3d/map') ? (
<KeepAlive> <KeepAlive>
<CesiumMap /> <CesiumMap />
</KeepAlive> </KeepAlive>
) : ( ) : (
window.location.pathname.startsWith('/civbase/civ_webgis') && null window.location.pathname.startsWith('/civbase/civ_webgis') && null
)} )}
</Suspense> </Suspense>
{subLoading && <Loading loading={subLoading} />} {subLoading && <Loading loading={subLoading} />}
<div id='micro-container' className='subapp-container'> <div id='micro-container' className='subapp-container'>
{props.children} {props.children}
</div> </div>
</BasicLayout> </BasicLayout>
</SecurityLayout> </SecurityLayout>
</div>
</>
); );
}; };
......
...@@ -226,9 +226,7 @@ export const defaultApp = () => { ...@@ -226,9 +226,7 @@ export const defaultApp = () => {
((config.homepage === '' || _.isNull(config.homepage)) ? `/civbase/civweb4`: (`/civbase/${config.homepage.replace(/^\//, '')}`)) : `/civbase/${config.homepage.replace(/^\//, '')}`; ((config.homepage === '' || _.isNull(config.homepage)) ? `/civbase/civweb4`: (`/civbase/${config.homepage.replace(/^\//, '')}`)) : `/civbase/${config.homepage.replace(/^\//, '')}`;
setDefaultMountApp(url); setDefaultMountApp(url);
window.history.pushState(null, '', url); window.share.event.emit('visible', url);
event.emit('visible', false);
} }
}; };
......
...@@ -20,10 +20,10 @@ const industries = [ ...@@ -20,10 +20,10 @@ const industries = [
{ name: '农饮水', type: '农饮水', subTitle: 'RURAL POTABLE WATER' , color: 'rgb(4,142,101)'}, { name: '农饮水', type: '农饮水', subTitle: 'RURAL POTABLE WATER' , color: 'rgb(4,142,101)'},
{ name: '排水', type: '排水', subTitle: 'DRAINAGE' , color: 'rgb(234,117,28)'}, { name: '排水', type: '排水', subTitle: 'DRAINAGE' , color: 'rgb(234,117,28)'},
{ name: '水利', type: '水利', subTitle: 'WATER CONSERVANCY' , color: 'rgb(0,144,158)'}, { name: '水利', type: '水利', subTitle: 'WATER CONSERVANCY' , color: 'rgb(0,144,158)'},
{ name: '能源', type: '能源', subTitle: 'ENERGY SOURCES', color: 'rgb(16,104,239)' }, { name: '能源', type: '能源', subTitle: 'ENERGY SOURCES', color: 'rgb(49,139,27)' },
{ name: '高品质水', type: '高品质水', subTitle: 'HIGH QUALITY WATER' , color: 'rgb(16,104,239)'}, { name: '高品质水', type: '高品质水', subTitle: 'HIGH QUALITY WATER' , color: 'rgb(106,208,218)'},
// { name: '水资源', type: '水资源', subTitle: 'WATER RESOURCES' }, // { name: '水资源', type: '水资源', subTitle: 'WATER RESOURCES' },
{ name: '熊猫智能实验室', type: '实验室', subTitle: 'PANDA AI. LAB', color: 'rgb(16,104,239)' }, { name: '熊猫智能实验室', type: '实验室', subTitle: 'PANDA AI. LAB', color: 'rgb(104,163,242)' },
{ name: '水务大数据', type: '大数据', subTitle: 'WATER BIG DATA' , color: 'rgb(85,77,210)'}, { name: '水务大数据', type: '大数据', subTitle: 'WATER BIG DATA' , color: 'rgb(85,77,210)'},
{ name: '熊猫新产品', type: '熊猫新产品', subTitle: "PANDA'S NEW PRODUCT" , color: 'rgb(12,103,205)'}, { name: '熊猫新产品', type: '熊猫新产品', subTitle: "PANDA'S NEW PRODUCT" , color: 'rgb(12,103,205)'},
{ name: '项目案例', type: '项目案例', subTitle: 'PROJECT CASE' , color: 'rgb(107,36,155)'}, { name: '项目案例', type: '项目案例', subTitle: 'PROJECT CASE' , color: 'rgb(107,36,155)'},
...@@ -31,8 +31,7 @@ const industries = [ ...@@ -31,8 +31,7 @@ const industries = [
// let loginAction = null; // let loginAction = null;
const BootPage = props => { const BootPage = props => {
const {visible} = props; const [percentNum, setPercentNum] = useState(0);
const [percentNum, setPercentNum] = useState(10);
const [currentType, setCurrentType] = useState(''); const [currentType, setCurrentType] = useState('');
// const [loadding, setLoadding] = useState(false); // const [loadding, setLoadding] = useState(false);
const [hasRole, setHasRole] = useState(false); const [hasRole, setHasRole] = useState(false);
...@@ -47,13 +46,26 @@ const BootPage = props => { ...@@ -47,13 +46,26 @@ const BootPage = props => {
const handlePage = useCallback( const handlePage = useCallback(
(event, type) => { (event, type) => {
setPercentNum(Math.ceil(Math.random()*50)); setPercentNum(Math.ceil(Math.random()*50));
setCurrentType(type);
event.persist(); event.persist();
event.preventDefault(); event.preventDefault();
// 新增熊猫新产品引导页 // 新增熊猫新产品引导页
if(type === '熊猫新产品') { if(type === '熊猫新产品') {
window.history.pushState(null, '', `/cloud/introduction/newproducts`); window.history.pushState('', null ,`/?client=${props.global.client}`);
setTimeout(() => {
setPercentNum(100);
setTimeout(() => {
window.history.pushState('', null , `/cloud/introduction/newproducts`);
}, 500);
})
return; return;
} }
...@@ -66,8 +78,6 @@ const BootPage = props => { ...@@ -66,8 +78,6 @@ const BootPage = props => {
props.instance && props.instance.updateConfig(config); props.instance && props.instance.updateConfig(config);
// props.instance && props.instance.getUserInfoAndConfig('', true, type); // props.instance && props.instance.getUserInfoAndConfig('', true, type);
loginAction && loginAction.getUserInfoAndConfig('', true, type); loginAction && loginAction.getUserInfoAndConfig('', true, type);
setCurrentType(type);
}, },
[loginAction, props.global.token, props.instance], [loginAction, props.global.token, props.instance],
); );
...@@ -82,8 +92,6 @@ const BootPage = props => { ...@@ -82,8 +92,6 @@ const BootPage = props => {
config.userInfo.Industries instanceof Array && config.userInfo.Industries instanceof Array &&
config.userInfo.Industries.indexOf(item.type) > -1 config.userInfo.Industries.indexOf(item.type) > -1
) { ) {
return ( return (
<li className={styles.bootPageLi} key={item.type} onClick={event => callback(event, item.type)}> <li className={styles.bootPageLi} key={item.type} onClick={event => callback(event, item.type)}>
<div className={styles.bootPageList}> <div className={styles.bootPageList}>
...@@ -109,13 +117,6 @@ const BootPage = props => { ...@@ -109,13 +117,6 @@ const BootPage = props => {
} }
}); });
useEffect(() => {
if(visible){
setCurrentType('');
setPercentNum(10);
}
} , [visible])
useEffect(() => { useEffect(() => {
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
handleResize(); handleResize();
...@@ -131,23 +132,36 @@ const BootPage = props => { ...@@ -131,23 +132,36 @@ const BootPage = props => {
window.addEventListener('resize', handleResize); window.addEventListener('resize', handleResize);
const handleToggleIndustry = event => { const handleToggleIndustry = event => {
setPercentNum(98)
// props.history.push(`/?client=${props.global.client}`);
defaultApp(); // props.history.push(`/?client=${props.global.client}`)
// window.share.event.emit('triggerMicro', props.global); // window.share.event.emit('triggerMicro', props.global);
props.updateCurrentIndex(0); props.updateCurrentIndex(0);
setPercentNum(100); defaultApp();
// setLoadding(false);
}; };
loginAction.events.on('toggleIndustry', handleToggleIndustry); loginAction.events.on('toggleIndustry', handleToggleIndustry);
return () => { return () => {
window.removeEventListener('resize', handleResize); window.removeEventListener('resize', handleResize);
loginAction.events.removeListener('toggleIndustry', handleToggleIndustry); loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
}; };
}, [loginAction.events, props]); }, [loginAction.events, props, currentType]);
useEffect(() => {
window.share.event.on('visible' , ret => {
setTimeout(() => {
setPercentNum(100);
setTimeout(() => {
window.history.pushState(null, '', ret);
}, 500);
}, 500)
})
}, [])
const [IndustryNum, setIndustryNum] = useState(0); const [IndustryNum, setIndustryNum] = useState(0);
const renderIndustr = useMemo(() => renderIndustries(props.global, handlePage), [handlePage, props.global.token, currentType, percentNum]); const renderIndustr = useMemo(() => renderIndustries(props.global, handlePage), [handlePage, props.global.token, currentType, percentNum]);
......
...@@ -41,10 +41,10 @@ export const dyRoutes = (routes, layout, theme) => { ...@@ -41,10 +41,10 @@ export const dyRoutes = (routes, layout, theme) => {
}, },
], ],
}, },
// { {
// path: '/industry', path: '/industry',
// component: BootPage, component: BootPage,
// }, },
{ {
path: '/cloud/analysis/using', path: '/cloud/analysis/using',
component: UsingAnalysis, component: UsingAnalysis,
......
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