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">
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ref } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
import { WEB_LINKS } from '@/utils/constants'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
|
||||
const router = useRouter()
|
||||
const popoverRef = ref()
|
||||
const { hasAuth } = useAuth()
|
||||
|
||||
interface Application {
|
||||
name: string
|
||||
@@ -66,6 +68,7 @@
|
||||
icon: string
|
||||
iconColor: string
|
||||
path: string
|
||||
permission?: string
|
||||
}
|
||||
|
||||
interface QuickLink {
|
||||
@@ -73,50 +76,73 @@
|
||||
path: string
|
||||
}
|
||||
|
||||
const applications: Application[] = [
|
||||
{
|
||||
name: '工作台',
|
||||
description: '系统概览与数据统计',
|
||||
icon: '',
|
||||
iconColor: '#377dff',
|
||||
path: RoutesAlias.Dashboard
|
||||
},
|
||||
{
|
||||
name: '分析页',
|
||||
description: '数据分析与可视化',
|
||||
icon: '',
|
||||
iconColor: '#ff3b30',
|
||||
path: RoutesAlias.Analysis
|
||||
},
|
||||
{
|
||||
name: '聊天',
|
||||
description: '即时通讯功能',
|
||||
icon: '',
|
||||
iconColor: '#13DEB9',
|
||||
path: RoutesAlias.Chat
|
||||
},
|
||||
{
|
||||
name: '官方文档',
|
||||
description: '使用指南与开发文档',
|
||||
icon: '',
|
||||
iconColor: '#ffb100',
|
||||
path: WEB_LINKS.DOCS
|
||||
},
|
||||
{
|
||||
name: '技术支持',
|
||||
description: '技术支持与问题反馈',
|
||||
icon: '',
|
||||
iconColor: '#ff6b6b',
|
||||
path: WEB_LINKS.COMMUNITY
|
||||
},
|
||||
{
|
||||
name: '哔哩哔哩',
|
||||
description: '技术分享与交流',
|
||||
icon: '',
|
||||
iconColor: '#FB7299',
|
||||
path: WEB_LINKS.BILIBILI
|
||||
const applications = computed<Application[]>(() => {
|
||||
const apps: Application[] = [
|
||||
{
|
||||
name: '聊天',
|
||||
description: '即时通讯功能',
|
||||
icon: '',
|
||||
iconColor: '#13DEB9',
|
||||
path: RoutesAlias.Chat
|
||||
},
|
||||
{
|
||||
name: '官方文档',
|
||||
description: '使用指南与开发文档',
|
||||
icon: '',
|
||||
iconColor: '#ffb100',
|
||||
path: WEB_LINKS.DOCS
|
||||
},
|
||||
{
|
||||
name: '技术支持',
|
||||
description: '技术支持与问题反馈',
|
||||
icon: '',
|
||||
iconColor: '#ff6b6b',
|
||||
path: WEB_LINKS.COMMUNITY
|
||||
},
|
||||
{
|
||||
name: '哔哩哔哩',
|
||||
description: '技术分享与交流',
|
||||
icon: '',
|
||||
iconColor: '#FB7299',
|
||||
path: WEB_LINKS.BILIBILI
|
||||
}
|
||||
]
|
||||
|
||||
if (hasAuth('dashboard:console')) {
|
||||
apps.unshift({
|
||||
name: '工作台',
|
||||
description: '系统概览与数据统计',
|
||||
icon: '',
|
||||
iconColor: '#377dff',
|
||||
path: RoutesAlias.Dashboard,
|
||||
permission: 'dashboard:console'
|
||||
})
|
||||
}
|
||||
]
|
||||
|
||||
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[] = [
|
||||
{ name: '登录', path: RoutesAlias.Login },
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useI18n } from 'vue-i18n'
|
||||
import { ElNotification } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { HOME_PAGE } from '@/router/routesAlias'
|
||||
import { HOME_PAGE, RoutesAlias } from '@/router/routesAlias'
|
||||
import AppConfig from '@/config'
|
||||
import { AuthService } from '@/api/modules'
|
||||
import { ApiStatus } from '@/utils/http/status'
|
||||
@@ -146,9 +146,8 @@ export function useLogin() {
|
||||
// 等待数据持久化完成
|
||||
await new Promise((resolve) => setTimeout(resolve, 100))
|
||||
|
||||
// 跳转到重定向页面或首页
|
||||
const redirectPath = getRedirectPath(route)
|
||||
await router.push(redirectPath || HOME_PAGE)
|
||||
// 跳转到资产信息页面
|
||||
await router.push(RoutesAlias.AssetInformation)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user