feat(frontend): 构建前端 MVP,实现完整 UI 框架与 mock 数据层
- 安装 zustand + react-router-dom 依赖 - 修复 Vite 代理配置,添加 /auth 路由转发 - 实现 API 封装层(client.ts 统一 fetch、auth.ts 真实调用) - 实现 mock 数据层(mock.ts 模拟 WebSocket 管线进度) - 实现 4 个 zustand stores(auth/project/task/generation) - 实现 5 个组件(StyleSelector/PromptEditor/GenerateForm/ProgressBar/AssetPreview) - 实现 5 个页面(Login/Register/Project/Generate/Result) - 实现路由含 ProtectedRoute 守卫 - 添加暗色主题全局样式 - 更新前端文档与 API 文档
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* 合并工程风格与任务风格覆盖(任务覆盖优先,与后端 PromptBuilder 逻辑一致)
|
||||
*/
|
||||
export function mergeStyles(
|
||||
projectStyle: Record<string, string>,
|
||||
taskOverrides: Record<string, string>
|
||||
): Record<string, string> {
|
||||
return { ...projectStyle, ...taskOverrides }
|
||||
}
|
||||
|
||||
/**
|
||||
* 风格键分类定义
|
||||
*/
|
||||
export interface StyleCategory {
|
||||
key: string
|
||||
label: string
|
||||
options: { value: string; label: string }[]
|
||||
}
|
||||
|
||||
export const STYLE_CATEGORIES: StyleCategory[] = [
|
||||
{
|
||||
key: 'artStyle',
|
||||
label: '美术风格',
|
||||
options: [
|
||||
{ value: 'pixel', label: '像素' },
|
||||
{ value: 'cartoon', label: '卡通' },
|
||||
{ value: 'hand-drawn', label: '手绘' },
|
||||
{ value: 'vector', label: '矢量' },
|
||||
{ value: 'flat', label: '扁平' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'palette',
|
||||
label: '色调',
|
||||
options: [
|
||||
{ value: 'warm', label: '暖色' },
|
||||
{ value: 'cool', label: '冷色' },
|
||||
{ value: 'neutral', label: '中性' },
|
||||
{ value: 'vibrant', label: '鲜艳' },
|
||||
{ value: 'muted', label: '柔和' },
|
||||
{ value: 'monochrome', label: '单色' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'lineWeight',
|
||||
label: '线条',
|
||||
options: [
|
||||
{ value: 'none', label: '无' },
|
||||
{ value: 'thin', label: '细线' },
|
||||
{ value: 'medium', label: '中等' },
|
||||
{ value: 'thick', label: '粗线' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'scene',
|
||||
label: '场景',
|
||||
options: [
|
||||
{ value: 'forest', label: '森林' },
|
||||
{ value: 'dungeon', label: '地牢' },
|
||||
{ value: 'city', label: '城市' },
|
||||
{ value: 'space', label: '太空' },
|
||||
{ value: 'underwater', label: '水下' },
|
||||
{ value: 'desert', label: '沙漠' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'lighting',
|
||||
label: '光照',
|
||||
options: [
|
||||
{ value: 'bright', label: '明亮' },
|
||||
{ value: 'dim', label: '昏暗' },
|
||||
{ value: 'dramatic', label: '戏剧' },
|
||||
{ value: 'ambient', label: '环境光' },
|
||||
{ value: 'neon', label: '霓虹' },
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'mood',
|
||||
label: '情绪',
|
||||
options: [
|
||||
{ value: 'cheerful', label: '欢快' },
|
||||
{ value: 'dark', label: '黑暗' },
|
||||
{ value: 'mysterious', label: '神秘' },
|
||||
{ value: 'epic', label: '史诗' },
|
||||
{ value: 'calm', label: '平静' },
|
||||
],
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user