| <link rel="icon" type="image/svg+xml" href="/logo_1.jpg" /> | <link rel="icon" type="image/svg+xml" href="/logo_1.jpg" /> | ||||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||||
| <title>后台管理系统</title> | <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> | </head> | ||||
| <body> | <body> | ||||
| <div id="app"></div> | <div id="app"></div> |
| } | } | ||||
| }, | }, | ||||
| "node_modules/postcss": { | "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": [ | "funding": [ | ||||
| { | { | ||||
| "type": "opencollective", | "type": "opencollective", | ||||
| } | } | ||||
| }, | }, | ||||
| "node_modules/vite": { | "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, | "dev": true, | ||||
| "dependencies": { | "dependencies": { | ||||
| "esbuild": "^0.19.3", | "esbuild": "^0.19.3", | ||||
| "postcss": "^8.4.31", | |||||
| "postcss": "^8.4.35", | |||||
| "rollup": "^4.2.0" | "rollup": "^4.2.0" | ||||
| }, | }, | ||||
| "bin": { | "bin": { | ||||
| "optional": true | "optional": true | ||||
| }, | }, | ||||
| "postcss": { | "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": { | "requires": { | ||||
| "nanoid": "^3.3.7", | "nanoid": "^3.3.7", | ||||
| "picocolors": "^1.0.0", | "picocolors": "^1.0.0", | ||||
| } | } | ||||
| }, | }, | ||||
| "vite": { | "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, | "dev": true, | ||||
| "requires": { | "requires": { | ||||
| "esbuild": "^0.19.3", | "esbuild": "^0.19.3", | ||||
| "fsevents": "~2.3.3", | "fsevents": "~2.3.3", | ||||
| "postcss": "^8.4.31", | |||||
| "postcss": "^8.4.35", | |||||
| "rollup": "^4.2.0" | "rollup": "^4.2.0" | ||||
| } | } | ||||
| }, | }, |
| <a-menu mode="inline" v-model:openKeys="openSubMenu" @openChange="onOpenChange" inlineCollapsed | <a-menu mode="inline" v-model:openKeys="openSubMenu" @openChange="onOpenChange" inlineCollapsed | ||||
| v-model:selectedKeys="selectedMenu" style="background: #19be6b; height: '90vh';color: #fff;"> | v-model:selectedKeys="selectedMenu" style="background: #19be6b; height: '90vh';color: #fff;"> | ||||
| <template v-for="(item,index) in menuList"> | <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)"> | <a-menu-item :key="item.path" @click="onMenu(item.path)"> | ||||
| <template #icon> | <template #icon> | ||||
| <!-- <component :is="item"></component> --> | <!-- <component :is="item"></component> --> | ||||
| </template> | </template> | ||||
| <span>{{item.name}}</span> | |||||
| <span>{{item.meta.title}}</span> | |||||
| </a-menu-item> | </a-menu-item> | ||||
| </template> | </template> | ||||
| <template v-else> | <template v-else> | ||||
| <template #icon> | <template #icon> | ||||
| <!-- <component :is="item"></component> --> | <!-- <component :is="item"></component> --> | ||||
| </template> | </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> | <template #title> | ||||
| {{twoItem.name}} | |||||
| {{twoItem.meta.title}} | |||||
| </template> | </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-sub-menu> | ||||
| <a-menu-item v-else @click="onMenu(twoItem.path)" :key="twoItem.path"> | <a-menu-item v-else @click="onMenu(twoItem.path)" :key="twoItem.path"> | ||||
| {{ twoItem.name }} | |||||
| {{ twoItem.meta.title }} | |||||
| </a-menu-item> | </a-menu-item> | ||||
| </template> | </template> | ||||
| </a-sub-menu> | </a-sub-menu> | ||||
| import { ref, onMounted, computed } from 'vue'; | import { ref, onMounted, computed } from 'vue'; | ||||
| import { useMenu } from '@/hooks/useMenu'; | import { useMenu } from '@/hooks/useMenu'; | ||||
| let { menuList, onMenu, routerCur, routerArrayCur } = useMenu(); | let { menuList, onMenu, routerCur, routerArrayCur } = useMenu(); | ||||
| console.log(menuList) | |||||
| const selectedMenu = computed(() => { | const selectedMenu = computed(() => { | ||||
| let newSelectedMenu = [routerCur()]; | let newSelectedMenu = [routerCur()]; | ||||
| return newSelectedMenu; | return newSelectedMenu; |
| function routerCur() { | function routerCur() { | ||||
| return router.currentRoute.value.path | return router.currentRoute.value.path | ||||
| } | } | ||||
| // 获取当前路由父路由 | // 获取当前路由父路由 | ||||
| function routerArrayCur() { | function routerArrayCur() { | ||||
| return router.currentRoute.value.matched[1].path; | return router.currentRoute.value.matched[1].path; | ||||
| } | } | ||||
| // 跳转路由 | // 跳转路由 | ||||
| function routerTo(url : string) { | function routerTo(url : string) { | ||||
| router.push(url) | 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; | return finalRouter; | ||||
| } | } | ||||
| import ACSelectCommon from '@/components/cSelect/common.vue'; | import ACSelectCommon from '@/components/cSelect/common.vue'; | ||||
| import UploadOne from '@/components/upload/one.vue'; | import UploadOne from '@/components/upload/one.vue'; | ||||
| import { Model } from 'node_modules/echarts/index'; | 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) => { | router.beforeEach((to, from, next) => { | ||||
| document.title = `${to.meta.title} - 菊城人才市场后台管理`; | document.title = `${to.meta.title} - 菊城人才市场后台管理`; | ||||
| if (!sessionStorage.getItem('token')) { | if (!sessionStorage.getItem('token')) { | ||||
| if (to.matched.length > 0 && !to.matched.some(record => record.meta.requiresAuth)) { | if (to.matched.length > 0 && !to.matched.some(record => record.meta.requiresAuth)) { | ||||
| next() | next() |
| }) | }) | ||||
| let arr = state.arrresult; | 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 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); | LayoutRoute.children.push(...routes); | ||||
| commit('SET_MENU', LayoutRoute.children); | commit('SET_MENU', LayoutRoute.children); | ||||
| routerAdd(LayoutRoute); | routerAdd(LayoutRoute); | ||||
| }; | }; | ||||
| const pushItem = (item : Object) => { | const pushItem = (item : Object) => { | ||||
| state.arrresult.push(item.action) | |||||
| state.arrresult.push({action:item.action, name:item.name}) | |||||
| if (item.childs) { | if (item.childs) { | ||||
| for (const child of item.childs) { | for (const child of item.childs) { | ||||
| pushItem(child) | pushItem(child) |