Commit 8039de4d by 冒粤蓉

fux

1 parent 086a7a41
...@@ -85,6 +85,7 @@ import { useStore } from 'vuex'; ...@@ -85,6 +85,7 @@ import { useStore } from 'vuex';
import MenuService from 'services/Menu'; import MenuService from 'services/Menu';
import { menuTree as menuTreeLocalList } from 'config/menuTree'; import { menuTree as menuTreeLocalList } from 'config/menuTree';
import { Common } from '@/utils/common/common';
export default { export default {
name: 'Menu', name: 'Menu',
...@@ -210,19 +211,27 @@ export default { ...@@ -210,19 +211,27 @@ export default {
curBreadcrumb = JSON.parse(curBreadcrumb); curBreadcrumb = JSON.parse(curBreadcrumb);
} }
// 同步激活样式 // 同步激活样式
resData.forEach((item, index) => { resData.forEach((item) => {
item.showSubList = item.origin.menuName === curBreadcrumb[0].name; const { menuName: pMenuName } = item.origin;
item.showSubList = pMenuName === curBreadcrumb[0].name;
item.children.forEach((cItem, cIndex) => { item.children.forEach((cItem, cIndex) => {
const { frontRoute } = cItem; cItem.subItemActive = false;
cItem.subItemActive = curBreadcrumb[1] ?cItem.origin.menuName === curBreadcrumb[1].name :false; if(cItem.origin.menuName === curBreadcrumb[1].name) {
if(!frontRoute) { cItem.subItemActive = true;
cItem.frontRoute = '/noData'; curBreadcrumb[1].id = cItem.id;
} }
}) })
}); });
// history.pushState(null, thisPath, thisPath); if(isInit && curBreadcrumb) {
// store.dispatch('menu/setBreadCrumb', state.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 => { }, err => {
...@@ -260,7 +269,7 @@ export default { ...@@ -260,7 +269,7 @@ export default {
titleClick, titleClick,
cItemClick, cItemClick,
subMenuClicked, subMenuClicked,
updateMenu, updateMenu
} }
} }
......
import { registerMicroApps, start, addGlobalUncaughtErrorHandler, setDefaultMountApp, initGlobalState } from 'qiankun'; import { registerMicroApps, start, addGlobalUncaughtErrorHandler, setDefaultMountApp, initGlobalState } from 'qiankun';
import store from '@/store'; import store from '@/store';
import router from '@/router'; import router from '@/router';
import { Common as common } from '@/utils/common/common';
// import apps from './apps'; // import apps from './apps';
const showLoading = status => { const showLoading = status => {
...@@ -26,7 +27,8 @@ const qianKunStart = (config, baseURL) => { ...@@ -26,7 +27,8 @@ const qianKunStart = (config, baseURL) => {
data: { data: {
store, store,
router, 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 \ 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!