Commit 3bcbac2d authored by 邓晓峰's avatar 邓晓峰

fix: 修复登录BUG

parent b72c6572
Pipeline #39771 passed with stages
in 14 minutes 22 seconds
......@@ -14,6 +14,7 @@ import 'sanitize.css/sanitize.css';
import React from 'react';
import ReactDOM from 'react-dom';
import { event } from 'microser-data';
import _ from 'lodash';
import { Button, ConfigProvider, message, notification } from 'antd';
import { ConnectedRouter } from 'connected-react-router/immutable';
import Immutable from 'immutable';
......@@ -117,9 +118,10 @@ const initGlobalConfig = () => {
}
});
// eslint-disable-next-line react-hooks/rules-of-hooks
const client = !_.isNull(params.getParams('client')) ? params.getParams('client') : Cookies.get('city') ? Cookies.get('city'): 'city';
appService
.queryConfig({
client: Cookies.get('city') || params.getParams('client'),
client: client,
})
.then(res => {
if (res) {
......@@ -128,7 +130,7 @@ const initGlobalConfig = () => {
if (!data.client) {
data.client = params.getParams('client') || 'city';
}
Cookies.set('city', data.client);
// Cookies.set('city', data.client);
store.dispatch(
actionCreators.getConfig(
Object.assign({}, window.globalConfig, data),
......
......@@ -7,6 +7,7 @@ import styles from './min.less';
const Categories = props => {
const [currentIndex, setCurrentIndex] = useState(props.currentMenuIndex);
const selectCategories = (event, index) => {
debugger
event.preventDefault();
event.stopPropagation();
event.nativeEvent.stopImmediatePropagation();
......@@ -18,7 +19,7 @@ const Categories = props => {
<div className={classNames(styles['menu-categories'], {
[styles['min-cateorites']]: props.mode
})}>
{(props.data || []).map((item, index) => {
{(props.data || []).filter(item => !item.hideInMenu).map((item, index) => {
const categorieCls = classNames(
styles['categorie-name'],
styles.btn,
......@@ -35,7 +36,8 @@ const Categories = props => {
<span>{item.extData.label}</span>
</div>
);
})}
})
}
</div>
);
};
......
......@@ -268,7 +268,10 @@ const BasicLayout = props => {
const basename = getBaseName();
const history = useHistory();
let currentRoutes = props.route.routes[props.currentMenuIndex]
// 处理隐藏菜单
let currentRoutes = props.route.routes.filter(item => !item.hideInMenu)[props.currentMenuIndex];
//props.currentMenuIndex
useEffect(() => {
const initSelectRoute = findPathByLeafId(
`${props.location && props.location.pathname || ''}`,
......@@ -305,6 +308,10 @@ const BasicLayout = props => {
])
}
}, []);
useEffect(() => {
console.log(props.route.routes);
}, [props.currentMenuIndex]);
window.share && window.share.event && window.share.event.on('event:updateCurrentChildrenRoutes', ({currentPath, currentRoute, selectedIndex}) => {
currentRoute && currentRoute.parent && currentRoute.parent.routes ? setChildrenRoutes(currentRoute.parent.routes): !currentRoute.parent ? setChildrenRoutes(currentRoute.routes): setChildrenRoutes([currentRoute]);
setSelectIndex(selectedIndex);
......@@ -419,6 +426,7 @@ const BasicLayout = props => {
}
const handleUpdateCurrentIndex = index => {
debugger
setSelectIndex(-1)
props.updateCurrentIndex(index);
window.share && window.share.event.emit('trigger:updateMenuIndex', index);
......
......@@ -754,7 +754,10 @@ class Login {
if(response.access_token!== "") {
self.globalConfig.access_token = response.access_token;
localStorage.setItem('access_token', response.access_token);
Cookies.set('city', self.globalConfig.client)
Cookies.set('city', self.globalConfig.client, {
expires: exp / (24 * 60 * 60 * 1000),
path: '/',
})
}
if (isRememberPWD) {
Cookies.set('city', self.globalConfig.client, {
......
......@@ -35,7 +35,7 @@ export const dyRoutes = routes => {
{
path: '/commonmenu',
component: CommonMenu,
name: 'commonmenu'
name: '菜单收藏'
},
{
path: '/404',
......
......@@ -102,7 +102,8 @@ const generRotes = (widgets, parent, level = 0) => {
href: url,
target: isURL(url) ? '_blank' : '',
key: guid('panda'),
hideInMenu: l > 3 ? true: item.hideInMenu || false,
hideInMenu: item.label === '系统菜单组' ? true: item.hideInMenu,
//l > 3 ? true: item.hideInMenu || false,
alias: item.product || DEFAULT_APPLICATION,
extData: {
...item,
......
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