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,9 +176,6 @@ const BootPage = props => { ...@@ -177,9 +176,6 @@ const BootPage = props => {
return ( return (
<> <>
{pattern ? (
<Demonstration setPattern={setPattern} />
) : (
<div className={styles.bootPage}> <div className={styles.bootPage}>
<div className={styles.b_top_l}> <div className={styles.b_top_l}>
<div className={styles.b_top_l_btn} onClick={() => setPattern(true)}> <div className={styles.b_top_l_btn} onClick={() => setPattern(true)}>
...@@ -196,12 +192,7 @@ const BootPage = props => { ...@@ -196,12 +192,7 @@ const BootPage = props => {
</div> </div>
</header> </header>
<section <section
className={classNames( className={classNames(styles.bootPageSection, 'animate__fadeInDown', 'animate__animated', 'duration-500ms')}
styles.bootPageSection,
'animate__fadeInDown',
'animate__animated',
'duration-500ms',
)}
// style={{ // style={{
// width: `${scale < 1 ? 1280 : Math.ceil(1280 * scale)}px`, // width: `${scale < 1 ? 1280 : Math.ceil(1280 * scale)}px`,
// }} // }}
...@@ -274,7 +265,6 @@ const BootPage = props => { ...@@ -274,7 +265,6 @@ const BootPage = props => {
</div> </div>
) : null} ) : null}
</div> </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