@@ -1,15 +1,14 @@ | |||
<!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> |
@@ -52,14 +52,14 @@ | |||
store.commit('setShowLoginBox', { | |||
showLoginBox: false | |||
}) | |||
store.commit('getLogined', { | |||
logined: true | |||
}) | |||
store.commit('getRoleName', { | |||
roleName: 'company' | |||
}) | |||
sessionStorage.setItem('role', 'company') | |||
sessionStorage.setItem('token', 'admin') | |||
store.commit('permissions/SET_PERMISSION', null) | |||
store.commit('permissions/SET_MENU', []) | |||
router.push('/manage/home') | |||
} | |||
</script> |
@@ -10,7 +10,7 @@ | |||
</a-col> | |||
<a-col span="4"> | |||
<div class="login-label" @click="toLogin"> | |||
<template v-if="logined"> | |||
<template v-if="logined == 'company'"> | |||
<a-dropdown placement="bottomRight"> | |||
<template #overlay> | |||
<a-menu @click="handleMenuClick"> | |||
@@ -21,12 +21,74 @@ | |||
</a-space> | |||
</a-menu-item> | |||
<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 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> | |||
</template> | |||
@@ -49,16 +111,29 @@ | |||
import { ref, onMounted, computed, defineProps, defineEmits } from 'vue'; | |||
import ATopMenu from '@/components/layout/menu/aMenu.vue'; | |||
import { store } from '@/store/index'; | |||
import { router } from '@/router/index'; | |||
const emit = defineEmits(); | |||
const toLogin = () => { | |||
store.commit('setShowLoginBox', { | |||
showLoginBox: true | |||
}) | |||
} | |||
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> | |||
<style lang="less" scoped> |
@@ -33,7 +33,10 @@ | |||
import { useMenu } from '@/hooks/useMenu'; | |||
let { onMenu, routerCur, routerArrayCur, routerArrayParentChildCur } = useMenu(); | |||
let menuList = ref(store.state.permissions.menuList) | |||
console.log(store.state.permissions.menuList) | |||
menuList = computed(() => { | |||
return store.state.permissions.menuList; | |||
}) | |||
let selectedMenu = computed(() => { | |||
console.log(131,routerCur()) | |||
let newSelectedMenu = [routerCur()]; |
@@ -11,25 +11,14 @@ import { routesModuleList } from '@/router/dynamic'; | |||
import { routesManageModuleList } from '@/router/manageDynamic'; | |||
router.beforeEach((to, from, next) => { | |||
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({ | |||
path: '/job/home' | |||
path: to.path | |||
}) | |||
} | |||
}) | |||
} 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() | |||
} | |||
}) | |||
@@ -169,106 +169,16 @@ const NewsRoute : AppRouteRecordRaw = { | |||
}, | |||
}; | |||
// 首页 | |||
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 | |||
]; |
@@ -94,27 +94,16 @@ const ManageUserRoute : AppRouteRecordRaw = { | |||
}, | |||
}; | |||
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[] = [ | |||
ManageRoute | |||
ManageHomeRoute, | |||
ManageBasicRoute, | |||
ManageInviteRoute, | |||
ManageResumeRoute, | |||
ManageSearchRoute, | |||
ManageMeetRoute, | |||
ManageMessageRoute, | |||
ManageUserRoute | |||
]; |
@@ -1,6 +1,7 @@ | |||
import { Module } from 'vuex'; | |||
import { useAsRouter } from '@/hooks/useAsRouter'; | |||
import { routesModuleList } from '@/router/dynamic'; | |||
import { routesManageModuleList } from '@/router/manageDynamic'; | |||
import { LayoutRoute } from '@/router/routes'; | |||
const { routerDynamic, routerAdd, routerInit } = useAsRouter(); | |||
@@ -23,7 +24,7 @@ const mutations = { | |||
state.permissionList = routes | |||
}, | |||
SET_MENU(state, menu) { | |||
console.log(menu) | |||
console.log(3123,menu) | |||
state.menuList = menu | |||
} | |||
}; | |||
@@ -35,20 +36,28 @@ const actions = { | |||
try { | |||
// let res = await LOGIN.permissions(); | |||
// 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 { | |||
} |