fix: 控制台加权限,登录跳转资产信息
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 7m4s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 7m4s
This commit is contained in:
@@ -56,11 +56,11 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
import { WEB_LINKS } from '@/utils/constants'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
|
||||
const router = useRouter()
|
||||
const popoverRef = ref()
|
||||
const { hasAuth } = useAuth()
|
||||
const userStore = useUserStore()
|
||||
|
||||
interface Application {
|
||||
name: string
|
||||
@@ -108,36 +108,48 @@
|
||||
}
|
||||
]
|
||||
|
||||
if (hasAuth('dashboard:console')) {
|
||||
const menus = userStore.menus.value || []
|
||||
|
||||
const hasMenuPermission = (permCode: string): boolean => {
|
||||
const findMenu = (items: any[]): boolean => {
|
||||
for (const item of items) {
|
||||
if (item.perm_code === permCode) return true
|
||||
if (item.children && item.children.length > 0) {
|
||||
if (findMenu(item.children)) return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
return findMenu(menus)
|
||||
}
|
||||
|
||||
if (hasMenuPermission('menu:dashboard')) {
|
||||
apps.unshift({
|
||||
name: '工作台',
|
||||
description: '系统概览与数据统计',
|
||||
icon: '',
|
||||
iconColor: '#377dff',
|
||||
path: RoutesAlias.Dashboard,
|
||||
permission: 'dashboard:console'
|
||||
path: RoutesAlias.Dashboard
|
||||
})
|
||||
}
|
||||
|
||||
if (hasAuth('dashboard:analysis')) {
|
||||
if (hasMenuPermission('menu:analysis')) {
|
||||
apps.unshift({
|
||||
name: '分析页',
|
||||
description: '数据分析与可视化',
|
||||
icon: '',
|
||||
iconColor: '#ff3b30',
|
||||
path: RoutesAlias.Analysis,
|
||||
permission: 'dashboard:analysis'
|
||||
path: RoutesAlias.Analysis
|
||||
})
|
||||
}
|
||||
|
||||
if (hasAuth('dashboard:ecommerce')) {
|
||||
if (hasMenuPermission('menu:ecommerce')) {
|
||||
apps.unshift({
|
||||
name: '电子商务',
|
||||
description: '电商数据统计',
|
||||
icon: '',
|
||||
iconColor: '#00b42a',
|
||||
path: RoutesAlias.Ecommerce,
|
||||
permission: 'dashboard:ecommerce'
|
||||
path: RoutesAlias.Ecommerce
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user