Commit 1fc14c54 authored by 周宏民's avatar 周宏民

fix: 修改演示功能入口

parent 30946ab0
...@@ -19,6 +19,7 @@ import { actionCreators } from '@/containers/App/store'; ...@@ -19,6 +19,7 @@ import { actionCreators } from '@/containers/App/store';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import LoginAction from '@/pages/user/login/login'; import LoginAction from '@/pages/user/login/login';
import classNames from 'classnames'; import classNames from 'classnames';
import { defaultApp } from '@/micro';
import useFullScreen from './components/useFullScreen'; import useFullScreen from './components/useFullScreen';
import styles from './index.less'; import styles from './index.less';
import LeftItem from './components/Left'; import LeftItem from './components/Left';
...@@ -26,7 +27,6 @@ import VideoItem from './components/VideoItem'; ...@@ -26,7 +27,6 @@ import VideoItem from './components/VideoItem';
import RightItem from './components/Right'; import RightItem from './components/Right';
import BottomItem from './components/Bottom'; import BottomItem from './components/Bottom';
import { platformData } from './components/configData'; import { platformData } from './components/configData';
const boxWidth = 1920; const boxWidth = 1920;
const boxHeight = 911; const boxHeight = 911;
const projectType = ['供水', '排水', '能源', '水利']; const projectType = ['供水', '排水', '能源', '水利'];
...@@ -34,6 +34,7 @@ const Demonstration = props => { ...@@ -34,6 +34,7 @@ const Demonstration = props => {
const onLineUrl = window.globalConfig?.mainserver || 'https://panda-water.cn/'; const onLineUrl = window.globalConfig?.mainserver || 'https://panda-water.cn/';
const showFullScreen = true; const showFullScreen = true;
const videoRef = useRef(null); const videoRef = useRef(null);
const [loginAction, setAction] = useState(() => new LoginAction(props));
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [jumpLoading, setJumpLoading] = useState(false); const [jumpLoading, setJumpLoading] = useState(false);
const [selectKey, setSelectKey] = useState('供水产品'); const [selectKey, setSelectKey] = useState('供水产品');
...@@ -77,13 +78,13 @@ const Demonstration = props => { ...@@ -77,13 +78,13 @@ const Demonstration = props => {
config.widgets = []; config.widgets = [];
config.allWidgets = []; config.allWidgets = [];
props.instance && props.instance.updateConfig(config); props.instance && props.instance.updateConfig(config);
const loginAction = new LoginAction({ ...props, global: config });
loginAction && loginAction.getUserInfoAndConfig(failCallback, true, type); loginAction && loginAction.getUserInfoAndConfig(failCallback, true, type);
}; };
const updateConfig = (config, data) => { const updateConfig = (config, data) => {
// props.instance && props.instance.updateConfig(config);
props.updateConfig && props.updateConfig(config); props.updateConfig && props.updateConfig(config);
const loginAction = new LoginAction({ ...props, global: config }); const newLoginAction = new LoginAction({ ...props, global: config });
loginAction && loginAction.getUserInfoAndConfig(failCallback, true, data.industry); newLoginAction && newLoginAction.getUserInfoAndConfig(failCallback, true, data.industry);
}; };
// 新产品跳转 // 新产品跳转
...@@ -295,6 +296,17 @@ const Demonstration = props => { ...@@ -295,6 +296,17 @@ const Demonstration = props => {
setLoading(false); setLoading(false);
}); });
}; };
useEffect(() => {
const handleToggleIndustry = event => {
props.history && props.history.push(`/?client=${props.global.client}`);
props.updateCurrentIndex(0);
defaultApp();
};
window.share.event.on('toggleIndustry', handleToggleIndustry);
return () => {
window.share.event.removeListener('toggleIndustry', handleToggleIndustry);
};
}, [props]);
useEffect(() => { useEffect(() => {
getData(); getData();
window.addEventListener('resize', debounce(onResize, 300)); window.addEventListener('resize', debounce(onResize, 300));
......
...@@ -5,15 +5,14 @@ import { appService } from '@/api'; ...@@ -5,15 +5,14 @@ import { appService } from '@/api';
import { SERVICE_INTERFACE_SUCCESS_CODE } from '@/constants'; import { SERVICE_INTERFACE_SUCCESS_CODE } from '@/constants';
import PandaBootPage from './panda'; import PandaBootPage from './panda';
import IntegrationPage from './integration'; import IntegrationPage from './integration';
import Demonstration from './demonstration';
const systemItemName = '引导页模板'; // 系统配置项名称 const systemItemName = '引导页模板'; // 系统配置项名称
const BootPageTemplate = { const BootPageTemplate = {
default: PandaBootPage, default: PandaBootPage,
integration: IntegrationPage integration: IntegrationPage,
demonstration: Demonstration,
}; };
const BootPage = props => { const BootPage = props => {
const [info, setInfo] = useState({ const [info, setInfo] = useState({
first: true, first: true,
...@@ -21,17 +20,18 @@ const BootPage = props => { ...@@ -21,17 +20,18 @@ const BootPage = props => {
error: false, error: false,
}); });
const [template, setTemplate] = useState('default'); const [template, setTemplate] = useState('default');
const [pattern, setPattern] = useState(true); // 是否进入演示模式
const RenderComponent = useMemo(() => { const RenderComponent = useMemo(() => {
if (window?.globalConfig?.isIntegration >= 1) { if (window?.globalConfig?.isIntegration >= 1) {
//集成登录 // 集成登录
return BootPageTemplate.integration return BootPageTemplate.integration;
} else { }
//云平台 if (pattern && template !== 'integration') {
return BootPageTemplate[template] || BootPageTemplate.default return BootPageTemplate.demonstration;
} }
}, [template]); // 云平台
return BootPageTemplate[template] || BootPageTemplate.default;
}, [template, pattern]);
useEffect(() => { useEffect(() => {
if (window?.globalConfig?.isIntegration >= 1) { if (window?.globalConfig?.isIntegration >= 1) {
...@@ -61,7 +61,9 @@ const BootPage = props => { ...@@ -61,7 +61,9 @@ const BootPage = props => {
}, []); }, []);
return ( return (
<SecurityLayout>{info.loading ? <Spin /> : info.error ? <Empty /> : <RenderComponent {...props} />}</SecurityLayout> <SecurityLayout>
{info.loading ? <Spin /> : info.error ? <Empty /> : <RenderComponent setPattern={setPattern} {...props} />}
</SecurityLayout>
); );
}; };
......
...@@ -17,7 +17,6 @@ import { defaultApp } from '@/micro'; ...@@ -17,7 +17,6 @@ import { defaultApp } from '@/micro';
import usingIcon from '@/assets/bootPage/using-icon.png'; import usingIcon from '@/assets/bootPage/using-icon.png';
import { appService } from '@/api'; import { appService } from '@/api';
import styles from './index.less'; import styles from './index.less';
import Demonstration from '../demonstration';
const industries = [ const industries = [
{ name: '供水', type: '供水', subTitle: 'WATER SUPPLY', color: 'rgb(16,104,239)' }, { name: '供水', type: '供水', subTitle: 'WATER SUPPLY', color: 'rgb(16,104,239)' },
{ name: '农饮水', type: '农饮水', subTitle: 'RURAL POTABLE WATER', color: 'rgb(4,142,101)' }, { name: '农饮水', type: '农饮水', subTitle: 'RURAL POTABLE WATER', color: 'rgb(4,142,101)' },
...@@ -36,6 +35,7 @@ const industries = [ ...@@ -36,6 +35,7 @@ const industries = [
const BootPage = props => { const BootPage = props => {
const dataRef = useRef(); const dataRef = useRef();
const process = useRef(); const process = useRef();
const { setPattern } = props;
const [Industries] = useState(props.global.userInfo.Industries); const [Industries] = useState(props.global.userInfo.Industries);
const [percentBottom, setPercentBottom] = useState(-40); const [percentBottom, setPercentBottom] = useState(-40);
const [percentNum, setPercentNum] = useState(0); const [percentNum, setPercentNum] = useState(0);
...@@ -45,7 +45,6 @@ const BootPage = props => { ...@@ -45,7 +45,6 @@ const BootPage = props => {
const [scale, setScale] = useState(1); const [scale, setScale] = useState(1);
const [loginAction, setAction] = useState(() => new LoginAction(props)); const [loginAction, setAction] = useState(() => new LoginAction(props));
const [num] = useState(Industries.filter(item => !!industries.find(d => d.type === item)).length); const [num] = useState(Industries.filter(item => !!industries.find(d => d.type === item)).length);
const [pattern, setPattern] = useState(true); // 是否进入演示模式
// const history = useHistory(); // const history = useHistory();
useDocumentTitle( useDocumentTitle(
{ title: defaultSetting.title, id: '', pageName: '行业切换' }, { title: defaultSetting.title, id: '', pageName: '行业切换' },
...@@ -177,104 +176,95 @@ const BootPage = props => { ...@@ -177,104 +176,95 @@ const BootPage = props => {
return ( return (
<> <>
{pattern ? ( <div className={styles.bootPage}>
<Demonstration setPattern={setPattern} /> <div className={styles.b_top_l}>
) : ( <div className={styles.b_top_l_btn} onClick={() => setPattern(true)}>
<div className={styles.bootPage}> <img src={enterImg} alt="" /> 进入演示模式 <RightOutlined />
<div className={styles.b_top_l}>
<div className={styles.b_top_l_btn} onClick={() => setPattern(true)}>
<img src={enterImg} alt="" /> 进入演示模式 <RightOutlined />
</div>
</div> </div>
<div className={styles.bootPageMain}> </div>
<header className={styles.bootPageHead}> <div className={styles.bootPageMain}>
{/* eslint-disable-next-line jsx-a11y/alt-text */} <header className={styles.bootPageHead}>
<img src="https://panda-water.cn/web4/assets/images/bootPage/熊猫图标.png" /> {/* eslint-disable-next-line jsx-a11y/alt-text */}
<div className={styles.bootPageTitle}> <img src="https://panda-water.cn/web4/assets/images/bootPage/熊猫图标.png" />
<span className={styles.bootPageZh}>熊猫智慧水务一体化解决方案</span> <div className={styles.bootPageTitle}>
<span className={styles.bootPageEn}>Panda Smart Water Integration Platform & Solution</span> <span className={styles.bootPageZh}>熊猫智慧水务一体化解决方案</span>
</div> <span className={styles.bootPageEn}>Panda Smart Water Integration Platform & Solution</span>
</header> </div>
<section </header>
className={classNames( <section
styles.bootPageSection, className={classNames(styles.bootPageSection, 'animate__fadeInDown', 'animate__animated', 'duration-500ms')}
'animate__fadeInDown', // style={{
'animate__animated', // width: `${scale < 1 ? 1280 : Math.ceil(1280 * scale)}px`,
'duration-500ms', // }}
)} >
// style={{ <ul
// width: `${scale < 1 ? 1280 : Math.ceil(1280 * scale)}px`, className={classNames(styles.bootPageUl, 'animate__animated')}
// }} style={{
transform: `scale(${scale})`,
left: '300px',
bottom: '105px',
opacity: 1,
width: num === 5 ? 960 : num === 9 || num === 10 ? 1600 : 1280,
}}
> >
<ul {industries.map(
className={classNames(styles.bootPageUl, 'animate__animated')} item =>
style={{ props.global &&
transform: `scale(${scale})`, Industries.indexOf(item.type) > -1 && (
left: '300px', <li
bottom: '105px', className={styles.bootPageLi}
opacity: 1, key={item.type}
width: num === 5 ? 960 : num === 9 || num === 10 ? 1600 : 1280, onClick={event => handlePage(event, item.type, loginAction)}
}} >
> <div className={styles.bootPageList}>
{industries.map( <div className={styles.listMain}>
item => <img src={require(`@/assets/bootPage/${item.type}.png`)} alt="" />
props.global && <span className={styles.bootPageName}>{item.name}</span>
Industries.indexOf(item.type) > -1 && ( <span className={styles.bootPageNameEng}>{item.subTitle}</span>
<li
className={styles.bootPageLi}
key={item.type}
onClick={event => handlePage(event, item.type, loginAction)}
>
<div className={styles.bootPageList}>
<div className={styles.listMain}>
<img src={require(`@/assets/bootPage/${item.type}.png`)} alt="" />
<span className={styles.bootPageName}>{item.name}</span>
<span className={styles.bootPageNameEng}>{item.subTitle}</span>
</div>
</div> </div>
{currentType === item.type && ( </div>
<div className={styles.bootProgress}> {currentType === item.type && (
<div className={styles.inner} style={{ bottom: percentBottom }}> <div className={styles.bootProgress}>
<svg <div className={styles.inner} style={{ bottom: percentBottom }}>
className={styles.wave} <svg
xmlns="http://www.w3.org/2000/svg" className={styles.wave}
xmlnsXlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"
viewBox="0 24 150 68" xmlnsXlink="http://www.w3.org/1999/xlink"
preserveAspectRatio="none" viewBox="0 24 150 68"
> preserveAspectRatio="none"
<defs> >
<path <defs>
id="gentle-wave" <path
d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z" id="gentle-wave"
/> d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z"
</defs> />
<g className={styles.parallax}> </defs>
<use xlinkHref="#gentle-wave" x="50" y="0" fill={item.color} opacity="0.1" /> <g className={styles.parallax}>
<use xlinkHref="#gentle-wave" x="50" y="-1" fill={item.color} opacity="0.2" /> <use xlinkHref="#gentle-wave" x="50" y="0" fill={item.color} opacity="0.1" />
</g> <use xlinkHref="#gentle-wave" x="50" y="-1" fill={item.color} opacity="0.2" />
</svg> </g>
</div> </svg>
</div> </div>
)} </div>
</li> )}
), </li>
)} ),
</ul> )}
</section> </ul>
{/* <Space className={styles.abs}> */} </section>
{/* <Spin spinning={loadding} size="large" /> */} {/* <Space className={styles.abs}> */}
{/* </Space> */} {/* <Spin spinning={loadding} size="large" /> */}
</div> {/* </Space> */}
{hasRole ? (
<div className={styles.cloudMonitorBtns}>
<div className="cloud-using-anaylysis-btn" onClick={toOMSUsingAnalysis}>
<img src={usingIcon} alt="" title="点击查看平台使用监控" />
<span>平台使用分析</span>
</div>
</div>
) : null}
</div> </div>
)} {hasRole ? (
<div className={styles.cloudMonitorBtns}>
<div className="cloud-using-anaylysis-btn" onClick={toOMSUsingAnalysis}>
<img src={usingIcon} alt="" title="点击查看平台使用监控" />
<span>平台使用分析</span>
</div>
</div>
) : null}
</div>
</> </>
); );
}; };
......
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