侧边栏修正

This commit is contained in:
2025-12-13 16:46:04 +08:00
parent b57a002de8
commit a9b2c729e3
14 changed files with 114 additions and 56 deletions

View File

@@ -96,14 +96,7 @@ import {
Back
} from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
interface MenuItem {
key: string
label: string
icon: string
url?: string
type: 'route' | 'iframe'
}
import type { MenuItem } from 'shared/types'
const router = useRouter()
const route = useRoute()

View File

@@ -108,14 +108,7 @@ import {
Loading
} from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
interface MenuItem {
key: string
label: string
icon: string
url?: string
type: 'route' | 'iframe'
}
import type { MenuItem } from 'shared/types'
const router = useRouter()
const route = useRoute()
@@ -228,7 +221,7 @@ const handleMenuClick = (item: MenuItem) => {
// 所有菜单都通过路由跳转
if (item.url) {
router.push(item.url)
if (item.type === 'iframe') {
if (item.viewType === 'iframe') {
iframeLoading.value = true
}
}

View File

@@ -18,7 +18,7 @@ import {
import type { TbSysViewDTO } from 'shared/types'
import type { RouteRecordRaw } from 'vue-router'
import router from './index'
import { SidebarLayout, BlankLayout, AdminIframeSidebarLayout } from '@/layouts'
import { SidebarLayout, BlankLayout, AdminIframeSidebarLayout, AdminSidebarLayout } from '@/layouts'
// Platform 布局组件映射
const platformLayoutMap: Record<string, () => Promise<any>> = {
@@ -26,7 +26,8 @@ const platformLayoutMap: Record<string, () => Promise<any>> = {
'BlankLayout': () => Promise.resolve({ default: BlankLayout }),
'NavigationLayout': () => Promise.resolve({ default: SidebarLayout }),
'BasicLayout': () => Promise.resolve({ default: SidebarLayout }),
'AdminIframeSidebarLayout': () => Promise.resolve({ default: AdminIframeSidebarLayout })
'AdminIframeSidebarLayout': () => Promise.resolve({ default: AdminIframeSidebarLayout }),
'AdminSidebarLayout': () => Promise.resolve({ default: AdminSidebarLayout })
}
// 视图组件加载器

View File

@@ -16,7 +16,7 @@ const routes: RouteRecordRaw[] = [
]
const router = createRouter({
history: createWebHistory(),
history: createWebHistory('/platform/'),
routes
})

View File

@@ -95,15 +95,28 @@ declare module 'shared/types' {
parentId?: string
url?: string
component?: string
service?: string
iframeUrl?: string
icon?: string
type?: number
viewType?: string
service?: string
layout?: string
orderNum?: number
description?: string
children?: TbSysViewDTO[]
}
// 菜单项类型(扩展 TbSysViewDTO
export interface MenuItem extends TbSysViewDTO {
key: string
label: string
expanded?: boolean
children?: MenuItem[]
}
// 菜单工具函数
export function toMenuItem(view: TbSysViewDTO, expanded?: boolean): MenuItem
export function toMenuItems(views: TbSysViewDTO[], defaultExpanded?: boolean): MenuItem[]
}
declare module 'shared/utils/route' {

View File

@@ -9,8 +9,8 @@ const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
export default defineConfig({
// Platform 是根路径应用
base: '/',
// Platform 应用的基础路径
base: '/platform/',
plugins: [
vue({