删除 Dashboard 页面,将首页改为根目录

- 删除 Dashboard.vue 页面文件
- 修改路由配置:删除 Dashboard 路由,根路径重定向到 /tools
- 删除菜单配置中的 dashboard 菜单项
- 删除 AppHeader 中的 Dashboard 标题映射
- 修复禁用账户后跳转问题:反馈提交后跳转到根目录而非 /dashboard
This commit is contained in:
jingrow 2026-01-04 21:29:51 +08:00
parent f30502bf7d
commit 423e28c09c
5 changed files with 4 additions and 219 deletions

View File

@ -181,7 +181,6 @@ const breadcrumbItems = computed(() => {
} else { } else {
// //
const map: Record<string, string> = { const map: Record<string, string> = {
Dashboard: t('Dashboard'),
AgentList: t('Agents'), AgentList: t('Agents'),
AgentDetail: t('Agent Detail'), AgentDetail: t('Agent Detail'),
NodeList: t('Node Management'), NodeList: t('Node Management'),

View File

@ -29,9 +29,9 @@ const router = createRouter({
meta: { requiresAuth: true }, meta: { requiresAuth: true },
children: [ children: [
{ {
path: 'dashboard', path: '',
name: 'Dashboard', name: 'Home',
component: () => import('../../views/Dashboard.vue') redirect: '/tools'
}, },
{ {
path: 'local-jobs', path: 'local-jobs',

View File

@ -50,7 +50,6 @@ function saveToStorage(items: AppMenuItem[]) {
// - 非 System User 只能看到工具市场 // - 非 System User 只能看到工具市场
function getDefaultMenus(): AppMenuItem[] { function getDefaultMenus(): AppMenuItem[] {
return [ return [
{ id: 'dashboard', key: 'Dashboard', label: 'Dashboard', icon: 'tabler:dashboard', routeName: 'Dashboard', order: 1, type: 'route' },
{ id: 'work', key: 'work', label: 'Work', icon: 'tabler:device-desktop', type: 'workspace', workspaceName: 'work', url: '/workspace/work', order: 2 }, { id: 'work', key: 'work', label: 'Work', icon: 'tabler:device-desktop', type: 'workspace', workspaceName: 'work', url: '/workspace/work', order: 2 },
{ id: 'design', key: 'design', label: 'Design', icon: 'tabler:pencil', type: 'workspace', workspaceName: 'design', url: '/workspace/design', order: 3 }, { id: 'design', key: 'design', label: 'Design', icon: 'tabler:pencil', type: 'workspace', workspaceName: 'design', url: '/workspace/design', order: 3 },
{ id: 'website', key: 'website', label: 'Website', icon: 'tabler:world', type: 'workspace', workspaceName: 'jsite', url: '/workspace/jsite', order: 4 }, { id: 'website', key: 'website', label: 'Website', icon: 'tabler:world', type: 'workspace', workspaceName: 'jsite', url: '/workspace/jsite', order: 4 },

View File

@ -1,213 +0,0 @@
<template>
<div class="dashboard-page">
<div class="page-header">
<h1 class="page-title">{{ t('Dashboard') }}</h1>
</div>
<!-- 统计卡片 -->
<n-grid :cols="4" :x-gap="16" :y-gap="16" :responsive="'screen'" :item-responsive="true" class="stats-grid">
<!-- 原来的4个统计 -->
<n-grid-item>
<n-card>
<n-statistic :label="t('Total Agents')" :value="stats.agents" />
</n-card>
</n-grid-item>
<n-grid-item>
<n-card>
<n-statistic :label="t('Total Nodes')" :value="stats.nodes" />
</n-card>
</n-grid-item>
<n-grid-item>
<n-card>
<n-statistic :label="t('Task Queue')" :value="stats.taskQueue" />
</n-card>
</n-grid-item>
<n-grid-item>
<n-card>
<n-statistic :label="t('Scheduled Tasks')" :value="stats.scheduledTasks" />
</n-card>
</n-grid-item>
<!-- 新增的5个统计 -->
<n-grid-item>
<n-card>
<n-statistic :label="t('Knowledge Base')" :value="stats.knowledgeBase" />
</n-card>
</n-grid-item>
<n-grid-item>
<n-card>
<n-statistic :label="t('Note')" :value="stats.note" />
</n-card>
</n-grid-item>
<n-grid-item>
<n-card>
<n-statistic :label="t('Event')" :value="stats.event" />
</n-card>
</n-grid-item>
<n-grid-item>
<n-card>
<n-statistic :label="t('ToDo')" :value="stats.todo" />
</n-card>
</n-grid-item>
<n-grid-item>
<n-card>
<n-statistic :label="t('File')" :value="stats.file" />
</n-card>
</n-grid-item>
</n-grid>
</div>
</template>
<script setup lang="ts">
import { reactive, onMounted } from 'vue'
import {
NGrid,
NGridItem,
NCard,
NStatistic
} from 'naive-ui'
import { t } from '../shared/i18n'
import { getCount, getLocalJobCount } from '../shared/api/common'
const stats = reactive({
agents: 0,
nodes: 0,
taskQueue: 0,
scheduledTasks: 0,
knowledgeBase: 0,
note: 0,
event: 0,
todo: 0,
file: 0
})
//
const loadStats = async () => {
try {
// 4
//
const agentsResult = await getCount('Local Ai Agent')
if (agentsResult.success) {
stats.agents = agentsResult.count || 0
}
//
const nodesResult = await getCount('Local Ai Node')
if (nodesResult.success) {
stats.nodes = nodesResult.count || 0
}
// - 使Local Job (pagetype使API)
const taskQueueResult = await getLocalJobCount()
if (taskQueueResult.success) {
stats.taskQueue = taskQueueResult.count || 0
}
//
const scheduledTasksResult = await getCount('Local Scheduled Job')
if (scheduledTasksResult.success) {
stats.scheduledTasks = scheduledTasksResult.count || 0
}
// 5
//
const knowledgeBaseResult = await getCount('Knowledge Base')
if (knowledgeBaseResult.success) {
stats.knowledgeBase = knowledgeBaseResult.count || 0
}
//
const noteResult = await getCount('Note')
if (noteResult.success) {
stats.note = noteResult.count || 0
}
//
const eventResult = await getCount('Event')
if (eventResult.success) {
stats.event = eventResult.count || 0
}
//
const todoResult = await getCount('ToDo')
if (todoResult.success) {
stats.todo = todoResult.count || 0
}
//
const fileResult = await getCount('File')
if (fileResult.success) {
stats.file = fileResult.count || 0
}
} catch (error) {
console.error('加载统计数据失败:', error)
}
}
onMounted(() => {
//
loadStats()
})
</script>
<style scoped>
.dashboard-page {
width: 100%;
padding: 0 16px;
}
.page-header {
margin-bottom: 24px;
}
.page-title {
font-size: 28px;
font-weight: 700;
color: #1f2937;
margin: 0 0 8px 0;
}
.page-description {
font-size: 16px;
color: #6b7280;
margin: 0;
}
.stats-grid {
margin-bottom: 24px;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.stats-grid {
--n-grid-cols: 3;
}
}
@media (max-width: 768px) {
.dashboard-page {
padding: 0 12px;
}
.stats-grid {
margin-bottom: 16px;
--n-grid-cols: 2;
}
}
@media (max-width: 480px) {
.dashboard-page {
padding: 0 8px;
}
.page-title {
font-size: 24px;
}
.stats-grid {
--n-grid-cols: 1;
}
}
</style>

View File

@ -1834,7 +1834,7 @@ const handleSubmitFeedback = async () => {
feedbackNote.value = '' feedbackNote.value = ''
// //
setTimeout(() => { setTimeout(() => {
window.location.href = '/dashboard' window.location.href = '/'
}, 1000) }, 1000)
} else { } else {
feedbackError.value = result.message || t('提交反馈失败') feedbackError.value = result.message || t('提交反馈失败')