|
@@ -40,7 +40,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<v-list>
|
|
<v-list>
|
|
- <v-list-item v-for="(item, index) in menuList" :key="index" @click="item.change">
|
|
|
|
|
|
+ <v-list-item v-for="(item, index) in items" :key="index" @click="item.change">
|
|
<template v-slot:prepend>
|
|
<template v-slot:prepend>
|
|
<v-icon :icon="item.icon"></v-icon>
|
|
<v-icon :icon="item.icon"></v-icon>
|
|
</template>
|
|
</template>
|
|
@@ -89,7 +89,7 @@ import {
|
|
getUserBindEnterpriseList,
|
|
getUserBindEnterpriseList,
|
|
// getUserRegisterEnterpriseApply
|
|
// getUserRegisterEnterpriseApply
|
|
} from '@/api/personal/user'
|
|
} from '@/api/personal/user'
|
|
-import { ref, onMounted } from 'vue'
|
|
|
|
|
|
+import { ref, onMounted, computed } from 'vue'
|
|
import { getToken } from '@/utils/auth'
|
|
import { getToken } from '@/utils/auth'
|
|
import { useUserStore } from '@/store/user'; const userStore = useUserStore()
|
|
import { useUserStore } from '@/store/user'; const userStore = useUserStore()
|
|
// import { useLocaleStore } from '@/store/locale'; const localeStore = useLocaleStore()
|
|
// import { useLocaleStore } from '@/store/locale'; const localeStore = useLocaleStore()
|
|
@@ -108,12 +108,6 @@ defineProps({
|
|
|
|
|
|
const showBall = ref(false)
|
|
const showBall = ref(false)
|
|
|
|
|
|
-onMounted(() => {
|
|
|
|
- if (getToken(1)) {
|
|
|
|
- showBall.value = true
|
|
|
|
- }
|
|
|
|
-})
|
|
|
|
-
|
|
|
|
const handleLogoClick = () => { window.open('/recruitHome') } // 点击logo
|
|
const handleLogoClick = () => { window.open('/recruitHome') } // 点击logo
|
|
|
|
|
|
const enterpriseClick = (tabKey = 1) => {
|
|
const enterpriseClick = (tabKey = 1) => {
|
|
@@ -129,9 +123,61 @@ const handleLogout = async (exit = true) => {
|
|
const enterpriseList = ref([])
|
|
const enterpriseList = ref([])
|
|
|
|
|
|
const menuList = ref([
|
|
const menuList = ref([
|
|
- { title: t('setting.editPassword'), icon: 'mdi-shield-lock-open-outline', change: () => router.push({ path: '/recruit/enterprise/systemManagement/staffChangePassword' }) },
|
|
|
|
|
|
+ { title: t('setting.editPassword'), icon: 'mdi-shield-lock-open-outline', key: 'editPassword', change: () => router.push({ path: '/recruit/enterprise/systemManagement/staffChangePassword' }) },
|
|
{ title: t('setting.logOut'), icon: 'mdi-logout', change: handleLogout }
|
|
{ title: t('setting.logOut'), icon: 'mdi-logout', change: handleLogout }
|
|
])
|
|
])
|
|
|
|
+const items = computed(() => {
|
|
|
|
+ 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/systemManagement/staffChangePassword')) {
|
|
|
|
+ menuList.value.find(e => e.key === 'editPassword').hidden = true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+onMounted(() => {
|
|
|
|
+ if (getToken(1)) {
|
|
|
|
+ showBall.value = true
|
|
|
|
+ localStorage.setItem('showEditPassword', hasRoute('/recruit/enterprise/systemManagement/staffChangePassword'))
|
|
|
|
+ }
|
|
|
|
+})
|
|
|
|
|
|
// 企业logo、用户基本信息
|
|
// 企业logo、用户基本信息
|
|
let baseInfo = ref(JSON.parse(localStorage.getItem('entBaseInfo')) || {})
|
|
let baseInfo = ref(JSON.parse(localStorage.getItem('entBaseInfo')) || {})
|