//import { getStore, setStore } from 'hc-vue3-ui' import { getStore, setStore } from '~src/utils/storage' import { deepClone, getArrValue, isNullES } from 'js-fast-way' //import testMenu from './modules/menu' //获取路由菜单 export const getRouterData = async (toName) => { const routes = getArrValue(getStore('routes')) return routes.indexOf(toName) !== -1 } //获取菜单数据 export const getMenuData = async () => { let projectMenu = [], menu = getStore('projectMenu') const testMenu = getStore('menus') for (let i = 0; i < testMenu.length; i++) { if (testMenu[i].code === 'project') { projectMenu = await getProjectChildren(testMenu[i].children) break } } if (isNullES(menu) || menu.length <= 0) { setStore('projectMenu', projectMenu) } return testMenu } //获取项目管理菜单 const getProjectChildren = async (arr) => { const children = getArrValue(arr) for (let i = 0; i < children.length; i++) { if (children[i].code === 'project-collect') { const childrens = children[i].children if (isNullES(childrens)) return [] const newChildren = deepClone(childrens) delete children[i].children return getArrValue(newChildren) } } }