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

过渡页修改

parent 05d8b13f
Pipeline #88023 passed with stages
......@@ -117,9 +117,9 @@
"@wisdom-map/arcgismap": "1.4.0-300",
"@wisdom-map/basemap": "1.1.0-41",
"@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/utils": "0.1.398",
"@wisdom-utils/utils": "0.1.399",
"animate.css": "^4.1.1",
"antd": "4.21.2",
"bcryptjs": "2.4.3",
......
......@@ -145,7 +145,7 @@ const appReducer = (state = initialState, action) => {
if (home) {
const parent = home.level >= 2 ? home.parent.parent : home.level >= 3 ? home.parent.parent.parent : home.parent;
if (parent) {
currentMenuIndex = generMenu.findIndex(item => item.name === parent.label);
currentMenuIndex = generMenu.findIndex(item => item.name === parent.label) || 0;
sessionStorage.setItem(currentProduct, currentMenuIndex)
store.set('updateMenuIndex', currentMenuIndex);
}
......@@ -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'}`;
sessionStorage.setItem(currentProductNew, action.data)
return state.merge({
currentMenuIndex: Number(sessionStorage.getItem(currentProductNew)),
currentMenuIndex: Number(sessionStorage.getItem(currentProductNew)) || 0,
});
case SLIDER_MENU_MODE:
return state.merge({
......@@ -247,7 +247,7 @@ const appReducer = (state = initialState, action) => {
event.emit('event: application-logout', action.data);
return state.merge({
complexConfig: action.data.complexConfig,
currentMenuIndex: action.data.currentMenuIndex,
currentMenuIndex: action.data.currentMenuIndex || 0,
globalConfig: action.data.globalConfig,
});
case MAP_VIEW:
......
......@@ -4,6 +4,9 @@
import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux';
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 styles from './index.less';
import bgImage from './images/背景.png';
......@@ -14,7 +17,9 @@ import SecurityLayout from '../SecurityLayout';
import { defaultApp } from '../../micro';
const HomePage = props => {
const { global: globalConfig, updateConfig } = props || {};
const { clear } = useAliveController();
const history = useHistory();
const { global: globalConfig } = props || {};
const { transitionPage = {}, title } = globalConfig;
const { title: name = '', content: industries = [], background = null, icon } = transitionPage;
const [scale, setScale] = useState(1);
......@@ -25,6 +30,23 @@ const HomePage = props => {
const scale = width / 1920;
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(() => {
handleResize();
}, []);
......@@ -152,6 +174,9 @@ const mapDispatchToProps = dispatch => ({
updateCurrentSystem(index) {
dispatch(actionCreators.updateCurrentSystem(index));
},
logout() {
dispatch(actionCreators.logout());
},
});
export default connect(
mapStateToProps,
......
......@@ -728,19 +728,21 @@ class Login {
...res.data,
content: [],
};
allWidgets.forEach((item, index) => {
const page = res.data.content[index];
if (page) {
transitionPage.content.push({
name: item.label,
subTitle: page.alias,
image: page.icon,
icon:
item.icon?.indexOf('CityTemp') > -1
? `${window.location.origin}/${item.icon}`
: `${window.location.origin}/civweb4/${item.icon}`,
allWidgets.forEach(item => {
res.data.content.forEach &&
res.data.content.forEach(content => {
if (content.name === item.label) {
transitionPage.content.push({
name: item.label,
subTitle: content.alias,
image: content.icon,
icon:
item.icon?.indexOf('CityTemp') > -1
? `${window.location.origin}/${item.icon}`
: `${window.location.origin}/civweb4/${item.icon}`,
});
}
});
}
});
self.globalConfig.transitionPage = transitionPage;
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