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

fix: 修改演示功能入口

parent 30946ab0
......@@ -19,6 +19,7 @@ import { actionCreators } from '@/containers/App/store';
import { connect } from 'react-redux';
import LoginAction from '@/pages/user/login/login';
import classNames from 'classnames';
import { defaultApp } from '@/micro';
import useFullScreen from './components/useFullScreen';
import styles from './index.less';
import LeftItem from './components/Left';
......@@ -26,7 +27,6 @@ import VideoItem from './components/VideoItem';
import RightItem from './components/Right';
import BottomItem from './components/Bottom';
import { platformData } from './components/configData';
const boxWidth = 1920;
const boxHeight = 911;
const projectType = ['供水', '排水', '能源', '水利'];
......@@ -34,6 +34,7 @@ const Demonstration = props => {
const onLineUrl = window.globalConfig?.mainserver || 'https://panda-water.cn/';
const showFullScreen = true;
const videoRef = useRef(null);
const [loginAction, setAction] = useState(() => new LoginAction(props));
const [loading, setLoading] = useState(true);
const [jumpLoading, setJumpLoading] = useState(false);
const [selectKey, setSelectKey] = useState('供水产品');
......@@ -77,13 +78,13 @@ const Demonstration = props => {
config.widgets = [];
config.allWidgets = [];
props.instance && props.instance.updateConfig(config);
const loginAction = new LoginAction({ ...props, global: config });
loginAction && loginAction.getUserInfoAndConfig(failCallback, true, type);
};
const updateConfig = (config, data) => {
// props.instance && props.instance.updateConfig(config);
props.updateConfig && props.updateConfig(config);
const loginAction = new LoginAction({ ...props, global: config });
loginAction && loginAction.getUserInfoAndConfig(failCallback, true, data.industry);
const newLoginAction = new LoginAction({ ...props, global: config });
newLoginAction && newLoginAction.getUserInfoAndConfig(failCallback, true, data.industry);
};
// 新产品跳转
......@@ -295,6 +296,17 @@ const Demonstration = props => {
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(() => {
getData();
window.addEventListener('resize', debounce(onResize, 300));
......
......@@ -5,15 +5,14 @@ import { appService } from '@/api';
import { SERVICE_INTERFACE_SUCCESS_CODE } from '@/constants';
import PandaBootPage from './panda';
import IntegrationPage from './integration';
import Demonstration from './demonstration';
const systemItemName = '引导页模板'; // 系统配置项名称
const BootPageTemplate = {
default: PandaBootPage,
integration: IntegrationPage
integration: IntegrationPage,
demonstration: Demonstration,
};
const BootPage = props => {
const [info, setInfo] = useState({
first: true,
......@@ -21,17 +20,18 @@ const BootPage = props => {
error: false,
});
const [template, setTemplate] = useState('default');
const [pattern, setPattern] = useState(true); // 是否进入演示模式
const RenderComponent = useMemo(() => {
if (window?.globalConfig?.isIntegration >= 1) {
//集成登录
return BootPageTemplate.integration
} else {
//云平台
return BootPageTemplate[template] || BootPageTemplate.default
// 集成登录
return BootPageTemplate.integration;
}
if (pattern && template !== 'integration') {
return BootPageTemplate.demonstration;
}
}, [template]);
// 云平台
return BootPageTemplate[template] || BootPageTemplate.default;
}, [template, pattern]);
useEffect(() => {
if (window?.globalConfig?.isIntegration >= 1) {
......@@ -61,7 +61,9 @@ const BootPage = props => {
}, []);
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';
import usingIcon from '@/assets/bootPage/using-icon.png';
import { appService } from '@/api';
import styles from './index.less';
import Demonstration from '../demonstration';
const industries = [
{ name: '供水', type: '供水', subTitle: 'WATER SUPPLY', color: 'rgb(16,104,239)' },
{ name: '农饮水', type: '农饮水', subTitle: 'RURAL POTABLE WATER', color: 'rgb(4,142,101)' },
......@@ -36,6 +35,7 @@ const industries = [
const BootPage = props => {
const dataRef = useRef();
const process = useRef();
const { setPattern } = props;
const [Industries] = useState(props.global.userInfo.Industries);
const [percentBottom, setPercentBottom] = useState(-40);
const [percentNum, setPercentNum] = useState(0);
......@@ -45,7 +45,6 @@ const BootPage = props => {
const [scale, setScale] = useState(1);
const [loginAction, setAction] = useState(() => new LoginAction(props));
const [num] = useState(Industries.filter(item => !!industries.find(d => d.type === item)).length);
const [pattern, setPattern] = useState(true); // 是否进入演示模式
// const history = useHistory();
useDocumentTitle(
{ title: defaultSetting.title, id: '', pageName: '行业切换' },
......@@ -177,9 +176,6 @@ const BootPage = props => {
return (
<>
{pattern ? (
<Demonstration setPattern={setPattern} />
) : (
<div className={styles.bootPage}>
<div className={styles.b_top_l}>
<div className={styles.b_top_l_btn} onClick={() => setPattern(true)}>
......@@ -196,12 +192,7 @@ const BootPage = props => {
</div>
</header>
<section
className={classNames(
styles.bootPageSection,
'animate__fadeInDown',
'animate__animated',
'duration-500ms',
)}
className={classNames(styles.bootPageSection, 'animate__fadeInDown', 'animate__animated', 'duration-500ms')}
// style={{
// width: `${scale < 1 ? 1280 : Math.ceil(1280 * scale)}px`,
// }}
......@@ -274,7 +265,6 @@ const BootPage = props => {
</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