Commit 0a59db82 authored by 杨思琦's avatar 杨思琦

过渡页修改

parent 05d8b13f
Pipeline #88023 passed with stages
...@@ -117,9 +117,9 @@ ...@@ -117,9 +117,9 @@
"@wisdom-map/arcgismap": "1.4.0-300", "@wisdom-map/arcgismap": "1.4.0-300",
"@wisdom-map/basemap": "1.1.0-41", "@wisdom-map/basemap": "1.1.0-41",
"@wisdom-map/util": "1.2.9", "@wisdom-map/util": "1.2.9",
"@wisdom-utils/components": "0.1.358", "@wisdom-utils/components": "0.1.359",
"@wisdom-utils/runtime": "0.0.48", "@wisdom-utils/runtime": "0.0.48",
"@wisdom-utils/utils": "0.1.398", "@wisdom-utils/utils": "0.1.399",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"antd": "4.21.2", "antd": "4.21.2",
"bcryptjs": "2.4.3", "bcryptjs": "2.4.3",
......
...@@ -145,7 +145,7 @@ const appReducer = (state = initialState, action) => { ...@@ -145,7 +145,7 @@ const appReducer = (state = initialState, action) => {
if (home) { if (home) {
const parent = home.level >= 2 ? home.parent.parent : home.level >= 3 ? home.parent.parent.parent : home.parent; const parent = home.level >= 2 ? home.parent.parent : home.level >= 3 ? home.parent.parent.parent : home.parent;
if (parent) { if (parent) {
currentMenuIndex = generMenu.findIndex(item => item.name === parent.label); currentMenuIndex = generMenu.findIndex(item => item.name === parent.label) || 0;
sessionStorage.setItem(currentProduct, currentMenuIndex) sessionStorage.setItem(currentProduct, currentMenuIndex)
store.set('updateMenuIndex', currentMenuIndex); store.set('updateMenuIndex', currentMenuIndex);
} }
...@@ -205,7 +205,7 @@ const appReducer = (state = initialState, action) => { ...@@ -205,7 +205,7 @@ const appReducer = (state = initialState, action) => {
const currentProductNew = `__global__recent_productIndex__micro_${window.location.hostname}_${sessionStorage.getItem('client') || window.globalConfig?.client || 'city'}`; const currentProductNew = `__global__recent_productIndex__micro_${window.location.hostname}_${sessionStorage.getItem('client') || window.globalConfig?.client || 'city'}`;
sessionStorage.setItem(currentProductNew, action.data) sessionStorage.setItem(currentProductNew, action.data)
return state.merge({ return state.merge({
currentMenuIndex: Number(sessionStorage.getItem(currentProductNew)), currentMenuIndex: Number(sessionStorage.getItem(currentProductNew)) || 0,
}); });
case SLIDER_MENU_MODE: case SLIDER_MENU_MODE:
return state.merge({ return state.merge({
...@@ -247,7 +247,7 @@ const appReducer = (state = initialState, action) => { ...@@ -247,7 +247,7 @@ const appReducer = (state = initialState, action) => {
event.emit('event: application-logout', action.data); event.emit('event: application-logout', action.data);
return state.merge({ return state.merge({
complexConfig: action.data.complexConfig, complexConfig: action.data.complexConfig,
currentMenuIndex: action.data.currentMenuIndex, currentMenuIndex: action.data.currentMenuIndex || 0,
globalConfig: action.data.globalConfig, globalConfig: action.data.globalConfig,
}); });
case MAP_VIEW: case MAP_VIEW:
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { actionCreators } from '@/containers/App/store'; import { actionCreators } from '@/containers/App/store';
import Cookies from 'js-cookie';
import _ from 'lodash';
import { useHistory, useAliveController } from '@wisdom-utils/runtime';
import classNames from 'classnames'; import classNames from 'classnames';
import styles from './index.less'; import styles from './index.less';
import bgImage from './images/背景.png'; import bgImage from './images/背景.png';
...@@ -14,7 +17,9 @@ import SecurityLayout from '../SecurityLayout'; ...@@ -14,7 +17,9 @@ import SecurityLayout from '../SecurityLayout';
import { defaultApp } from '../../micro'; import { defaultApp } from '../../micro';
const HomePage = props => { const HomePage = props => {
const { global: globalConfig, updateConfig } = props || {}; const { clear } = useAliveController();
const history = useHistory();
const { global: globalConfig } = props || {};
const { transitionPage = {}, title } = globalConfig; const { transitionPage = {}, title } = globalConfig;
const { title: name = '', content: industries = [], background = null, icon } = transitionPage; const { title: name = '', content: industries = [], background = null, icon } = transitionPage;
const [scale, setScale] = useState(1); const [scale, setScale] = useState(1);
...@@ -25,6 +30,23 @@ const HomePage = props => { ...@@ -25,6 +30,23 @@ const HomePage = props => {
const scale = width / 1920; const scale = width / 1920;
setScale(scale); setScale(scale);
}; };
useEffect(() => {
const tk = Cookies.get('token') || props.global.token;
const isLogin = tk !== null && tk !== 'undefined' && tk !== void 0;
let client = props?.global?.client || sessionStorage.getItem('client') || null;
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city';
// eslint-disable-next-line no-prototype-builtins
let generateType = props.global && props.global.hasOwnProperty('get') ? props.global.get('generateType') : null;
generateType =
!_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined'
? `&generateType=${generateType}`
: '';
if (!isLogin) {
history.push(`/user/login?client=${client}${generateType}`, { reload: true });
clear();
props.logout();
}
}, [clear, history, props, props.global]);
useEffect(() => { useEffect(() => {
handleResize(); handleResize();
}, []); }, []);
...@@ -152,6 +174,9 @@ const mapDispatchToProps = dispatch => ({ ...@@ -152,6 +174,9 @@ const mapDispatchToProps = dispatch => ({
updateCurrentSystem(index) { updateCurrentSystem(index) {
dispatch(actionCreators.updateCurrentSystem(index)); dispatch(actionCreators.updateCurrentSystem(index));
}, },
logout() {
dispatch(actionCreators.logout());
},
}); });
export default connect( export default connect(
mapStateToProps, mapStateToProps,
......
...@@ -728,19 +728,21 @@ class Login { ...@@ -728,19 +728,21 @@ class Login {
...res.data, ...res.data,
content: [], content: [],
}; };
allWidgets.forEach((item, index) => { allWidgets.forEach(item => {
const page = res.data.content[index]; res.data.content.forEach &&
if (page) { res.data.content.forEach(content => {
transitionPage.content.push({ if (content.name === item.label) {
name: item.label, transitionPage.content.push({
subTitle: page.alias, name: item.label,
image: page.icon, subTitle: content.alias,
icon: image: content.icon,
item.icon?.indexOf('CityTemp') > -1 icon:
? `${window.location.origin}/${item.icon}` item.icon?.indexOf('CityTemp') > -1
: `${window.location.origin}/civweb4/${item.icon}`, ? `${window.location.origin}/${item.icon}`
: `${window.location.origin}/civweb4/${item.icon}`,
});
}
}); });
}
}); });
self.globalConfig.transitionPage = transitionPage; self.globalConfig.transitionPage = transitionPage;
self.updateConfig && self.updateConfig(self.globalConfig); self.updateConfig && self.updateConfig(self.globalConfig);
......
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