diff --git a/dashboard/src/i18n/locales/en-US/core/navigation.json b/dashboard/src/i18n/locales/en-US/core/navigation.json index f36724fb2..249ee8b1a 100644 --- a/dashboard/src/i18n/locales/en-US/core/navigation.json +++ b/dashboard/src/i18n/locales/en-US/core/navigation.json @@ -16,5 +16,10 @@ "settings": "Settings", "documentation": "Documentation", "github": "GitHub", - "drag": "Drag" + "drag": "Drag", + "groups": { + "platform": "Platform", + "configuration": "Configuration", + "others": "Others" + } } \ No newline at end of file diff --git a/dashboard/src/i18n/locales/zh-CN/core/navigation.json b/dashboard/src/i18n/locales/zh-CN/core/navigation.json index 0953b1046..cff73d7cf 100644 --- a/dashboard/src/i18n/locales/zh-CN/core/navigation.json +++ b/dashboard/src/i18n/locales/zh-CN/core/navigation.json @@ -16,5 +16,10 @@ "settings": "设置", "documentation": "官方文档", "github": "GitHub", - "drag": "拖拽" + "drag": "拖拽", + "groups": { + "platform": "平台", + "configuration": "配置", + "others": "其他" + } } \ No newline at end of file diff --git a/dashboard/src/layouts/full/vertical-sidebar/NavItem.vue b/dashboard/src/layouts/full/vertical-sidebar/NavItem.vue index c81b107df..e2981fe62 100644 --- a/dashboard/src/layouts/full/vertical-sidebar/NavItem.vue +++ b/dashboard/src/layouts/full/vertical-sidebar/NavItem.vue @@ -1,12 +1,44 @@ + + diff --git a/dashboard/src/layouts/full/vertical-sidebar/VerticalSidebar.vue b/dashboard/src/layouts/full/vertical-sidebar/VerticalSidebar.vue index e1c9f62d8..f083e4553 100644 --- a/dashboard/src/layouts/full/vertical-sidebar/VerticalSidebar.vue +++ b/dashboard/src/layouts/full/vertical-sidebar/VerticalSidebar.vue @@ -12,7 +12,11 @@ const sidebarMenu = shallowRef(sidebarItems); const showIframe = ref(false); -// 默认桌面端 iframe 样式 +const sidebarWidth = ref(260); +const minSidebarWidth = 200; +const maxSidebarWidth = 300; +const isResizing = ref(false); + const iframeStyle = ref({ position: 'fixed', bottom: '16px', @@ -29,14 +33,13 @@ const iframeStyle = ref({ boxShadow: '0px 4px 12px rgba(0, 0, 0, 0.1)', }); -// 如果为移动端,则采用百分比尺寸,并设置初始位置 if (window.innerWidth < 768) { iframeStyle.value = { position: 'fixed', top: '10%', left: '0%', width: '100%', - height: '50%', + height: '80%', minWidth: '300px', minHeight: '200px', background: 'white', @@ -46,7 +49,6 @@ if (window.innerWidth < 768) { borderRadius: '12px', boxShadow: '0px 4px 12px rgba(0, 0, 0, 0.1)', }; - // 移动端默认关闭侧边栏 customizer.Sidebar_drawer = false; } @@ -74,12 +76,10 @@ function openIframeLink(url) { } } -// 拖拽相关变量与函数 let offsetX = 0; let offsetY = 0; let isDragging = false; -// 辅助函数:限制数值在一定范围内 function clamp(value, min, max) { return Math.min(Math.max(value, min), max); } @@ -91,7 +91,6 @@ function startDrag(clientX, clientY) { offsetX = clientX - rect.left; offsetY = clientY - rect.top; document.body.style.userSelect = 'none'; - // 绑定全局鼠标和触摸事件 document.addEventListener('mousemove', onMouseMove); document.addEventListener('mouseup', onMouseUp); document.addEventListener('touchmove', onTouchMove, { passive: false }); @@ -149,6 +148,34 @@ function endDrag() { document.removeEventListener('touchend', onTouchEnd); } +function startSidebarResize(event) { + isResizing.value = true; + document.body.style.userSelect = 'none'; + document.body.style.cursor = 'ew-resize'; + + const startX = event.clientX; + const startWidth = sidebarWidth.value; + + function onMouseMoveResize(event) { + if (!isResizing.value) return; + + const deltaX = event.clientX - startX; + const newWidth = Math.max(minSidebarWidth, Math.min(maxSidebarWidth, startWidth + deltaX)); + sidebarWidth.value = newWidth; + } + + function onMouseUpResize() { + isResizing.value = false; + document.body.style.userSelect = ''; + document.body.style.cursor = ''; + document.removeEventListener('mousemove', onMouseMoveResize); + document.removeEventListener('mouseup', onMouseUpResize); + } + + document.addEventListener('mousemove', onMouseMoveResize); + document.addEventListener('mouseup', onMouseUpResize); +} + \ No newline at end of file + + + \ No newline at end of file diff --git a/dashboard/src/layouts/full/vertical-sidebar/sidebarItem.ts b/dashboard/src/layouts/full/vertical-sidebar/sidebarItem.ts index 861a51e47..190d1f676 100644 --- a/dashboard/src/layouts/full/vertical-sidebar/sidebarItem.ts +++ b/dashboard/src/layouts/full/vertical-sidebar/sidebarItem.ts @@ -18,66 +18,95 @@ export interface menu { // 在组件中使用时需要通过t()函数进行翻译 // 所有键名都使用 core.navigation.* 格式 const sidebarItem: menu[] = [ + // 统计 { title: 'core.navigation.dashboard', icon: 'mdi-view-dashboard', to: '/dashboard/default' }, + + // 平台组 - 折叠菜单 { - title: 'core.navigation.platforms', - icon: 'mdi-message-processing', - to: '/platforms', - }, - { - title: 'core.navigation.providers', - icon: 'mdi-creation', - to: '/providers', - }, - { - title: 'core.navigation.toolUse', - icon: 'mdi-function-variant', - to: '/tool-use' - }, - { - title: 'core.navigation.persona', - icon: 'mdi-heart', - to: '/persona' - }, - { - title: 'core.navigation.extension', - icon: 'mdi-puzzle', - to: '/extension' + title: 'core.navigation.groups.platform', + icon: 'mdi-server-network', + children: [ + { + title: 'core.navigation.platforms', + icon: 'mdi-message-processing', + to: '/platforms', + }, + { + title: 'core.navigation.providers', + icon: 'mdi-creation', + to: '/providers', + }, + { + title: 'core.navigation.toolUse', + icon: 'mdi-function-variant', + to: '/tool-use' + } + ] }, + + // 配置组 - 折叠菜单 { - title: 'core.navigation.knowledgeBase', - icon: 'mdi-text-box-search', - to: '/alkaid/knowledge-base', + title: 'core.navigation.groups.configuration', + icon: 'mdi-cog-outline', + children: [ + { + title: 'core.navigation.config', + icon: 'mdi-cog', + to: '/config', + }, + { + title: 'core.navigation.persona', + icon: 'mdi-heart', + to: '/persona' + }, + { + title: 'core.navigation.knowledgeBase', + icon: 'mdi-text-box-search', + to: '/alkaid/knowledge-base', + } + ] }, + + // 其他组 - 折叠菜单 { - title: 'core.navigation.config', - icon: 'mdi-cog', - to: '/config', + title: 'core.navigation.groups.others', + icon: 'mdi-dots-horizontal', + children: [ + { + title: 'core.navigation.extension', + icon: 'mdi-puzzle', + to: '/extension' + }, + { + title: 'core.navigation.conversation', + icon: 'mdi-database', + to: '/conversation' + }, + { + title: 'core.navigation.sessionManagement', + icon: 'mdi-account-group', + to: '/session-management' + } + ] }, + + // 聊天 - 独立项 { title: 'core.navigation.chat', icon: 'mdi-chat', to: '/chat' }, - { - title: 'core.navigation.conversation', - icon: 'mdi-database', - to: '/conversation' - }, - { - title: 'core.navigation.sessionManagement', - icon: 'mdi-account-group', - to: '/session-management' - }, + + // 控制台 - 独立项 { title: 'core.navigation.console', icon: 'mdi-console', to: '/console' - }, + } // { // title: 'Project ATRI', // icon: 'mdi-grain',