| <!doctype html> | |||||
| <html lang="en"> | |||||
| <head> | |||||
| <meta charset="UTF-8" /> | |||||
| <link rel="icon" type="image/svg+xml" href="/vite.svg" /> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |||||
| <title>Vite + Vue + TS</title> | |||||
| <script type="module" crossorigin src="/assets/index-W7c0eAO7.js"></script> | |||||
| <link rel="stylesheet" crossorigin href="/assets/index-tRwQDn9K.css"> | |||||
| </head> | |||||
| <body> | |||||
| <div id="app"></div> | |||||
| </body> | |||||
| </html> | |||||
| <!doctype html> | |||||
| <html lang="en"> | |||||
| <head> | |||||
| <meta charset="UTF-8" /> | |||||
| <link rel="icon" type="image/svg+xml" href="/vite.svg" /> | |||||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |||||
| <title>Vite + Vue + TS</title> | |||||
| <script type="module" crossorigin src="/assets/index-Dy-MjAvr.js"></script> | |||||
| <link rel="stylesheet" crossorigin href="/assets/index-mwKMr71z.css"> | |||||
| </head> | |||||
| <body> | |||||
| <div id="app"></div> | |||||
| </body> | |||||
| </html> | 
| store.commit('setShowLoginBox', { | store.commit('setShowLoginBox', { | ||||
| showLoginBox: false | showLoginBox: false | ||||
| }) | }) | ||||
| store.commit('getLogined', { | |||||
| logined: true | |||||
| }) | |||||
| store.commit('getRoleName', { | store.commit('getRoleName', { | ||||
| roleName: 'company' | roleName: 'company' | ||||
| }) | }) | ||||
| sessionStorage.setItem('role', 'company') | sessionStorage.setItem('role', 'company') | ||||
| sessionStorage.setItem('token', 'admin') | sessionStorage.setItem('token', 'admin') | ||||
| store.commit('permissions/SET_PERMISSION', null) | |||||
| store.commit('permissions/SET_MENU', []) | |||||
| router.push('/manage/home') | |||||
| } | } | ||||
| </script> | </script> | 
| </a-col> | </a-col> | ||||
| <a-col span="4"> | <a-col span="4"> | ||||
| <div class="login-label" @click="toLogin"> | <div class="login-label" @click="toLogin"> | ||||
| <template v-if="logined"> | |||||
| <template v-if="logined == 'company'"> | |||||
| <a-dropdown placement="bottomRight"> | <a-dropdown placement="bottomRight"> | ||||
| <template #overlay> | <template #overlay> | ||||
| <a-menu @click="handleMenuClick"> | <a-menu @click="handleMenuClick"> | ||||
| </a-space> | </a-space> | ||||
| </a-menu-item> | </a-menu-item> | ||||
| <a-menu-item key="2"> | <a-menu-item key="2"> | ||||
| <UserOutlined /> | |||||
| 2nd menu item | |||||
| <a-space :size="80"> | |||||
| <div>未查看</div> | |||||
| <div>1000分</div> | |||||
| </a-space> | |||||
| </a-menu-item> | |||||
| <a-menu-item key="3"> | |||||
| <a-space :size="80"> | |||||
| <div>管理中心</div> | |||||
| </a-space> | |||||
| </a-menu-item> | |||||
| <a-menu-item key="3"> | |||||
| <a-space :size="80"> | |||||
| <div>职位管理</div> | |||||
| </a-space> | |||||
| </a-menu-item> | |||||
| <a-menu-item key="3"> | |||||
| <a-space :size="80"> | |||||
| <div>简历管理</div> | |||||
| </a-space> | |||||
| </a-menu-item> | |||||
| <a-menu-item key="3"> | |||||
| <a-space :size="80"> | |||||
| <div @click="quit">安全退出</div> | |||||
| </a-space> | |||||
| </a-menu-item> | |||||
| </a-menu> | |||||
| </template> | |||||
| <a-space :size="10"> | |||||
| <div style="color: aliceblue;">admin</div> | |||||
| <a-avatar style="color: #f56a00; background-color: #fde3cf">U</a-avatar> | |||||
| </a-space> | |||||
| </a-dropdown> | |||||
| </template> | |||||
| <template v-else-if="logined == 'personal'"> | |||||
| <a-dropdown placement="bottomRight"> | |||||
| <template #overlay> | |||||
| <a-menu @click="handleMenuClick"> | |||||
| <a-menu-item key="1"> | |||||
| <a-space :size="80"> | |||||
| <div>面试通知</div> | |||||
| <div>0分</div> | |||||
| </a-space> | |||||
| </a-menu-item> | |||||
| <a-menu-item key="2"> | |||||
| <a-space :size="80"> | |||||
| <div>简历完成度</div> | |||||
| <div><a-rate v-model:value="value" /></div> | |||||
| </a-space> | |||||
| </a-menu-item> | </a-menu-item> | ||||
| <a-menu-item key="3"> | <a-menu-item key="3"> | ||||
| <UserOutlined /> | |||||
| 3rd item | |||||
| <a-space :size="80"> | |||||
| <div>管理中心</div> | |||||
| </a-space> | |||||
| </a-menu-item> | |||||
| <a-menu-item key="3"> | |||||
| <a-space :size="80"> | |||||
| <div>修改简历</div> | |||||
| </a-space> | |||||
| </a-menu-item> | |||||
| <a-menu-item key="3"> | |||||
| <a-space :size="80"> | |||||
| <div>搜索职位</div> | |||||
| </a-space> | |||||
| </a-menu-item> | |||||
| <a-menu-item key="3"> | |||||
| <a-space :size="80"> | |||||
| <div>安全退出</div> | |||||
| </a-space> | |||||
| </a-menu-item> | </a-menu-item> | ||||
| </a-menu> | </a-menu> | ||||
| </template> | </template> | ||||
| import { ref, onMounted, computed, defineProps, defineEmits } from 'vue'; | import { ref, onMounted, computed, defineProps, defineEmits } from 'vue'; | ||||
| import ATopMenu from '@/components/layout/menu/aMenu.vue'; | import ATopMenu from '@/components/layout/menu/aMenu.vue'; | ||||
| import { store } from '@/store/index'; | import { store } from '@/store/index'; | ||||
| import { router } from '@/router/index'; | |||||
| const emit = defineEmits(); | const emit = defineEmits(); | ||||
| const toLogin = () => { | const toLogin = () => { | ||||
| store.commit('setShowLoginBox', { | store.commit('setShowLoginBox', { | ||||
| showLoginBox: true | showLoginBox: true | ||||
| }) | }) | ||||
| } | } | ||||
| const logined = computed(() => { | const logined = computed(() => { | ||||
| return store.state.logined | |||||
| return store.state.roleName | |||||
| }) | }) | ||||
| const quit = () => { | |||||
| store.commit('setShowLoginBox', { | |||||
| showLoginBox: true | |||||
| }) | |||||
| store.commit('getRoleName', { | |||||
| roleName: '' | |||||
| }) | |||||
| sessionStorage.clear() | |||||
| store.commit('permissions/SET_PERMISSION', null) | |||||
| store.commit('permissions/SET_MENU', []) | |||||
| router.push('/job/home') | |||||
| } | |||||
| </script> | </script> | ||||
| <style lang="less" scoped> | <style lang="less" scoped> | 
| import { useMenu } from '@/hooks/useMenu'; | import { useMenu } from '@/hooks/useMenu'; | ||||
| let { onMenu, routerCur, routerArrayCur, routerArrayParentChildCur } = useMenu(); | let { onMenu, routerCur, routerArrayCur, routerArrayParentChildCur } = useMenu(); | ||||
| let menuList = ref(store.state.permissions.menuList) | let menuList = ref(store.state.permissions.menuList) | ||||
| console.log(store.state.permissions.menuList) | |||||
| menuList = computed(() => { | |||||
| return store.state.permissions.menuList; | |||||
| }) | |||||
| let selectedMenu = computed(() => { | let selectedMenu = computed(() => { | ||||
| console.log(131,routerCur()) | console.log(131,routerCur()) | ||||
| let newSelectedMenu = [routerCur()]; | let newSelectedMenu = [routerCur()]; | 
| import { routesManageModuleList } from '@/router/manageDynamic'; | import { routesManageModuleList } from '@/router/manageDynamic'; | ||||
| router.beforeEach((to, from, next) => { | router.beforeEach((to, from, next) => { | ||||
| document.title = `菊城人才市场后台管理`; | document.title = `菊城人才市场后台管理`; | ||||
| if (sessionStorage.getItem('token')) { | |||||
| if (to.matched.length > 0 && !to.matched.some(record => record.meta.requiresAuth)) { | |||||
| next() | |||||
| } else { | |||||
| if (store.state.permissions.permissionList == null) { | |||||
| store.dispatch('permissions/FETCH_PERMISSION').then(() => { | |||||
| next({ | next({ | ||||
| path: '/job/home' | |||||
| path: to.path | |||||
| }) | }) | ||||
| } | |||||
| }) | |||||
| } else { | } else { | ||||
| console.log(store.state.permissions.permissionList) | |||||
| if (store.state.permissions.permissionList == null) { | |||||
| store.dispatch('permissions/FETCH_PERMISSION').then(() => { | |||||
| next({ | |||||
| path: to.path | |||||
| }) | |||||
| }) | |||||
| } else { | |||||
| next() | |||||
| } | |||||
| next() | |||||
| } | } | ||||
| }) | }) | ||||
| }, | }, | ||||
| }; | }; | ||||
| // 首页 | |||||
| const ManageHomeRoute : AppRouteRecordRaw = { | |||||
| path: '/manage/home', | |||||
| name: 'manageHome', | |||||
| component: routerList.ManageHome, | |||||
| meta: { | |||||
| title: '管理中心首页', | |||||
| icon: HomeOutlined | |||||
| }, | |||||
| }; | |||||
| // 企业资料 | |||||
| const ManageBasicRoute : AppRouteRecordRaw = { | |||||
| path: '/manage/basic', | |||||
| name: 'basic', | |||||
| component: routerList.ManageBasic, | |||||
| meta: { | |||||
| title: '企业资料', | |||||
| icon: HomeOutlined | |||||
| }, | |||||
| }; | |||||
| // 企业招聘 | |||||
| const ManageInviteRoute : AppRouteRecordRaw = { | |||||
| path: '/manageInvite', | |||||
| name: 'manageInvite', | |||||
| component: routerList.ManageInvite, | |||||
| meta: { | |||||
| title: '企业招聘', | |||||
| icon: HomeOutlined | |||||
| }, | |||||
| }; | |||||
| // 简历管理 | |||||
| const ManageResumeRoute : AppRouteRecordRaw = { | |||||
| path: '/manageResume', | |||||
| name: 'resume', | |||||
| component: routerList.ManageResume, | |||||
| meta: { | |||||
| title: '简历管理', | |||||
| icon: HomeOutlined | |||||
| }, | |||||
| }; | |||||
| // 搜索简历 | |||||
| const ManageSearchRoute : AppRouteRecordRaw = { | |||||
| path: '/manageSearch', | |||||
| name: 'search', | |||||
| component: routerList.ManageSearch, | |||||
| meta: { | |||||
| title: '搜索简历', | |||||
| icon: HomeOutlined | |||||
| }, | |||||
| }; | |||||
| // 招聘会管理 | |||||
| const ManageMeetRoute : AppRouteRecordRaw = { | |||||
| path: '/manageMeet', | |||||
| name: 'meet', | |||||
| component: routerList.ManageMeet, | |||||
| meta: { | |||||
| title: '招聘会管理', | |||||
| icon: HomeOutlined | |||||
| }, | |||||
| }; | |||||
| // 消息中心 | |||||
| const ManageMessageRoute : AppRouteRecordRaw = { | |||||
| path: '/manageMessage', | |||||
| name: 'message', | |||||
| component: routerList.ManageMessage, | |||||
| meta: { | |||||
| title: '消息中心', | |||||
| icon: HomeOutlined | |||||
| }, | |||||
| }; | |||||
| // 用户管理 | |||||
| const ManageUserRoute : AppRouteRecordRaw = { | |||||
| path: '/manageUser', | |||||
| name: 'user', | |||||
| component: routerList.ManageUser, | |||||
| meta: { | |||||
| title: '用户管理', | |||||
| icon: HomeOutlined | |||||
| }, | |||||
| }; | |||||
| export const routesModuleList : AppRouteModule[] = [HomeRoute, JobRoute, AboutRoute, LawRoute, MentorRoute, ExpertRoute, TrainRoute, RelationshipRoute, NewsRoute, ManageHomeRoute, | |||||
| ManageBasicRoute, | |||||
| ManageInviteRoute, | |||||
| ManageResumeRoute, | |||||
| ManageSearchRoute, | |||||
| ManageMeetRoute, | |||||
| ManageMessageRoute, | |||||
| ManageUserRoute]; | |||||
| export const routesModuleList : AppRouteModule[] = [ | |||||
| HomeRoute, | |||||
| JobRoute, | |||||
| AboutRoute, | |||||
| LawRoute, | |||||
| MentorRoute, | |||||
| ExpertRoute, | |||||
| TrainRoute, | |||||
| RelationshipRoute, | |||||
| NewsRoute | |||||
| ]; | 
| }, | }, | ||||
| }; | }; | ||||
| const ManageRoute : AppRouteRecordRaw = { | |||||
| path: '/manage', | |||||
| name: 'manage', | |||||
| component: routerList.Job, | |||||
| meta: { | |||||
| title: '企业管理', | |||||
| icon: HomeOutlined | |||||
| }, | |||||
| children: [ | |||||
| ManageHomeRoute, | |||||
| ManageBasicRoute, | |||||
| ManageInviteRoute, | |||||
| ManageResumeRoute, | |||||
| ManageSearchRoute, | |||||
| ManageMeetRoute, | |||||
| ManageMessageRoute, | |||||
| ManageUserRoute | |||||
| ] | |||||
| }; | |||||
| export const routesManageModuleList : AppRouteModule[] = [ | export const routesManageModuleList : AppRouteModule[] = [ | ||||
| ManageRoute | |||||
| ManageHomeRoute, | |||||
| ManageBasicRoute, | |||||
| ManageInviteRoute, | |||||
| ManageResumeRoute, | |||||
| ManageSearchRoute, | |||||
| ManageMeetRoute, | |||||
| ManageMessageRoute, | |||||
| ManageUserRoute | |||||
| ]; | ]; | 
| import { Module } from 'vuex'; | import { Module } from 'vuex'; | ||||
| import { useAsRouter } from '@/hooks/useAsRouter'; | import { useAsRouter } from '@/hooks/useAsRouter'; | ||||
| import { routesModuleList } from '@/router/dynamic'; | import { routesModuleList } from '@/router/dynamic'; | ||||
| import { routesManageModuleList } from '@/router/manageDynamic'; | |||||
| import { LayoutRoute } from '@/router/routes'; | import { LayoutRoute } from '@/router/routes'; | ||||
| const { routerDynamic, routerAdd, routerInit } = useAsRouter(); | const { routerDynamic, routerAdd, routerInit } = useAsRouter(); | ||||
| state.permissionList = routes | state.permissionList = routes | ||||
| }, | }, | ||||
| SET_MENU(state, menu) { | SET_MENU(state, menu) { | ||||
| console.log(menu) | |||||
| console.log(3123,menu) | |||||
| state.menuList = menu | state.menuList = menu | ||||
| } | } | ||||
| }; | }; | ||||
| try { | try { | ||||
| // let res = await LOGIN.permissions(); | // let res = await LOGIN.permissions(); | ||||
| // let arr = res.data.data; | // let arr = res.data.data; | ||||
| let arr = ['home','job','jobhome','personal' ,'company','homemake','inviteMeet','information','download']; | |||||
| debugger | |||||
| let routes = routerDynamic(arr, routesModuleList); | |||||
| debugger | |||||
| LayoutRoute.children.push(...routes); | |||||
| debugger | |||||
| LayoutRoute.redirect= '/job/home'; | |||||
| debugger | |||||
| commit('SET_MENU', LayoutRoute.children); | |||||
| debugger | |||||
| console.log(LayoutRoute.children) | |||||
| routerAdd(LayoutRoute); | |||||
| let initialRoutes = routerInit(); | |||||
| commit('SET_PERMISSION', [...initialRoutes]); | |||||
| if(sessionStorage.getItem('role') === 'company') { | |||||
| LayoutRoute.children = []; | |||||
| commit('SET_MENU', []); | |||||
| commit('SET_PERMISSION', null); | |||||
| LayoutRoute.children = routesManageModuleList; | |||||
| commit('SET_MENU', LayoutRoute.children); | |||||
| console.log(...routesManageModuleList) | |||||
| routerAdd(LayoutRoute); | |||||
| let initialRoutes = routerInit(); | |||||
| commit('SET_PERMISSION', [...initialRoutes]); | |||||
| } else { | |||||
| LayoutRoute.children = []; | |||||
| commit('SET_MENU', []); | |||||
| commit('SET_PERMISSION', null); | |||||
| LayoutRoute.children = routesModuleList; | |||||
| commit('SET_MENU', LayoutRoute.children); | |||||
| console.log(LayoutRoute.children) | |||||
| routerAdd(LayoutRoute); | |||||
| let initialRoutes = routerInit(); | |||||
| commit('SET_PERMISSION', [...initialRoutes]); | |||||
| } | |||||
| } catch { | } catch { | ||||
| } | } |