Commit 8039de4d by 冒粤蓉

fux

1 parent 086a7a41
......@@ -85,6 +85,7 @@ import { useStore } from 'vuex';
import MenuService from 'services/Menu';
import { menuTree as menuTreeLocalList } from 'config/menuTree';
import { Common } from '@/utils/common/common';
export default {
name: 'Menu',
......@@ -210,19 +211,27 @@ export default {
curBreadcrumb = JSON.parse(curBreadcrumb);
}
// 同步激活样式
resData.forEach((item, index) => {
item.showSubList = item.origin.menuName === curBreadcrumb[0].name;
resData.forEach((item) => {
const { menuName: pMenuName } = item.origin;
item.showSubList = pMenuName === curBreadcrumb[0].name;
item.children.forEach((cItem, cIndex) => {
const { frontRoute } = cItem;
cItem.subItemActive = curBreadcrumb[1] ?cItem.origin.menuName === curBreadcrumb[1].name :false;
if(!frontRoute) {
cItem.frontRoute = '/noData';
cItem.subItemActive = false;
if(cItem.origin.menuName === curBreadcrumb[1].name) {
cItem.subItemActive = true;
curBreadcrumb[1].id = cItem.id;
}
})
});
// history.pushState(null, thisPath, thisPath);
// store.dispatch('menu/setBreadCrumb', state.curBreadCrumb);
if(isInit && curBreadcrumb) {
let thisBread = curBreadcrumb[curBreadcrumb.length - 1];
let path = thisBread.path || '/noData';
let name = thisBread.name || '';
let id = thisBread.id || '';
name && getMenuAuth(id, name);
history.pushState(null, path, path);
}
}
}, err => {
......@@ -260,7 +269,7 @@ export default {
titleClick,
cItemClick,
subMenuClicked,
updateMenu,
updateMenu
}
}
......
import { registerMicroApps, start, addGlobalUncaughtErrorHandler, setDefaultMountApp, initGlobalState } from 'qiankun';
import store from '@/store';
import router from '@/router';
import { Common as common } from '@/utils/common/common';
// import apps from './apps';
const showLoading = status => {
......@@ -19,14 +20,15 @@ const qianKunStart = (config, baseURL) => {
activeRule: i.activeRule
})
});
// props和container之后也要做动态配置
apps.map(i => {
i.props = {
data: {
store,
router,
baseURL
baseURL,
common
}
}
});
......
import store from '@/store/index';
export const Common = {
setAuthBtn(resData) {
let data = resData || store.getters.curMenuAuth.data;
const authBtnEl = document.getElementsByTagName('button');
const authStringArr = ['新增', '编辑', '删除', '导出', '导入', '修改'];
if(authBtnEl && authBtnEl.length > 0) {
if(data && data.length > 0) {
authBtnEl.forEach(elItem => {
let flag = true;
let authFlag = false;
const elText = elItem.innerText;
authStringArr.forEach(authItem => {
if(elText.includes(authItem)){
authFlag = true;
return;
}
})
if(authFlag) {
data.forEach(labelItem => {
if(flag) {
elItem.style.display = 'none';
if(elText.includes(labelItem.label)) {
elItem.style.display = 'block';
flag = false;
}
}
})
}
});
}
}
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!