Commit 443dc2d6 authored by yzl's avatar yzl

- 调整进度条逻辑

parent 3f60616f
Pipeline #57666 passed with stages
......@@ -21,7 +21,6 @@ import { connect } from 'react-redux';
import { matchRoutes } from 'react-router-dom';
import Loading from '../components/Loading';
import RightContent from '@/components/GlobalHeader/SimpleRiightContent';
import BootPage from '../pages/bootpage';
import defaultSetting from '@wisdom-utils/components/lib/AppLayout/layouts/defaultSettings';
// import SettingDrawer from '@wisdom-utils/components/lib/layout/components/SettingDrawer';
import { actionCreators } from '@/containers/App/store';
......@@ -34,7 +33,7 @@ import {
import {
helpers,
store,
event,
event
} from '@wisdom-utils/utils';
import { waterMark } from '../utils/mark';
......@@ -259,7 +258,6 @@ const Layout = (props) => {
const history = useHistory();
const location = useLocation();
const { routeConfig = {}, matchPath } = pickRoutes(props.flatMenu, location.pathname);
const [visible, setVisible] = useState(true);
// useEffect(() => {
// setRouteConfig(routeConfig);
......@@ -270,25 +268,8 @@ const Layout = (props) => {
event.on('loading', 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(() => {
siteAction.setGlobalConfig(props.global);
......@@ -360,8 +341,6 @@ const Layout = (props) => {
const Industries = props.global.get('userInfo.Industries');
if (Industries && Industries.length > 1) {
history.push('/Industry');
setCityData({});
setVisible(true);
}
};
// useEffect(async () => {
......@@ -414,20 +393,6 @@ const Layout = (props) => {
}, []);
return (
<>
<div style={{
position: 'absolute',
top: '0',
right: '0',
bottom: '0',
left: '0',
zIndex: 1000,
display: visible ? 'block' : 'none',
}}>
<BootPage visible={visible} />
</div>
<div style={{ display: visible ? 'none' : 'block' }}>
<SecurityLayout {...props}>
<BasicLayout
title={props.global.title}
......@@ -458,8 +423,8 @@ const Layout = (props) => {
popupClassName: 'testpop',
popupOffset: [0, 15],
}}
headerSiteRender={() => {
return !visible && renderSite({
headerSiteRender={() =>
renderSite({
data: cityData,
config: props.global,
loading: siteLoading,
......@@ -468,9 +433,8 @@ const Layout = (props) => {
actionRef,
setMenuLoading,
})
}}
}
menuItemRender={(item, dom) => (
<a
onClick={(event) => {
event.preventDefault();
......@@ -510,8 +474,6 @@ const Layout = (props) => {
</div>
</BasicLayout>
</SecurityLayout>
</div>
</>
);
};
......
......@@ -226,9 +226,7 @@ export const defaultApp = () => {
((config.homepage === '' || _.isNull(config.homepage)) ? `/civbase/civweb4`: (`/civbase/${config.homepage.replace(/^\//, '')}`)) : `/civbase/${config.homepage.replace(/^\//, '')}`;
setDefaultMountApp(url);
window.history.pushState(null, '', url);
event.emit('visible', false);
window.share.event.emit('visible', url);
}
};
......
......@@ -20,10 +20,10 @@ const industries = [
{ name: '农饮水', type: '农饮水', subTitle: 'RURAL POTABLE WATER' , color: 'rgb(4,142,101)'},
{ name: '排水', type: '排水', subTitle: 'DRAINAGE' , color: 'rgb(234,117,28)'},
{ name: '水利', type: '水利', subTitle: 'WATER CONSERVANCY' , color: 'rgb(0,144,158)'},
{ name: '能源', type: '能源', subTitle: 'ENERGY SOURCES', color: 'rgb(16,104,239)' },
{ name: '高品质水', type: '高品质水', subTitle: 'HIGH QUALITY WATER' , color: 'rgb(16,104,239)'},
{ name: '能源', type: '能源', subTitle: 'ENERGY SOURCES', color: 'rgb(49,139,27)' },
{ name: '高品质水', type: '高品质水', subTitle: 'HIGH QUALITY WATER' , color: 'rgb(106,208,218)'},
// { 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: "PANDA'S NEW PRODUCT" , color: 'rgb(12,103,205)'},
{ name: '项目案例', type: '项目案例', subTitle: 'PROJECT CASE' , color: 'rgb(107,36,155)'},
......@@ -31,8 +31,7 @@ const industries = [
// let loginAction = null;
const BootPage = props => {
const {visible} = props;
const [percentNum, setPercentNum] = useState(10);
const [percentNum, setPercentNum] = useState(0);
const [currentType, setCurrentType] = useState('');
// const [loadding, setLoadding] = useState(false);
const [hasRole, setHasRole] = useState(false);
......@@ -47,13 +46,26 @@ const BootPage = props => {
const handlePage = useCallback(
(event, type) => {
setPercentNum(Math.ceil(Math.random()*50));
setCurrentType(type);
event.persist();
event.preventDefault();
// 新增熊猫新产品引导页
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;
}
......@@ -66,8 +78,6 @@ const BootPage = props => {
props.instance && props.instance.updateConfig(config);
// props.instance && props.instance.getUserInfoAndConfig('', true, type);
loginAction && loginAction.getUserInfoAndConfig('', true, type);
setCurrentType(type);
},
[loginAction, props.global.token, props.instance],
);
......@@ -82,8 +92,6 @@ const BootPage = props => {
config.userInfo.Industries instanceof Array &&
config.userInfo.Industries.indexOf(item.type) > -1
) {
return (
<li className={styles.bootPageLi} key={item.type} onClick={event => callback(event, item.type)}>
<div className={styles.bootPageList}>
......@@ -109,13 +117,6 @@ const BootPage = props => {
}
});
useEffect(() => {
if(visible){
setCurrentType('');
setPercentNum(10);
}
} , [visible])
useEffect(() => {
// eslint-disable-next-line no-use-before-define
handleResize();
......@@ -131,23 +132,36 @@ const BootPage = props => {
window.addEventListener('resize', handleResize);
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);
props.updateCurrentIndex(0);
setPercentNum(100);
// setLoadding(false);
defaultApp();
};
loginAction.events.on('toggleIndustry', handleToggleIndustry);
return () => {
window.removeEventListener('resize', handleResize);
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 renderIndustr = useMemo(() => renderIndustries(props.global, handlePage), [handlePage, props.global.token, currentType, percentNum]);
......
......@@ -41,10 +41,10 @@ export const dyRoutes = (routes, layout, theme) => {
},
],
},
// {
// path: '/industry',
// component: BootPage,
// },
{
path: '/industry',
component: BootPage,
},
{
path: '/cloud/analysis/using',
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