Commit 3f78f51b authored by 崔佳豪's avatar 崔佳豪

perf: 引导页配置

parent 67b63030
Pipeline #51705 passed with stages
in 2 minutes 24 seconds
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
...@@ -8,7 +8,7 @@ import { useIntl } from '@wisdom-utils/components'; ...@@ -8,7 +8,7 @@ import { useIntl } from '@wisdom-utils/components';
import { useDocumentTitle } from '@ant-design/pro-utils'; import { useDocumentTitle } from '@ant-design/pro-utils';
import { useHistory } from '@wisdom-utils/runtime'; import { useHistory } from '@wisdom-utils/runtime';
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';
import SecurityLayout from '../../layouts/SecurityLayout'; import SecurityLayout from '../../layouts/SecurityLayout';
import LoginAction from '../user/login/login'; import LoginAction from '../user/login/login';
...@@ -21,12 +21,14 @@ const industries = [ ...@@ -21,12 +21,14 @@ const industries = [
{ name: '供水', type: '供水', subTitle: 'WATER SUPPLY' }, { name: '供水', type: '供水', subTitle: 'WATER SUPPLY' },
{ name: '农饮水', type: '农饮水', subTitle: 'RURAL POTABLE WATER' }, { name: '农饮水', type: '农饮水', subTitle: 'RURAL POTABLE WATER' },
{ name: '排水', type: '排水', subTitle: 'DRAINAGE' }, { name: '排水', type: '排水', subTitle: 'DRAINAGE' },
{ name: '水利', type: '水利', subTitle: 'WATER CONSERVANCY' },
{ name: '能源', type: '能源', subTitle: 'ENERGY SOURCES' }, { name: '能源', type: '能源', subTitle: 'ENERGY SOURCES' },
{ name: '直饮水', type: '直饮水', subTitle: 'DRINGKING WATER' }, // { name: '直饮水', type: '直饮水', subTitle: 'DRINGKING WATER' },
// { name: '水资源', type: '水资源', subTitle: 'WATER RESOURCES' }, // { name: '水资源', type: '水资源', subTitle: 'WATER RESOURCES' },
{ name: '大数据', type: '大数据', subTitle: 'BIG DATA' }, { name: '大数据', type: '大数据', subTitle: 'BIG DATA' },
{ name: '熊猫智能实验室', type: '实验室', subTitle: 'PANDA AI. LAB' }, { name: '熊猫智能实验室', type: '实验室', subTitle: 'PANDA AI. LAB' },
{ name: '项目案例', type: '项目案例', subTitle: 'PROJECT CASE' }, { name: '项目案例', type: '项目案例', subTitle: 'PROJECT CASE' },
{ name: '熊猫新产品', type: '熊猫新产品', subTitle: "PANDA'S NEW PRODUCT" },
]; ];
const renderIndustries = (config, callback) => const renderIndustries = (config, callback) =>
industries.map(item => { industries.map(item => {
...@@ -38,17 +40,10 @@ const renderIndustries = (config, callback) => ...@@ -38,17 +40,10 @@ const renderIndustries = (config, callback) =>
config.userInfo.Industries.indexOf(item.type) > -1 config.userInfo.Industries.indexOf(item.type) > -1
) { ) {
return ( return (
<li <li className={styles.bootPageLi} key={item.type} onClick={event => callback(event, item.type)}>
className={styles.bootPageLi}
key={item.type}
onClick={event => callback(event, item.type)}
>
<div className={styles.bootPageList}> <div className={styles.bootPageList}>
<div className={styles.listMain}> <div className={styles.listMain}>
<img <img src={require(`../../assets/bootPage/${item.type}.png`)} alt="" />
src={require(`../../assets/bootPage/${item.type}.png`)}
alt=""
/>
<span className={styles.bootPageName}>{item.name}</span> <span className={styles.bootPageName}>{item.name}</span>
<span className={styles.bootPageNameEng}>{item.subTitle}</span> <span className={styles.bootPageNameEng}>{item.subTitle}</span>
</div> </div>
...@@ -112,10 +107,12 @@ const BootPage = props => { ...@@ -112,10 +107,12 @@ const BootPage = props => {
loginAction.events.removeListener('toggleIndustry', handleToggleIndustry); loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
}; };
}, [loginAction.events, props]); }, [loginAction.events, props]);
const renderIndustr = useMemo(
() => renderIndustries(props.global, handlePage), const IndustryNum =
[handlePage, props.global.token], props.global && props.global.userInfo && props.global.userInfo.Industries
); ? props.global.userInfo.Industries.filter(item => !!industries.find(d => d.type === item)).length
: 0;
const renderIndustr = useMemo(() => renderIndustries(props.global, handlePage), [handlePage, props.global.token]);
const intl = useIntl(); const intl = useIntl();
const toOMSUsingAnalysis = e => { const toOMSUsingAnalysis = e => {
...@@ -133,10 +130,7 @@ const BootPage = props => { ...@@ -133,10 +130,7 @@ const BootPage = props => {
}) })
.then(res => { .then(res => {
const roles = res && !res.errMsg ? res.roles : null; const roles = res && !res.errMsg ? res.roles : null;
const _hasRole = const _hasRole = roles && Array.isArray(roles) && roles.filter(r => r.name == '客户运维管理员').length;
roles &&
Array.isArray(roles) &&
roles.filter(r => r.name == '客户运维管理员').length;
setHasRole(!!_hasRole); setHasRole(!!_hasRole);
}); });
}, [props.global.token]); }, [props.global.token]);
...@@ -149,27 +143,18 @@ const BootPage = props => { ...@@ -149,27 +143,18 @@ const BootPage = props => {
{/* eslint-disable-next-line jsx-a11y/alt-text */} {/* eslint-disable-next-line jsx-a11y/alt-text */}
<img src="https://panda-water.cn/web4/assets/images/bootPage/熊猫图标.png" /> <img src="https://panda-water.cn/web4/assets/images/bootPage/熊猫图标.png" />
<div className={styles.bootPageTitle}> <div className={styles.bootPageTitle}>
<span className={styles.bootPageZh}> <span className={styles.bootPageZh}>{intl.formatMessage({ id: 'app.settings.bootpage.title' })}</span>
{intl.formatMessage({ id: 'app.settings.bootpage.title' })} <span className={styles.bootPageEn}>Panda Smart City Monitoring Management Platform & Solution</span>
</span>
<span className={styles.bootPageEn}>
Panda Smart City Monitoring Management Platform & Solution
</span>
</div> </div>
</header> </header>
<section <section
className={classNames( className={classNames(styles.bootPageSection, 'animate__fadeInDown', 'animate__animated', 'duration-500ms')}
styles.bootPageSection, // style={{
'animate__fadeInDown', // width: `${scale < 1 ? 1280 : Math.ceil(1280 * scale)}px`,
'animate__animated', // }}
'duration-500ms',
)}
style={{
width: `${ scale < 1 ? 1280 : Math.ceil(1280 * scale)}px`,
}}
> >
<ul <ul
className={classNames(styles.bootPageUl, 'animate__animated')} className={classNames(styles.bootPageUl, 'animate__animated', styles[`bootPageUl_${IndustryNum}`])}
style={{ style={{
transform: `scale(${scale})`, transform: `scale(${scale})`,
left: '300px', left: '300px',
...@@ -186,10 +171,7 @@ const BootPage = props => { ...@@ -186,10 +171,7 @@ const BootPage = props => {
</div> </div>
{hasRole ? ( {hasRole ? (
<div className={styles.cloudMonitorBtns}> <div className={styles.cloudMonitorBtns}>
<div <div className="cloud-using-anaylysis-btn" onClick={toOMSUsingAnalysis}>
className="cloud-using-anaylysis-btn"
onClick={toOMSUsingAnalysis}
>
<img src={usingIcon} alt="" title="点击查看平台使用监控" /> <img src={usingIcon} alt="" title="点击查看平台使用监控" />
<span>平台使用分析</span> <span>平台使用分析</span>
</div> </div>
......
...@@ -116,6 +116,12 @@ ...@@ -116,6 +116,12 @@
} }
} }
} }
&.bootPageUl_5 {
width: 960px;
}
&.bootPageUl_9 {
width: 1600px;
}
} }
} }
} }
......
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