Commit c286dbf1 authored by 邓晓峰's avatar 邓晓峰

feat: 添加常用菜单点击与菜单导航联动

parent 5d0ae1ee
/* eslint-disable */
// const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin;
const proxyURL = 'http://192.168.10.150:8669';
const proxyURL = 'http://172.16.10.152:8666';
module.exports = {
assetsRoot: process.env.NODE_ENV !== 'production' ? proxyURL : './',
dev: {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -153,7 +153,12 @@ const GlobalHeaderRight = props => {
const handlerFavitor = event => {
// setCurrentIndex(1);
history.push('/commonmenu')
history.push('/commonmenu');
window.share && window.share.event && window.share.event.emit('event:favitor', {
name: "常用",
path: '/commonmenu',
icon: <FavitorIcon/>
});
}
const handlerTheme = () => {
......
......@@ -302,11 +302,22 @@ const BasicLayout = props => {
window.share && window.share.event && window.share.event.on('event:updateCurrentChildrenRoutes', ({currentPath, currentRoute, selectedIndex}) => {
currentRoute && currentRoute.parent && currentRoute.parent.routes ? setChildrenRoutes(currentRoute.parent.routes): setChildrenRoutes([currentRoute]);
currentRoute && currentRoute.parent && currentRoute.parent.routes ? setChildrenRoutes(currentRoute.parent.routes): !currentRoute.parent ? setChildrenRoutes(currentRoute.routes): setChildrenRoutes([currentRoute]);
setSelectIndex(selectedIndex);
setTabActiveKey(currentPath)
});
window.share && window.share.event && window.share.event.on('event:favitor', ({icon, name, path}) => {
setChildrenRoutes([
{
icon: <HomeIcon/>,
path: path,
name: name
}
])
})
useEffect(() => {
siteAction.setGlobalConfig(props.global);
if (!Cookies.get('token')) {
......
......@@ -6,7 +6,7 @@ import classnames from 'classnames';
import * as _ from 'lodash';
import PinyinMatch from 'pinyin-match';
import PandaEmpty from '@wisdom-components/empty';
import { actionCreators } from '@/containers/App/store';
import { appService } from '@/api';
import { useHistory } from '@wisdom-utils/runtime';
import { savePagePartInfo } from '@/api/service/base';
......@@ -135,8 +135,20 @@ const CommonMenu = props => {
* @param {*} menu
*/
const linkToMenu = menu => {
const { path } = menu;
console.log("props", props)
const { path, topGroup } = menu;
const currentIndex = props.menus.findIndex(item => item.name === topGroup);
history.push(path);
props.updateCurrentIndex(currentIndex);
let currentRoutes = props.menus[currentIndex] && props.menus[currentIndex].routes;
currentRoutes = currentRoutes.find(item => item.path === path);
window.share && window.share.event.emit('trigger:updateMenuIndex', currentIndex);
window.share && window.share.event && window.share.event.emit('event:updateCurrentChildrenRoutes', {
currentPath: path,
currentRoute: currentRoutes,
selectedIndex: currentIndex
});
};
const mdOk = submitData => {
......@@ -476,8 +488,12 @@ const MenuAddModal = props => {
const mapStateToProps = state => ({
menus: state.getIn(['global', 'menu']),
});
const mapDispatchToProps = dispatch => ({
updateCurrentIndex(index) {
dispatch(actionCreators.updateCurrentIndex(index));
}
});
export default connect(
mapStateToProps,
null,
mapDispatchToProps,
)(CommonMenu);
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