|
@@ -94,6 +94,7 @@ import { useI18n } from '@/hooks/web/useI18n'; const { t } = useI18n()
|
|
import MessageNotification from '../message.vue'
|
|
import MessageNotification from '../message.vue'
|
|
import { getUserAvatar } from '@/utils/avatar'
|
|
import { getUserAvatar } from '@/utils/avatar'
|
|
import { formatName } from '@/utils/getText'
|
|
import { formatName } from '@/utils/getText'
|
|
|
|
+// import { logoutToken } from '@/api/common'
|
|
|
|
|
|
defineProps({
|
|
defineProps({
|
|
sticky: {
|
|
sticky: {
|
|
@@ -117,6 +118,30 @@ const handleLogout = async (exit = true) => {
|
|
router.push({ path: '/recruitHome' })
|
|
router.push({ path: '/recruitHome' })
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// 我要求职
|
|
|
|
+// const handleRecruit = async () => {
|
|
|
|
+// // 没有登录个人的则直接清除企业缓存后跳转登录页
|
|
|
|
+// if (!getToken()) {
|
|
|
|
+// await userStore.userLogout(2)
|
|
|
|
+// router.push({ path: '/login' })
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// // 有登录个人账号时则清除企业登录缓存后跳转到求职者首页
|
|
|
|
+// await logoutToken(getToken(1))
|
|
|
|
+// const isChangeRole = localStorage.getItem('enterpriseId')
|
|
|
|
+// if (isChangeRole) {
|
|
|
|
+// const perAccountData = JSON.parse(localStorage.getItem('perAccountInfo'))
|
|
|
|
+// localStorage.setItem('accountInfo', JSON.stringify(perAccountData))
|
|
|
|
+// } else localStorage.removeItem('accountInfo')
|
|
|
|
+
|
|
|
|
+// // 清除企业相关缓存信息
|
|
|
|
+// const enterpriseLocalStorage = ['ENT_REFRESH_TOKEN', 'ENT_ACCESS_TOKEN', 'entBaseInfo', 'isAdmin', 'enterpriseUserAccount', 'entUpdatePassword', 'emailLoginInfo', 'enterpriseStore', 'enterpriseId']
|
|
|
|
+// enterpriseLocalStorage.forEach(e => localStorage.removeItem(e))
|
|
|
|
+
|
|
|
|
+// router.push('/')
|
|
|
|
+// }
|
|
|
|
+
|
|
const menuList = ref([
|
|
const menuList = ref([
|
|
{ title: t('setting.editPassword'), icon: 'mdi-shield-lock-open-outline', key: 'editPassword', change: () => router.push({ path: '/recruit/enterprise/staffChangePassword' }) },
|
|
{ title: t('setting.editPassword'), icon: 'mdi-shield-lock-open-outline', key: 'editPassword', change: () => router.push({ path: '/recruit/enterprise/staffChangePassword' }) },
|
|
{ title: t('setting.logOut'), icon: 'mdi-logout', change: handleLogout }
|
|
{ title: t('setting.logOut'), icon: 'mdi-logout', change: handleLogout }
|
|
@@ -125,52 +150,9 @@ const items = computed(() => {
|
|
return menuList.value.filter(item => !item.hidden)
|
|
return menuList.value.filter(item => !item.hidden)
|
|
})
|
|
})
|
|
|
|
|
|
-/**
|
|
|
|
- * @param {Array} routes
|
|
|
|
- * @returns {Array}
|
|
|
|
- * 路由扁平化 抽离children字段
|
|
|
|
- */
|
|
|
|
- function routeFlattening (routes) {
|
|
|
|
- return routes.reduce((prev, cur) => {
|
|
|
|
- prev.push(cur.path)
|
|
|
|
- if (cur.children && cur.children.length) {
|
|
|
|
- prev.push(...routeFlattening(cur.children))
|
|
|
|
- }
|
|
|
|
- return prev
|
|
|
|
- }, [])
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const hasRoute = (path) => {
|
|
|
|
- const routes = router.getRoutes()
|
|
|
|
- return routeFlattening(routes).some(_path => {
|
|
|
|
- if (_path.includes(':')) {
|
|
|
|
- const change = path.split('/')
|
|
|
|
- const _change = _path.split('/')
|
|
|
|
- if (change.length !== _change.length) {
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
- const res = _change.reduce((e, v, i) => {
|
|
|
|
- if (v.includes(':')) {
|
|
|
|
- e.push(true)
|
|
|
|
- return e
|
|
|
|
- }
|
|
|
|
- e.push(change[i] === v)
|
|
|
|
- return e
|
|
|
|
- }, [])
|
|
|
|
- return res.every(e => e)
|
|
|
|
- }
|
|
|
|
- return _path === path
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-// 没有权限访问时,隐藏菜单
|
|
|
|
-if (!hasRoute('/recruit/enterprise/staffChangePassword')) {
|
|
|
|
- menuList.value.find(e => e.key === 'editPassword').hidden = true
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
if (getToken(1)) {
|
|
if (getToken(1)) {
|
|
showBall.value = true
|
|
showBall.value = true
|
|
- localStorage.setItem('showEditPassword', hasRoute('/recruit/enterprise/staffChangePassword'))
|
|
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|