ab4f40ba5d
- 克隆 art-design-pro v3.0.2(GitHub depth1),rm .git,pnpm clean:dev 精简演示页(92 文件) - .env.development/.env.production 均设 VITE_API_URL=/api,代理目标 127.0.0.1:8000(移除 Apifox Mock) - http 封装信封适配:code===200 解包 data;msg/message 字段兼容(拦截器/error/类型) - /api/admin/auth/token 登录适配(access->Bearer token, refresh->refreshToken);/api/admin/auth/me 映射 UserInfo(userName/roles/is_admin) - 登录页演示账号替换为真实 admin;logOut 按路由名判登录页修复 redirect 嵌套 - 根 .gitignore 补 !admin/.env(模板公共 env 非密钥,需入库) - 验证:Playwright 全链路(错误密码 401 留登页/正确登录进工作台/登出/受保护路由重定向/redirect 回跳)+ pnpm build(vue-tsc 通过,产物无 mock 域名) Co-Authored-By: Claude Code <noreply@anthropic.com>
106 lines
2.5 KiB
TypeScript
106 lines
2.5 KiB
TypeScript
/**
|
|
* 全局组件配置
|
|
*
|
|
* 统一管理系统级全局组件的注册。
|
|
* 这些组件会在应用启动时全局注册,可在任何地方使用。
|
|
*
|
|
* ## 主要功能
|
|
*
|
|
* - 组件配置 - 集中管理全局组件的配置信息
|
|
* - 异步加载 - 使用 defineAsyncComponent 实现按需加载
|
|
* - 开关控制 - 支持通过 enabled 字段启用/禁用组件
|
|
* - 配置查询 - 提供工具函数快速查询组件配置
|
|
*
|
|
* @module config/component
|
|
* @author Art Design Pro Team
|
|
*/
|
|
|
|
import { defineAsyncComponent } from 'vue'
|
|
|
|
/**
|
|
* 全局组件配置列表
|
|
*/
|
|
export const globalComponentsConfig: GlobalComponentConfig[] = [
|
|
{
|
|
name: '设置面板',
|
|
key: 'settings-panel',
|
|
component: defineAsyncComponent(
|
|
() => import('@/components/core/layouts/art-settings-panel/index.vue')
|
|
),
|
|
enabled: true
|
|
},
|
|
{
|
|
name: '全局搜索',
|
|
key: 'global-search',
|
|
component: defineAsyncComponent(
|
|
() => import('@/components/core/layouts/art-global-search/index.vue')
|
|
),
|
|
enabled: true
|
|
},
|
|
{
|
|
name: '锁屏',
|
|
key: 'screen-lock',
|
|
component: defineAsyncComponent(
|
|
() => import('@/components/core/layouts/art-screen-lock/index.vue')
|
|
),
|
|
enabled: true
|
|
},
|
|
{
|
|
name: '聊天窗口',
|
|
key: 'chat-window',
|
|
component: defineAsyncComponent(
|
|
() => import('@/components/core/layouts/art-chat-window/index.vue')
|
|
),
|
|
enabled: true
|
|
},
|
|
{
|
|
name: '礼花效果',
|
|
key: 'fireworks-effect',
|
|
component: defineAsyncComponent(
|
|
() => import('@/components/core/layouts/art-fireworks-effect/index.vue')
|
|
),
|
|
enabled: true
|
|
},
|
|
{
|
|
name: '水印效果',
|
|
key: 'watermark',
|
|
component: defineAsyncComponent(
|
|
() => import('@/components/core/others/art-watermark/index.vue')
|
|
),
|
|
enabled: true
|
|
}
|
|
]
|
|
|
|
/**
|
|
* 全局组件配置接口
|
|
*/
|
|
export interface GlobalComponentConfig {
|
|
/** 组件名称 */
|
|
name: string
|
|
/** 组件标识 */
|
|
key: string
|
|
/** 组件 */
|
|
component: any
|
|
/** 是否启用 */
|
|
enabled?: boolean
|
|
/** 组件描述 */
|
|
description?: string
|
|
}
|
|
|
|
/**
|
|
* 获取启用的全局组件
|
|
* @returns 已启用的组件配置列表
|
|
*/
|
|
export const getEnabledGlobalComponents = () => {
|
|
return globalComponentsConfig.filter((config) => config.enabled !== false)
|
|
}
|
|
|
|
/**
|
|
* 根据 key 获取组件配置
|
|
* @param key 组件标识
|
|
* @returns 组件配置对象
|
|
*/
|
|
export const getGlobalComponentByKey = (key: string) => {
|
|
return globalComponentsConfig.find((config) => config.key === key)
|
|
}
|