| @@ -5,8 +5,8 @@ | |||
| <link rel="icon" type="image/svg+xml" href="/logo_1.jpg" /> | |||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |||
| <title>后台管理系统</title> | |||
| <script type="module" crossorigin src="/assets/index-eXGpzddQ.js"></script> | |||
| <link rel="stylesheet" crossorigin href="/assets/index-rOTXzbDU.css"> | |||
| <script type="module" crossorigin src="/assets/index-XPjI18tg.js"></script> | |||
| <link rel="stylesheet" crossorigin href="/assets/index-T7d3tWJo.css"> | |||
| </head> | |||
| <body> | |||
| <div id="app"></div> | |||
| @@ -2428,9 +2428,9 @@ | |||
| } | |||
| }, | |||
| "node_modules/postcss": { | |||
| "version": "8.4.32", | |||
| "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz", | |||
| "integrity": "sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==", | |||
| "version": "8.4.35", | |||
| "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", | |||
| "integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==", | |||
| "funding": [ | |||
| { | |||
| "type": "opencollective", | |||
| @@ -2936,13 +2936,13 @@ | |||
| } | |||
| }, | |||
| "node_modules/vite": { | |||
| "version": "5.0.4", | |||
| "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.4.tgz", | |||
| "integrity": "sha512-RzAr8LSvM8lmhB4tQ5OPcBhpjOZRZjuxv9zO5UcxeoY2bd3kP3Ticd40Qma9/BqZ8JS96Ll/jeBX9u+LJZrhVg==", | |||
| "version": "5.1.5", | |||
| "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.5.tgz", | |||
| "integrity": "sha512-BdN1xh0Of/oQafhU+FvopafUp6WaYenLU/NFoL5WyJL++GxkNfieKzBhM24H3HVsPQrlAqB7iJYTHabzaRed5Q==", | |||
| "dev": true, | |||
| "dependencies": { | |||
| "esbuild": "^0.19.3", | |||
| "postcss": "^8.4.31", | |||
| "postcss": "^8.4.35", | |||
| "rollup": "^4.2.0" | |||
| }, | |||
| "bin": { | |||
| @@ -4900,9 +4900,9 @@ | |||
| "optional": true | |||
| }, | |||
| "postcss": { | |||
| "version": "8.4.32", | |||
| "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz", | |||
| "integrity": "sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==", | |||
| "version": "8.4.35", | |||
| "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", | |||
| "integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==", | |||
| "requires": { | |||
| "nanoid": "^3.3.7", | |||
| "picocolors": "^1.0.0", | |||
| @@ -5257,14 +5257,14 @@ | |||
| } | |||
| }, | |||
| "vite": { | |||
| "version": "5.0.4", | |||
| "resolved": "https://registry.npmjs.org/vite/-/vite-5.0.4.tgz", | |||
| "integrity": "sha512-RzAr8LSvM8lmhB4tQ5OPcBhpjOZRZjuxv9zO5UcxeoY2bd3kP3Ticd40Qma9/BqZ8JS96Ll/jeBX9u+LJZrhVg==", | |||
| "version": "5.1.5", | |||
| "resolved": "https://registry.npmjs.org/vite/-/vite-5.1.5.tgz", | |||
| "integrity": "sha512-BdN1xh0Of/oQafhU+FvopafUp6WaYenLU/NFoL5WyJL++GxkNfieKzBhM24H3HVsPQrlAqB7iJYTHabzaRed5Q==", | |||
| "dev": true, | |||
| "requires": { | |||
| "esbuild": "^0.19.3", | |||
| "fsevents": "~2.3.3", | |||
| "postcss": "^8.4.31", | |||
| "postcss": "^8.4.35", | |||
| "rollup": "^4.2.0" | |||
| } | |||
| }, | |||
| @@ -2,12 +2,12 @@ | |||
| <a-menu mode="inline" v-model:openKeys="openSubMenu" @openChange="onOpenChange" inlineCollapsed | |||
| v-model:selectedKeys="selectedMenu" style="background: #19be6b; height: '90vh';color: #fff;"> | |||
| <template v-for="(item,index) in menuList"> | |||
| <template v-if="!item.childs"> | |||
| <template v-if="!item.children"> | |||
| <a-menu-item :key="item.path" @click="onMenu(item.path)"> | |||
| <template #icon> | |||
| <!-- <component :is="item"></component> --> | |||
| </template> | |||
| <span>{{item.name}}</span> | |||
| <span>{{item.meta.title}}</span> | |||
| </a-menu-item> | |||
| </template> | |||
| <template v-else> | |||
| @@ -15,17 +15,17 @@ | |||
| <template #icon> | |||
| <!-- <component :is="item"></component> --> | |||
| </template> | |||
| <template #title>{{item.name}}</template> | |||
| <template v-for="(twoItem, twoIndex) in item.childs"> | |||
| <a-sub-menu v-if="twoItem.childs" :key="twoItem.path"> | |||
| <template #title>{{item.meta.title}}</template> | |||
| <template v-for="(twoItem, twoIndex) in item.children"> | |||
| <a-sub-menu v-if="twoItem.children.length > 0" :key="twoItem.path"> | |||
| <template #title> | |||
| {{twoItem.name}} | |||
| {{twoItem.meta.title}} | |||
| </template> | |||
| <a-menu-item v-for="(threeItem, threeIndex) in twoItem.childs" :key="threeItem.path" | |||
| @click="onMenu(threeItem.path)">{{ threeItem.name }}</a-menu-item> | |||
| <a-menu-item v-for="(threeItem, threeIndex) in twoItem.children" :key="threeItem.path" | |||
| @click="onMenu(threeItem.path)">{{ threeItem.meta.title }}</a-menu-item> | |||
| </a-sub-menu> | |||
| <a-menu-item v-else @click="onMenu(twoItem.path)" :key="twoItem.path"> | |||
| {{ twoItem.name }} | |||
| {{ twoItem.meta.title }} | |||
| </a-menu-item> | |||
| </template> | |||
| </a-sub-menu> | |||
| @@ -37,7 +37,7 @@ | |||
| import { ref, onMounted, computed } from 'vue'; | |||
| import { useMenu } from '@/hooks/useMenu'; | |||
| let { menuList, onMenu, routerCur, routerArrayCur } = useMenu(); | |||
| console.log(menuList) | |||
| const selectedMenu = computed(() => { | |||
| let newSelectedMenu = [routerCur()]; | |||
| return newSelectedMenu; | |||
| @@ -6,20 +6,28 @@ export const useAsRouter = () => { | |||
| function routerCur() { | |||
| return router.currentRoute.value.path | |||
| } | |||
| // 获取当前路由父路由 | |||
| function routerArrayCur() { | |||
| return router.currentRoute.value.matched[1].path; | |||
| } | |||
| // 跳转路由 | |||
| function routerTo(url : string) { | |||
| router.push(url) | |||
| } | |||
| // 匹配路由页面 | |||
| function routerDynamic(userRouter : string[], originRouter : Object[]) { | |||
| const finalRouter = originRouter.filter(item => userRouter.includes(item.action)).map(item => ({ ...item, childs: item.childs ? routerDynamic(userRouter, item.childs) : null })); | |||
| function routerDynamic(originRouter, actionsArray) { | |||
| const finalRouter = originRouter.filter(item => actionsArray.some(action => action.action === item.name)) | |||
| .map((item) => ({ | |||
| ...item, | |||
| meta: { | |||
| ...item.meta, | |||
| title: actionsArray.find(action => action.action === item.name)?.name || item.meta.title, | |||
| }, | |||
| children: item.children ? routerDynamic(item.children, actionsArray) : [], | |||
| })); | |||
| return finalRouter; | |||
| } | |||
| @@ -21,8 +21,28 @@ import ACSelect from '@/components/cSelect/select.vue'; | |||
| import ACSelectCommon from '@/components/cSelect/common.vue'; | |||
| import UploadOne from '@/components/upload/one.vue'; | |||
| import { Model } from 'node_modules/echarts/index'; | |||
| // router.beforeEach(async (to, from, next) => { | |||
| // document.title = `${to.meta.title} - 菊城人才市场后台管理`; | |||
| // // 动态路由可能还没加载完成,先检查是否已加载 | |||
| // if (store.state.permissions.permissionList == null) { | |||
| // debugger | |||
| // await store.dispatch('permissions/FETCH_PERMISSION'); | |||
| // } | |||
| // // 这里假设有一个isAuth的getter来检查用户是否已登录 | |||
| // if (sessionStorage.getItem('token')) { | |||
| // debugger | |||
| // next(); | |||
| // } else { | |||
| // debugger | |||
| // next('/login'); | |||
| // } | |||
| // }); | |||
| router.beforeEach((to, from, next) => { | |||
| document.title = `${to.meta.title} - 菊城人才市场后台管理`; | |||
| if (!sessionStorage.getItem('token')) { | |||
| if (to.matched.length > 0 && !to.matched.some(record => record.meta.requiresAuth)) { | |||
| next() | |||
| @@ -43,7 +43,7 @@ const actions = { | |||
| }) | |||
| let arr = state.arrresult; | |||
| // let arr = ['permission', 'role', 'account', 'company', 'vip', 'member', 'homemake', 'homemakeType', 'homemakePosition', 'homemakeDemand', 'homemakeAppointment', 'job', 'department', 'jobSeeker', 'jobResume', 'jobFair', 'jobFairList', 'jobFairCompany', 'information', 'section', 'article', 'list', 'putIn', 'advertisementList', 'advertisement', 'activity', 'activityList', 'activityAddress', 'statistics', 'statisticsResume', 'statisticsResumeMajor']; | |||
| let routes = routerDynamic(arr, res.data.menulist); | |||
| let routes = routerDynamic(routesModuleList, arr); | |||
| LayoutRoute.children.push(...routes); | |||
| commit('SET_MENU', LayoutRoute.children); | |||
| routerAdd(LayoutRoute); | |||
| @@ -56,7 +56,7 @@ const actions = { | |||
| }; | |||
| const pushItem = (item : Object) => { | |||
| state.arrresult.push(item.action) | |||
| state.arrresult.push({action:item.action, name:item.name}) | |||
| if (item.childs) { | |||
| for (const child of item.childs) { | |||
| pushItem(child) | |||