fix: 控制台加权限,登录跳转资产信息
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m19s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m19s
This commit is contained in:
@@ -53,12 +53,14 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { ref } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { RoutesAlias } from '@/router/routesAlias'
|
import { RoutesAlias } from '@/router/routesAlias'
|
||||||
import { WEB_LINKS } from '@/utils/constants'
|
import { WEB_LINKS } from '@/utils/constants'
|
||||||
|
import { useAuth } from '@/composables/useAuth'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const popoverRef = ref()
|
const popoverRef = ref()
|
||||||
|
const { hasAuth } = useAuth()
|
||||||
|
|
||||||
interface Application {
|
interface Application {
|
||||||
name: string
|
name: string
|
||||||
@@ -66,6 +68,7 @@
|
|||||||
icon: string
|
icon: string
|
||||||
iconColor: string
|
iconColor: string
|
||||||
path: string
|
path: string
|
||||||
|
permission?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface QuickLink {
|
interface QuickLink {
|
||||||
@@ -73,50 +76,73 @@
|
|||||||
path: string
|
path: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const applications: Application[] = [
|
const applications = computed<Application[]>(() => {
|
||||||
{
|
const apps: Application[] = [
|
||||||
name: '工作台',
|
{
|
||||||
description: '系统概览与数据统计',
|
name: '聊天',
|
||||||
icon: '',
|
description: '即时通讯功能',
|
||||||
iconColor: '#377dff',
|
icon: '',
|
||||||
path: RoutesAlias.Dashboard
|
iconColor: '#13DEB9',
|
||||||
},
|
path: RoutesAlias.Chat
|
||||||
{
|
},
|
||||||
name: '分析页',
|
{
|
||||||
description: '数据分析与可视化',
|
name: '官方文档',
|
||||||
icon: '',
|
description: '使用指南与开发文档',
|
||||||
iconColor: '#ff3b30',
|
icon: '',
|
||||||
path: RoutesAlias.Analysis
|
iconColor: '#ffb100',
|
||||||
},
|
path: WEB_LINKS.DOCS
|
||||||
{
|
},
|
||||||
name: '聊天',
|
{
|
||||||
description: '即时通讯功能',
|
name: '技术支持',
|
||||||
icon: '',
|
description: '技术支持与问题反馈',
|
||||||
iconColor: '#13DEB9',
|
icon: '',
|
||||||
path: RoutesAlias.Chat
|
iconColor: '#ff6b6b',
|
||||||
},
|
path: WEB_LINKS.COMMUNITY
|
||||||
{
|
},
|
||||||
name: '官方文档',
|
{
|
||||||
description: '使用指南与开发文档',
|
name: '哔哩哔哩',
|
||||||
icon: '',
|
description: '技术分享与交流',
|
||||||
iconColor: '#ffb100',
|
icon: '',
|
||||||
path: WEB_LINKS.DOCS
|
iconColor: '#FB7299',
|
||||||
},
|
path: WEB_LINKS.BILIBILI
|
||||||
{
|
}
|
||||||
name: '技术支持',
|
]
|
||||||
description: '技术支持与问题反馈',
|
|
||||||
icon: '',
|
if (hasAuth('dashboard:console')) {
|
||||||
iconColor: '#ff6b6b',
|
apps.unshift({
|
||||||
path: WEB_LINKS.COMMUNITY
|
name: '工作台',
|
||||||
},
|
description: '系统概览与数据统计',
|
||||||
{
|
icon: '',
|
||||||
name: '哔哩哔哩',
|
iconColor: '#377dff',
|
||||||
description: '技术分享与交流',
|
path: RoutesAlias.Dashboard,
|
||||||
icon: '',
|
permission: 'dashboard:console'
|
||||||
iconColor: '#FB7299',
|
})
|
||||||
path: WEB_LINKS.BILIBILI
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
|
if (hasAuth('dashboard:analysis')) {
|
||||||
|
apps.unshift({
|
||||||
|
name: '分析页',
|
||||||
|
description: '数据分析与可视化',
|
||||||
|
icon: '',
|
||||||
|
iconColor: '#ff3b30',
|
||||||
|
path: RoutesAlias.Analysis,
|
||||||
|
permission: 'dashboard:analysis'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasAuth('dashboard:ecommerce')) {
|
||||||
|
apps.unshift({
|
||||||
|
name: '电子商务',
|
||||||
|
description: '电商数据统计',
|
||||||
|
icon: '',
|
||||||
|
iconColor: '#00b42a',
|
||||||
|
path: RoutesAlias.Ecommerce,
|
||||||
|
permission: 'dashboard:ecommerce'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return apps
|
||||||
|
})
|
||||||
|
|
||||||
const quickLinks: QuickLink[] = [
|
const quickLinks: QuickLink[] = [
|
||||||
{ name: '登录', path: RoutesAlias.Login },
|
{ name: '登录', path: RoutesAlias.Login },
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { useI18n } from 'vue-i18n'
|
|||||||
import { ElNotification } from 'element-plus'
|
import { ElNotification } from 'element-plus'
|
||||||
import type { FormInstance, FormRules } from 'element-plus'
|
import type { FormInstance, FormRules } from 'element-plus'
|
||||||
import { useUserStore } from '@/store/modules/user'
|
import { useUserStore } from '@/store/modules/user'
|
||||||
import { HOME_PAGE } from '@/router/routesAlias'
|
import { HOME_PAGE, RoutesAlias } from '@/router/routesAlias'
|
||||||
import AppConfig from '@/config'
|
import AppConfig from '@/config'
|
||||||
import { AuthService } from '@/api/modules'
|
import { AuthService } from '@/api/modules'
|
||||||
import { ApiStatus } from '@/utils/http/status'
|
import { ApiStatus } from '@/utils/http/status'
|
||||||
@@ -146,9 +146,8 @@ export function useLogin() {
|
|||||||
// 等待数据持久化完成
|
// 等待数据持久化完成
|
||||||
await new Promise((resolve) => setTimeout(resolve, 100))
|
await new Promise((resolve) => setTimeout(resolve, 100))
|
||||||
|
|
||||||
// 跳转到重定向页面或首页
|
// 跳转到资产信息页面
|
||||||
const redirectPath = getRedirectPath(route)
|
await router.push(RoutesAlias.AssetInformation)
|
||||||
await router.push(redirectPath || HOME_PAGE)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user