feat(admin): art-design-pro integration with local session auth
P1b Task 9: apps/admin based on art-design-pro v3.0.2 (tag, commit d224dd4; source recorded in apps/admin/SOURCE.md), trimmed to layout/login/i18n/request/table-form core. Login wired to real POST /v1/auth/password (single-token session), Bearer header on all requests, 401 interceptor logout+redirect, request-driven sliding renewal (refresh at ~80% TTL, single-flight), best-effort POST /v1/auth/logout on user-menu logout. One protected stub page (相册管理). Dev port 5176 strictPort + /v1 proxy to 8080. Admin keeps its own eslint9 flat config; root eslint ignores apps/admin/**. vitest unit tests for renewal pacing + Playwright e2e (guard redirect, localized wrong-password error, login lands on stub, token persists across reload, logout clears session). Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* 全局组件配置
|
||||
*
|
||||
* 统一管理系统级全局组件的注册。
|
||||
* 这些组件会在应用启动时全局注册,可在任何地方使用。
|
||||
*
|
||||
* ## 主要功能
|
||||
*
|
||||
* - 组件配置 - 集中管理全局组件的配置信息
|
||||
* - 异步加载 - 使用 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)
|
||||
}
|
||||
Reference in New Issue
Block a user