feat(experience-center): 统一侧栏与页头,优化云端大脑、图片和视频生成界面

This commit is contained in:
zhanjunhao
2026-11-20 21:38:32 +08:00
parent 436195a229
commit ef67244aea
18 changed files with 1045 additions and 678 deletions
+16
View File
@@ -10,6 +10,22 @@
## 2026-11-20 ## 2026-11-20
### 优化 · 体验中心页头与图片生成布局
- **范围**:体验中心云端大脑、图片生成、视频生成三页(新创作台灰度开启时的页面不在此范围)。
- **变更**:三页页头统一为用户中心规格(面包屑“体验中心 / 当前页面”、28 / 32px 标题、14 / 22px 副标题、右侧操作),内容边距读取 `--uc-page-pad-*`;去掉图片、视频标题前的图标;图片生成表单卡标题改为“参数设置”,移动端收起时显示当前模型;云端大脑的使用指引与可用专家数移到页头右侧。图片生成宽屏下左侧参数栏固定,右侧生成历史整列局部滚动;视频生成宽屏下任务队列展开改为自底向上的浮层覆盖,不再挤压参数与预览区,支持 Esc 收起;队列表格样式与交互对齐密钥管理列表(middle 尺寸、46px 常规字重表头、文字链接操作),分页器移出表格滚动区并改为前端分页,修复切换每页条数时的布局抖动;任务 ID 完整纯文本展示,状态标签去掉图标、仅保留文字与边框并在单元格内水平垂直居中;图片、视频、云端大脑三页底部内边距统一减半;云端大脑“专家广场 / 我的任务”改为与 `/console/analytics` 一致的线型页签(企业中心宿主保留原分段按钮);图片生成历史工具栏合并为单行(模型、尺寸筛选并入首行),卡片提示词单行省略、缩略图 3:2,单一时间分组时省略分组标题(多分组时为紧凑标签),1920 宽屏常见浏览器可视高度(约 950px)下可完整看到工具栏与两行图片。右侧滚动视口 12px 圆角与左侧参数卡底边对齐,无匹配任务时空状态在列表区水平垂直居中。宽屏舒适密度下两行卡片按可视高度均分拉伸(行高 260–440px),第二行底边与左侧参数卡底边对齐;“清除筛选”移到筛选区最前、图标文字居中,出现时不推动下拉框;模型 / 尺寸下拉固定 190 / 128px,超长名称省略并在悬停时提示全名。对比模式勾选框缩小为 28px 浮层并修正复选框居中(去掉 antd 外层占位伪元素);云端大脑页头与页签间距减为 8px。三页(新创作台除外)页底与 `/console/analytics` 统一为 `--uc-page-bg`,云端大脑不再叠加装饰光晕;已在系统主题预设与自定义主色、浅深模式下验证。
- **影响**:重置、移动端折叠、视频参数折叠、任务队列刷新 / 删除 / 播放、使用指引、专家 / 任务页签与无限加载行为不变;企业中心的云端大脑保留原卡片页头。
- **回滚**:按文件还原下列文件,并删除 `ExperiencePageHeader.jsx` 与 `experience-page.css`。
- **关联**:`src/pages/ExperienceCenter/components/{ExperiencePageHeader,ImageGeneration,VideoGeneration}.jsx`、`src/pages/ExperienceCenter/components/AICreation/{ImageGenerationForm,ImageGenerationTab,ImageTaskList,Video/VideoTaskQueue}.jsx`、`ImageTaskList.css`、`src/pages/ExperienceCenter/experience-page.css`、`src/pages/ExperienceCenter/components/AICreation/{Image/ImageGenerationForm,Video/VideoWorkspace}.css`、`src/pages/CloudBrain/{index.jsx,cloud-brain.css}`、`docs/ui/GLOBAL_UI_BASELINE.md`。
### 优化 · 体验中心侧栏对齐用户中心
- **范围**:体验中心桌面端侧栏(云端大脑、图片生成、视频生成)。
- **变更**:移除“体验中心”标题块与毛玻璃、渐变、选中竖条等装饰,改用用户中心侧栏同一套 `ui-center-sidebar` 结构与样式;底部按钮改为“收起导航 / 展开导航”,收起态仅显示图标并以 `title` 提示;BETA 标记与未读角标保留。
- **影响**:展开 / 收起宽度、菜单项尺寸、选中色与用户中心一致,折叠状态在两个中心间同步;不改路由、模块可见性判定与移动端底部导航。
- **回滚**:按文件还原 `ExperienceSidebar.jsx`、`ExperienceCenter/index.jsx` 与 `center-layout.css` 的对应段落。
- **关联**:`src/pages/ExperienceCenter/components/ExperienceSidebar.jsx`、`src/pages/ExperienceCenter/index.jsx`、`src/styles/center-layout.css`。
### 修复 · 图片生成历史首载闪烁 ### 修复 · 图片生成历史首载闪烁
- **范围**:体验中心图片生成页的历史缩略图。 - **范围**:体验中心图片生成页的历史缩略图。
+1 -1
View File
@@ -76,7 +76,7 @@
1. **内容边距**:读取 `user-center.css` 的 `--uc-page-pad-top/x/bottom`(桌面 30 / 36 / 36px,≤ 768px 为 16 / 16 / 24px)。普通页面根节点用 `.uc-page`;数据看板 `.uc-dashboard`、服务监控 `.user-center-service-page`(`calc(64px + 顶距)`,抵消宿主 `-mt-[64px]`)、下载页 `.weyai-download--embedded` 直接引用这些变量。企业功能页(`.org-*-page`、`.knowledge-page`、`.org-workbench`)走 `org-page.css`。禁止写死页面级边距或使用 `p-4 sm:p-6 lg:p-8`。工作区块间距 `--uc-layout-gap: 18px`。 1. **内容边距**:读取 `user-center.css` 的 `--uc-page-pad-top/x/bottom`(桌面 30 / 36 / 36px,≤ 768px 为 16 / 16 / 24px)。普通页面根节点用 `.uc-page`;数据看板 `.uc-dashboard`、服务监控 `.user-center-service-page`(`calc(64px + 顶距)`,抵消宿主 `-mt-[64px]`)、下载页 `.weyai-download--embedded` 直接引用这些变量。企业功能页(`.org-*-page`、`.knowledge-page`、`.org-workbench`)走 `org-page.css`。禁止写死页面级边距或使用 `p-4 sm:p-6 lg:p-8`。工作区块间距 `--uc-layout-gap: 18px`。
2. **页头**:用户中心用 `<UserCenterPageHeader title subtitle extra />`,企业中心用 `OrgPageHeader`(内部复用前者)。面包屑 12 / 18px,距内容区顶 30px,父级 `--text-secondary`、当前项 `--text-primary`,分隔符左右 10px,与标题 24px;标题 28 / 32px / 650 / 字距 -0.6px(`--uc-heading`);副标题 14 / 22px、上距 6px(`--uc-subtitle`);页头与首块 18px;右侧操作放 `extra`(间距 8px,窄屏换行)。页面不得覆盖这些数值,数据看板只保留 hero 装饰层。 2. **页头**:用户中心用 `<UserCenterPageHeader title subtitle extra />`,企业中心用 `OrgPageHeader`(内部复用前者)。面包屑 12 / 18px,距内容区顶 30px,父级 `--text-secondary`、当前项 `--text-primary`,分隔符左右 10px,与标题 24px;标题 28 / 32px / 650 / 字距 -0.6px(`--uc-heading`);副标题 14 / 22px、上距 6px(`--uc-subtitle`);页头与首块 18px;右侧操作放 `extra`(间距 8px,窄屏换行)。页面不得覆盖这些数值,数据看板只保留 hero 装饰层。
3. **面包屑登记**:用户中心在 `UserCenterBreadcrumb.jsx` 的 `pageTitles` 登记,显示“用户中心 / 当前页面”;企业中心在 `OrgBreadcrumb` 的 `orgPageGroups` 登记,分组页显示“分组 / 当前页面”,其他为“企业中心 / 当前页面”,未登记页面以标题兜底。带 hero 的企业功能页在 hero 内首个元素顶部放 `<OrgBreadcrumb />`。不在原本没有面包屑的页面新增导航;没有副标题文案时只传 `title`。 3. **面包屑登记**:用户中心在 `UserCenterBreadcrumb.jsx` 的 `pageTitles` 登记,显示“用户中心 / 当前页面”;企业中心在 `OrgBreadcrumb` 的 `orgPageGroups` 登记,分组页显示“分组 / 当前页面”,其他为“企业中心 / 当前页面”,未登记页面以标题兜底;体验中心(云端大脑 / 图片生成 / 视频生成)用 `ExperiencePageHeader`(内部复用 `UserCenterPageHeader`),显示“体验中心 / 当前页面”,企业中心宿主的云端大脑保留原卡片页头。带 hero 的企业功能页在 hero 内首个元素顶部放 `<OrgBreadcrumb />`。不在原本没有面包屑的页面新增导航;没有副标题文案时只传 `title`。
4. **滚动条**:全站滑块 `#8b8b8b`、悬停 `#636363`、宽高 6px、圆角 3px、轨道透明,值来自 `tokens.css` 的 `--brand-scroll` / `--brand-scroll-hover`,规则集中在 `src/index.css`。页面 CSS 与内联样式禁止设置 `scrollbar-width` / `scrollbar-color`(Chrome 121+ 设置后会忽略 `::-webkit-scrollbar`),标准属性只在 `@supports not selector(::-webkit-scrollbar)` 中给 Firefox。三中心操作表格沿用 Ant Design 固定列表格的横向滚动行为,不隐藏滚动条。 4. **滚动条**:全站滑块 `#8b8b8b`、悬停 `#636363`、宽高 6px、圆角 3px、轨道透明,值来自 `tokens.css` 的 `--brand-scroll` / `--brand-scroll-hover`,规则集中在 `src/index.css`。页面 CSS 与内联样式禁止设置 `scrollbar-width` / `scrollbar-color`(Chrome 121+ 设置后会忽略 `::-webkit-scrollbar`),标准属性只在 `@supports not selector(::-webkit-scrollbar)` 中给 Firefox。三中心操作表格沿用 Ant Design 固定列表格的横向滚动行为,不隐藏滚动条。
5. **验证**:逐页核对左右边距、面包屑顶距、标题与副标题字号间距、滚动条静止与悬停颜色(桌面 / 移动 × 浅 / 深)。 5. **验证**:逐页核对左右边距、面包屑顶距、标题与副标题字号间距、滚动条静止与悬停颜色(桌面 / 移动 × 浅 / 深)。
+51
View File
@@ -126,6 +126,39 @@
line-height: 1.1; line-height: 1.1;
} }
/* 体验中心宿主:内容边距与页头对齐用户中心规范(GLOBAL_UI_BASELINE 4.4),
企业中心宿主仍用上方 .brain-hero 卡片页头,不受影响 */
.cloud-brain-shell.cloud-brain-shell--experience {
/* 底部取标准下边距的一半,与图片生成 / 视频生成页统一 */
padding: var(--uc-page-pad-top) var(--uc-page-pad-x)
calc(var(--uc-page-pad-bottom) / 2);
}
/* 页头与下方页签间距:标准 18px 减 10px,页签自带上内边距,视觉上更紧凑 */
.cloud-brain-shell .brain-page-header.uc-page-header {
margin-bottom: 8px;
}
/* 页头右侧“可用专家”统计:与“使用指引”按钮同高(32px)的描边胶囊 */
.brain-header-stat {
display: inline-flex;
align-items: center;
gap: 8px;
height: 32px;
padding: 0 12px;
border: 1px solid var(--border-subtle);
border-radius: 8px;
background: var(--brain-paper);
color: var(--brain-muted);
font-size: 13px;
line-height: 20px;
white-space: nowrap;
}
.brain-header-stat strong {
color: var(--brain-sage);
font-size: 16px;
font-weight: 600;
font-variant-numeric: tabular-nums;
}
/* 使用指引胶囊(PageGuide 通用组件):落在 tabs 与内容之间 */ /* 使用指引胶囊(PageGuide 通用组件):落在 tabs 与内容之间 */
.cloud-brain-shell .page-guide-pill { .cloud-brain-shell .page-guide-pill {
margin: 0 0 16px; margin: 0 0 16px;
@@ -160,6 +193,24 @@
box-shadow: 0 2px 8px box-shadow: 0 2px 8px
color-mix(in srgb, var(--ui-color-primary) 25%, transparent); color-mix(in srgb, var(--ui-color-primary) 25%, transparent);
} }
/* 体验中心:页签对齐 /console/analytics(antd 线型 Tabs):图标 16px、图标与文字间距 8px、
选中 / 悬停为品牌色 2px 下划线(antd 主题默认),导航与下方内容间距 16px */
.brain-view-tabs > .ant-tabs-nav {
margin-bottom: 16px;
}
.brain-view-tab {
display: flex;
align-items: center;
gap: 8px;
}
.brain-view-tab > svg {
flex: none;
width: 16px;
height: 16px;
}
.brain-view-tab .brain-live-dot {
margin-inline-start: 2px;
}
.brain-live-dot { .brain-live-dot {
width: 7px; width: 7px;
height: 7px; height: 7px;
+66 -1
View File
@@ -68,6 +68,8 @@ import {
PageGuidePill, PageGuidePill,
PageGuideTrigger, PageGuideTrigger,
} from '../../components/common/PageGuide'; } from '../../components/common/PageGuide';
import { Tabs } from 'antd';
import ExperiencePageHeader from '../ExperienceCenter/components/ExperiencePageHeader';
import './cloud-brain.css'; import './cloud-brain.css';
// Must match GetCloudBrainRun's per-request event limit; the timeline pages // Must match GetCloudBrainRun's per-request event limit; the timeline pages
@@ -1772,7 +1774,9 @@ const CloudBrain = ({ organization = false, orgId = 0, canManage = false }) => {
return ( return (
<section <section
className='cloud-brain-shell app-scrollbar' className={`cloud-brain-shell app-scrollbar${
organization ? '' : ' cloud-brain-shell--experience'
}`}
aria-label={t('云端大脑')} aria-label={t('云端大脑')}
> >
<div className='brain-atmosphere' aria-hidden='true'> <div className='brain-atmosphere' aria-hidden='true'>
@@ -1781,6 +1785,7 @@ const CloudBrain = ({ organization = false, orgId = 0, canManage = false }) => {
<span className='brain-grid' /> <span className='brain-grid' />
</div> </div>
{organization ? (
<header className='brain-hero'> <header className='brain-hero'>
<div> <div>
<div className='brain-eyebrow'> <div className='brain-eyebrow'>
@@ -1811,7 +1816,31 @@ const CloudBrain = ({ organization = false, orgId = 0, canManage = false }) => {
</div> </div>
</div> </div>
</header> </header>
) : (
// 体验中心:页头对齐用户中心规范(面包屑 + 28px 标题 + 副标题 + 右侧操作)
<ExperiencePageHeader
className='brain-page-header'
title={t('云端大脑')}
titleSuffix={<BetaBadge />}
subtitle={t(
'选择经过审核的专业专家,把真实业务信息转化为结构清晰、可直接使用的成果。',
)}
extra={
<>
<PageGuideTrigger guide={guide} />
<span
className='brain-header-stat'
title={t('固定技能 · 全程可追溯')}
>
<span>{t('可用专家')}</span>
<strong>{experts.length}</strong>
</span>
</>
}
/>
)}
{organization ? (
<nav className='brain-tabs' aria-label={t('云端大脑导航')}> <nav className='brain-tabs' aria-label={t('云端大脑导航')}>
<button <button
type='button' type='button'
@@ -1838,6 +1867,42 @@ const CloudBrain = ({ organization = false, orgId = 0, canManage = false }) => {
)} )}
</button> </button>
</nav> </nav>
) : (
// 体验中心:列表页签(UI_COMPONENT_STANDARDS 列表页签规范),只承担导航,内容仍由 view 渲染
<Tabs
className='brain-view-tabs'
activeKey={view}
onChange={setView}
aria-label={t('云端大脑导航')}
items={[
{
key: 'experts',
label: (
<span className='brain-view-tab'>
<ActionBot size={16} aria-hidden='true' />
{t('专家广场')}
</span>
),
},
{
key: 'runs',
label: (
<span className='brain-view-tab'>
<ListChecks size={16} aria-hidden='true' />
{t('我的任务')}
{runs.some((run) => !terminalStatuses.has(run.status)) && (
<span
className='brain-live-dot'
role='status'
aria-label={t('有任务执行中')}
/>
)}
</span>
),
},
]}
/>
)}
<PageGuidePill guide={guide} /> <PageGuidePill guide={guide} />
@@ -41,21 +41,11 @@
flex: none; flex: none;
align-items: center; align-items: center;
gap: 10px; gap: 10px;
padding: 15px 16px; min-height: 62px;
padding: 14px 16px;
border-bottom: 1px solid var(--igf-line); border-bottom: 1px solid var(--igf-line);
} }
.igf-header-icon {
display: grid;
flex: none;
place-items: center;
width: 40px;
height: 40px;
border-radius: 10px;
background: var(--brand-selection-bg);
color: var(--brand-selection-text);
}
.igf-header-copy { .igf-header-copy {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
@@ -68,14 +58,16 @@
} }
.igf-title { .igf-title {
/* 卡片区块标题:与右侧“生成历史”同级(18 / 26px / 650),页面级标题在 ExperiencePageHeader */
margin: 0; margin: 0;
font-size: 21px; font-size: 18px;
font-weight: 650; font-weight: 650;
line-height: 27px; line-height: 26px;
} }
.igf-description { .igf-description {
display: block; display: block;
white-space: nowrap;
overflow: hidden; overflow: hidden;
color: var(--igf-muted); color: var(--igf-muted);
font-size: 12px; font-size: 12px;
@@ -21,13 +21,7 @@ import {
Tooltip, Tooltip,
Typography, Typography,
} from '@/components/ui'; } from '@/components/ui';
import { import { Command, Image as ImageIcon, Lock, Type } from 'lucide-react';
Command,
Image as ImageIcon,
Lock,
Sparkles,
Type,
} from 'lucide-react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { MODEL_CATEGORY } from '../../../../constants'; import { MODEL_CATEGORY } from '../../../../constants';
@@ -513,23 +507,18 @@ const ImageGenerationForm = ({ creation }) => {
onDrop={handleDrop} onDrop={handleDrop}
> >
<header className='igf-header'> <header className='igf-header'>
<span className='igf-header-icon' aria-hidden='true'> {/* 页面标题与说明已上移到页级页头(ExperiencePageHeader),卡片内只保留区块标题;
<Sparkles size={19} /> 移动端收起表单时在标题下显示当前模型,便于确认 */}
</span>
<div className='igf-header-copy'> <div className='igf-header-copy'>
<h1 className='igf-title'>{t('图片生成')}</h1> <h2 className='igf-title'>{t('参数设置')}</h2>
{formBodyHidden && selectedModel ? (
<span <span
className='igf-description' className='igf-description'
title={ title={selectedModel.display_name || selectedModel.model}
formBodyHidden
? selectedModel?.display_name || selectedModel?.model
: undefined
}
> >
{formBodyHidden && selectedModel {selectedModel.display_name || selectedModel.model}
? selectedModel.display_name || selectedModel.model
: t('输入描述即可生成图片')}
</span> </span>
) : null}
</div> </div>
<div className='igf-header-actions'> <div className='igf-header-actions'>
{!formBodyHidden && ( {!formBodyHidden && (
@@ -68,7 +68,7 @@ const ImageGenerationTab = () => {
<ImageGenerationForm creation={creation} /> <ImageGenerationForm creation={creation} />
</div> </div>
<div className='min-w-0 lg:flex-1 lg:min-h-0 flex flex-col'> <div className='image-generation-results app-scrollbar min-w-0 lg:flex-1 lg:min-h-0 flex flex-col'>
<ImageTaskList <ImageTaskList
tasks={tasks} tasks={tasks}
onRefresh={refreshTasks} onRefresh={refreshTasks}
@@ -13,7 +13,8 @@
.image-history-toolbar { .image-history-toolbar {
flex: none; flex: none;
padding: 16px; /* 单行工具栏:标题 + 状态 | 筛选 + 搜索 + 操作,宽屏约 58px 高,为图片网格让出纵向空间 */
padding: 10px 16px;
border: 1px solid var(--border-subtle); border: 1px solid var(--border-subtle);
border-radius: 12px; border-radius: 12px;
background: var(--surface-card); background: var(--surface-card);
@@ -53,6 +54,7 @@
.image-history-clear { .image-history-clear {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center;
gap: 6px; gap: 6px;
min-height: 34px; min-height: 34px;
padding: 4px 8px; padding: 4px 8px;
@@ -93,10 +95,18 @@
color: inherit; color: inherit;
} }
.image-history-actions {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 8px;
min-width: 0;
margin-inline-start: auto;
}
.image-history-filters { .image-history-filters {
margin-top: 12px; flex-wrap: nowrap;
padding-top: 12px;
border-top: 1px solid var(--border-subtle);
} }
.image-history-tools { .image-history-tools {
@@ -112,11 +122,27 @@
.image-history-tools .ant-btn { .image-history-tools .ant-btn {
flex-shrink: 0; flex-shrink: 0;
} }
/* 筛选下拉固定宽度:内容超出时省略号截断,悬停提示全名(Typography ellipsis tooltip) */
.image-task-model-filter { .image-task-model-filter {
width: min(100%, 190px); flex: none;
width: 190px;
} }
.image-task-size-filter { .image-task-size-filter {
width: min(100%, 128px); flex: none;
width: 128px;
}
.image-history-filters .image-filter-text,
.ant-select-dropdown .image-filter-text {
display: block;
max-width: 100%;
color: inherit;
font: inherit;
}
/* antd 选择器的输入层覆盖在选中文字上,抬高文字层让悬停能触发全名提示;
点击仍冒泡到选择器本身,展开 / 键盘操作不受影响 */
.image-history-filters .image-filter-text {
position: relative;
z-index: 1;
} }
.image-history-tools .ant-btn[aria-pressed='true'], .image-history-tools .ant-btn[aria-pressed='true'],
@@ -140,7 +166,7 @@
min-height: 0; min-height: 0;
} }
.image-history-content { .image-history-content {
padding: 16px 0 4px; padding: 10px 0 4px;
} }
.image-history-empty-description { .image-history-empty-description {
@@ -157,14 +183,16 @@
.image-task-group-header { .image-task-group-header {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 6px;
margin-bottom: 12px; margin-bottom: 8px;
} }
/* 紧凑分组标签:12 / 18px 次级文字,仅作时间分隔,不与卡片争夺视觉层级 */
.image-task-group-header h3 { .image-task-group-header h3 {
margin: 0; margin: 0;
font-size: 15px; color: var(--text-secondary);
line-height: 22px; font-size: 12px;
font-weight: 650; line-height: 18px;
font-weight: 600;
} }
.image-task-group-header::after { .image-task-group-header::after {
content: ''; content: '';
@@ -179,7 +207,7 @@
auto-fill, auto-fill,
minmax(min(100%, var(--ih-card-min)), 1fr) minmax(min(100%, var(--ih-card-min)), 1fr)
); );
gap: 16px; gap: 12px;
} }
.image-task-grid[data-density='compact'] { .image-task-grid[data-density='compact'] {
@@ -209,12 +237,14 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
padding: 10px; padding: 8px;
} }
/* 缩略图 3:2:1920 屏常见浏览器可视高度(约 950px)下,单行工具栏 + 两行卡片恰好完整展示;
完整图片通过点击预览 / 查看 */
.image-task-media { .image-task-media {
position: relative; position: relative;
aspect-ratio: 4 / 3; aspect-ratio: 3 / 2;
overflow: hidden; overflow: hidden;
border-radius: 8px; border-radius: 8px;
background: var(--surface-bg-base); background: var(--surface-bg-base);
@@ -275,9 +305,33 @@
color: var(--text-secondary); color: var(--text-secondary);
} }
/* 对比模式勾选框:28px 浮层,复选框水平垂直居中;去掉 antd 外层 ::after 占位(它在 grid 下多占一格导致偏移) */
.image-task-select.ant-checkbox-wrapper {
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
min-width: 28px;
height: 28px;
padding: 0;
border-radius: 7px;
background: color-mix(in srgb, var(--surface-card) 88%, transparent);
cursor: pointer;
}
.image-task-select.ant-checkbox-wrapper::after {
display: none;
}
.image-task-select.ant-checkbox-wrapper .ant-checkbox { .image-task-select.ant-checkbox-wrapper .ant-checkbox {
top: 0;
align-self: center; align-self: center;
} }
.image-task-select.ant-checkbox-wrapper .ant-checkbox + span:empty {
display: none;
}
.image-task-select.ant-checkbox-wrapper:hover,
.image-task-select.ant-checkbox-wrapper-checked {
border-color: var(--brand-accent);
}
.image-task-placeholder { .image-task-placeholder {
position: absolute; position: absolute;
@@ -349,12 +403,14 @@
display: flex; display: flex;
flex: 1; flex: 1;
flex-direction: column; flex-direction: column;
gap: 6px; gap: 4px;
padding: 10px 3px 2px; padding: 6px 2px 0;
min-width: 0; min-width: 0;
} }
/* 提示词单行省略(完整内容见 title 悬浮提示),卡片更矮,1920×1080 下可同时看到两行图片 */
.image-task-prompt { .image-task-prompt {
min-height: 40px; -webkit-line-clamp: 1;
min-height: 20px;
font-size: 14px; font-size: 14px;
line-height: 20px; line-height: 20px;
font-weight: 600; font-weight: 600;
@@ -381,7 +437,7 @@
display: flex; display: flex;
gap: 6px; gap: 6px;
margin-top: auto; margin-top: auto;
padding-top: 8px; padding-top: 4px;
border-top: 1px solid var(--border-subtle); border-top: 1px solid var(--border-subtle);
} }
.image-task-primary-action { .image-task-primary-action {
@@ -389,7 +445,7 @@
min-width: 0; min-width: 0;
} }
.image-task-actions .ant-btn { .image-task-actions .ant-btn {
min-height: 30px; min-height: 28px;
} }
.image-task-list button:focus-visible { .image-task-list button:focus-visible {
outline: 2px solid var(--brand-accent); outline: 2px solid var(--brand-accent);
@@ -415,6 +471,10 @@
.image-history-toolbar { .image-history-toolbar {
padding: 12px; padding: 12px;
} }
.image-history-actions,
.image-history-filters {
width: 100%;
}
.image-history-tools { .image-history-tools {
width: 100%; width: 100%;
} }
@@ -427,3 +487,13 @@
min-width: 0; min-width: 0;
} }
} }
/* 清除筛选:图标与文字水平垂直居中,与下拉框同高 */
.image-history-clear {
min-height: 32px;
line-height: 1;
}
.image-history-clear > :is(svg, .app-action-icon) {
flex: none;
display: block;
}
@@ -533,11 +533,22 @@ const ImageTaskList = ({
setSearchKeyword(''); setSearchKeyword('');
}; };
// 筛选下拉:固定宽度,文字超出时省略号截断,仅在被截断时悬停提示全名
const renderFilterLabel = (item) => (
<Typography.Text
className='image-filter-text'
ellipsis={{ tooltip: item?.label }}
>
{item?.label}
</Typography.Text>
);
const renderFilterOption = (option) => renderFilterLabel(option);
return ( return (
<section className='image-task-list' aria-labelledby='image-history-title'> <section className='image-task-list' aria-labelledby='image-history-title'>
{/* 顶部:标题 + 状态徽标 tab + 操作 */} {/* 顶部:标题 + 状态徽标 tab + 操作 */}
<div className='image-history-toolbar'> <div className='image-history-toolbar'>
{/* 第一行:状态 tabs + 操作 */} {/* 单行:标题 + 状态 tabs | 筛选 + 搜索 + 操作 */}
<div className='image-history-heading'> <div className='image-history-heading'>
<div className='image-history-title-row'> <div className='image-history-title-row'>
<h2 id='image-history-title'>{t('生成历史')}</h2> <h2 id='image-history-title'>{t('生成历史')}</h2>
@@ -560,6 +571,55 @@ const ImageTaskList = ({
</div> </div>
</div> </div>
<div className='image-history-actions'>
{/* 筛选与工具并入同一行(宽屏单行,窄屏自动换行),让出更多图片可视高度 */}
{(modelOptions.length > 0 || sizeOptions.length > 0) && (
<div className='image-history-filters'>
{/* 清除筛选放在最前:筛选区整体右对齐,出现 / 消失时只向左伸缩,下拉框与右侧工具位置不动 */}
{hasActiveFilters && (
<button
type='button'
onClick={clearAllFilters}
className='image-history-clear'
>
<ActionX size={11} />
{t('清除筛选')}
</button>
)}
<Select
value={modelFilter}
onChange={setModelFilter}
className='image-task-model-filter'
renderSelectedItem={renderFilterLabel}
renderOptionItem={renderFilterOption}
aria-label={t('模型')}
placeholder={t('模型')}
>
<Select.Option value='all'>{t('全部模型')}</Select.Option>
{modelOptions.map((m) => (
<Select.Option key={m} value={m}>
{m}
</Select.Option>
))}
</Select>
<Select
value={sizeFilter}
onChange={setSizeFilter}
className='image-task-size-filter'
renderSelectedItem={renderFilterLabel}
renderOptionItem={renderFilterOption}
aria-label={t('尺寸')}
placeholder={t('尺寸')}
>
<Select.Option value='all'>{t('全部尺寸')}</Select.Option>
{sizeOptions.map((s) => (
<Select.Option key={s} value={s}>
{s}
</Select.Option>
))}
</Select>
</div>
)}
<div className='image-history-tools'> <div className='image-history-tools'>
<Input <Input
prefix={<Search size={14} />} prefix={<Search size={14} />}
@@ -653,50 +713,7 @@ const ImageTaskList = ({
/> />
</div> </div>
</div> </div>
{/* 第二行:筛选 chips(仅在有可选/激活时显示) */}
{(modelOptions.length > 0 || sizeOptions.length > 0) && (
<div className='image-history-filters'>
<Select
value={modelFilter}
onChange={setModelFilter}
className='image-task-model-filter'
aria-label={t('模型')}
placeholder={t('模型')}
>
<Select.Option value='all'>{t('全部模型')}</Select.Option>
{modelOptions.map((m) => (
<Select.Option key={m} value={m}>
{m}
</Select.Option>
))}
</Select>
<Select
value={sizeFilter}
onChange={setSizeFilter}
className='image-task-size-filter'
aria-label={t('尺寸')}
placeholder={t('尺寸')}
>
<Select.Option value='all'>{t('全部尺寸')}</Select.Option>
{sizeOptions.map((s) => (
<Select.Option key={s} value={s}>
{s}
</Select.Option>
))}
</Select>
{hasActiveFilters && (
<button
type='button'
onClick={clearAllFilters}
className='image-history-clear'
>
<ActionX size={11} />
{t('清除筛选')}
</button>
)}
</div> </div>
)}
{/* 多选模式下的操作条 */} {/* 多选模式下的操作条 */}
{selectMode && ( {selectMode && (
@@ -727,7 +744,7 @@ const ImageTaskList = ({
<div className='task-list-scrollable app-scrollbar'> <div className='task-list-scrollable app-scrollbar'>
<div className='image-history-content'> <div className='image-history-content'>
{filteredTasks.length === 0 ? ( {filteredTasks.length === 0 ? (
<div className='py-6'> <div className='image-history-empty py-6'>
<Empty <Empty
image={ image={
<IllustrationNoContent style={{ width: 150, height: 150 }} /> <IllustrationNoContent style={{ width: 150, height: 150 }} />
@@ -779,12 +796,16 @@ const ImageTaskList = ({
<div className='space-y-4'> <div className='space-y-4'>
{groupedTasks.map((group) => ( {groupedTasks.map((group) => (
<div key={group.key}> <div key={group.key}>
{/* 只有一个时间分组时标题不提供额外信息(总数已在“全部”页签),直接省略以让出图片高度;
多个分组时保留紧凑的分组标签 */}
{groupedTasks.length > 1 && (
<div className='image-task-group-header'> <div className='image-task-group-header'>
<h3>{group.label}</h3> <h3>{group.label}</h3>
<span className='image-history-count'> <span className='image-history-count'>
{group.tasks.length} {group.tasks.length}
</span> </span>
</div> </div>
)}
<div className='image-task-grid' data-density={density}> <div className='image-task-grid' data-density={density}>
{group.tasks.map((task) => renderTaskCard(task))} {group.tasks.map((task) => renderTaskCard(task))}
</div> </div>
@@ -1,5 +1,4 @@
import { import {
Play as ActionPlay,
Download as ActionDownload, Download as ActionDownload,
RefreshCw as ActionRefreshCw, RefreshCw as ActionRefreshCw,
Trash2 as ActionTrash2, Trash2 as ActionTrash2,
@@ -7,23 +6,18 @@ import {
ChevronDown as ActionChevronDown, ChevronDown as ActionChevronDown,
} from '@/components/common/icons/ActionIcons'; } from '@/components/common/icons/ActionIcons';
import React, { useState, useId } from 'react'; import React, { useState, useId } from 'react';
import { Button as AntButton } from 'antd';
import { import {
Table, Table,
Button, Button,
Space, Space,
Tag, Tag,
Progress, Progress,
Tooltip,
Modal, Modal,
Badge, Badge,
Pagination,
} from '@/components/ui'; } from '@/components/ui';
import { import { ListVideo } from 'lucide-react';
ListVideo,
CheckCircle2,
AlertCircle,
Clock,
Loader2,
} from 'lucide-react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useIsMobile } from '../../../../../hooks/common/useIsMobile'; import { useIsMobile } from '../../../../../hooks/common/useIsMobile';
import { import {
@@ -47,55 +41,37 @@ const VideoTaskQueue = ({
// 8 列合计 1190px 塞进 ~340px 容器、按钮全带文字,实际完全用不了。 // 8 列合计 1190px 塞进 ~340px 容器、按钮全带文字,实际完全用不了。
const isCompact = useIsMobile(); const isCompact = useIsMobile();
const [selectedTasks, setSelectedTasks] = useState([]); const [selectedTasks, setSelectedTasks] = useState([]);
// 前端分页:分页器放在表格滚动区之外(与密钥管理一致),切换每页条数时不再在滚动区内撑出滚动条造成抖动
const [page, setPage] = useState(1);
const [pageSize, setPageSize] = useState(10);
const queueId = useId(); const queueId = useId();
const pageCount = Math.max(1, Math.ceil(tasks.length / pageSize));
const currentPage = Math.min(page, pageCount);
const pagedTasks = tasks.slice(
(currentPage - 1) * pageSize,
currentPage * pageSize,
);
// 状态标签映射 // 状态标签映射
const getStatusTag = (status) => { const getStatusTag = (status) => {
// 统一转换为小写进行比较 // 统一转换为小写进行比较
const normalizedStatus = normalizeVideoTaskStatus(status); const normalizedStatus = normalizeVideoTaskStatus(status);
// 状态统一为“文字 + 边框”标签,不带图标;居中由列 align 与 .video-queue-status 控制
const statusMap = { const statusMap = {
queued: { color: 'blue', text: t('排队中'), icon: <Clock size={12} /> }, queued: { color: 'blue', text: t('排队中') },
in_progress: { in_progress: { color: 'cyan', text: t('生成中') },
color: 'cyan', success: { color: 'green', text: t('已完成') },
text: t('生成中'), completed: { color: 'green', text: t('已完成') },
icon: <Loader2 size={12} className='animate-spin' />, failure: { color: 'red', text: t('失败') },
}, failed: { color: 'red', text: t('失败') },
success: { canceled: { color: 'grey', text: t('已取消') },
color: 'green',
text: t('已完成'),
icon: <CheckCircle2 size={12} />,
},
completed: {
color: 'green',
text: t('已完成'),
icon: <CheckCircle2 size={12} />,
},
failure: {
color: 'red',
text: t('失败'),
icon: <AlertCircle size={12} />,
},
failed: {
color: 'red',
text: t('失败'),
icon: <AlertCircle size={12} />,
},
canceled: {
color: 'grey',
text: t('已取消'),
icon: <AlertCircle size={12} />,
},
}; };
const config = statusMap[normalizedStatus] || { const config = statusMap[normalizedStatus] || {
color: 'grey', color: 'grey',
text: status, text: status,
}; };
return ( return (
<Tag <Tag color={config.color} className='video-queue-status'>
color={config.color}
style={{ display: 'inline-flex', alignItems: 'center', gap: '4px' }}
>
{config.icon}
{config.text} {config.text}
</Tag> </Tag>
); );
@@ -128,12 +104,9 @@ const VideoTaskQueue = ({
{ {
title: t('任务ID'), title: t('任务ID'),
dataIndex: 'task_id', dataIndex: 'task_id',
width: !isCompact ? 120 : 100, width: 200,
render: (text) => ( // 完整展示任务 ID(纯文本,不截断)
<Tooltip content={text}> render: (text) => text || '-',
<span style={{ cursor: 'pointer' }}>{text?.substring(0, 8)}...</span>
</Tooltip>
),
}, },
{ {
title: t('模式'), title: t('模式'),
@@ -166,6 +139,7 @@ const VideoTaskQueue = ({
title: t('状态'), title: t('状态'),
dataIndex: 'status', dataIndex: 'status',
width: !isCompact ? 120 : 100, width: !isCompact ? 120 : 100,
align: 'center',
render: (status) => getStatusTag(status), render: (status) => getStatusTag(status),
}, },
{ {
@@ -193,51 +167,53 @@ const VideoTaskQueue = ({
{ {
title: t('操作'), title: t('操作'),
dataIndex: 'operate', dataIndex: 'operate',
width: !isCompact ? 220 : 180, width: 200,
fixed: 'right', fixed: 'right',
render: (text, record) => { render: (text, record) => {
const normalizedStatus = normalizeVideoTaskStatus(record.status); const normalizedStatus = normalizeVideoTaskStatus(record.status);
return ( return (
<Space> // 操作列与密钥管理列表一致:文字链接按钮(主色 / 删除为危险色),不带图标与描边
<div className='video-queue-actions'>
{/* 播放和下载按钮:仅根据状态显示,视频URL在点击时才获取 */} {/* 播放和下载按钮:仅根据状态显示,视频URL在点击时才获取 */}
{normalizedStatus === 'success' && ( {normalizedStatus === 'success' && (
<> <>
<Button <AntButton
type='link'
size='small' size='small'
type='tertiary' className='video-queue-link'
icon={<ActionPlay size={14} />}
onClick={() => onPlay && onPlay(record)} onClick={() => onPlay && onPlay(record)}
> >
{!isCompact ? t('播放') : ''} {t('播放')}
</Button> </AntButton>
<Button <AntButton
type='link'
size='small' size='small'
type='tertiary' className='video-queue-link'
icon={<ActionDownload size={14} />}
onClick={() => onDownload(record)} onClick={() => onDownload(record)}
> >
{!isCompact ? t('下载') : ''} {t('下载')}
</Button> </AntButton>
</> </>
)} )}
{/* 再生成按钮 - 对所有已完成或失败的任务显示 */} {/* 再生成按钮 - 对所有已完成或失败的任务显示 */}
{(normalizedStatus === 'success' || {(normalizedStatus === 'success' ||
normalizedStatus === 'failure') && normalizedStatus === 'failure') &&
canRegenerateVideoTask(record) && ( canRegenerateVideoTask(record) && (
<Button <AntButton
type='link'
size='small' size='small'
type='primary' className='video-queue-link'
icon={<ActionRefreshCw size={14} />}
onClick={() => onRegenerate && onRegenerate(record)} onClick={() => onRegenerate && onRegenerate(record)}
> >
{!isCompact ? t('再生成') : ''} {t('再生成')}
</Button> </AntButton>
)} )}
<Button <AntButton
type='link'
size='small' size='small'
type='danger' danger
icon={<ActionTrash2 size={14} />} className='video-queue-link'
onClick={() => { onClick={() => {
Modal.warning({ Modal.warning({
title: t('确定删除此任务?'), title: t('确定删除此任务?'),
@@ -253,9 +229,9 @@ const VideoTaskQueue = ({
}); });
}} }}
> >
{!isCompact ? t('删除') : ''} {t('删除')}
</Button> </AntButton>
</Space> </div>
); );
}, },
}, },
@@ -278,7 +254,20 @@ const VideoTaskQueue = ({
}; };
return ( return (
<section className='video-queue'> // 外层 section 在桌面端只占折叠条高度;展开内容由 .video-queue-panel 自底向上浮层覆盖,
// 不挤压上方的参数 / 预览区域(样式见 VideoWorkspace.css)。Esc 收起并把焦点还给切换按钮。
<section
className='video-queue'
data-expanded={visible || undefined}
onKeyDown={(event) => {
if (event.key === 'Escape' && visible) {
event.stopPropagation();
setVisible(false);
event.currentTarget.querySelector('.video-queue-toggle')?.focus();
}
}}
>
<div className='video-queue-panel'>
<h2 className='video-queue-heading'> <h2 className='video-queue-heading'>
<button <button
type='button' type='button'
@@ -326,9 +315,12 @@ const VideoTaskQueue = ({
onClick={() => { onClick={() => {
Modal.warning({ Modal.warning({
title: t('确定删除选中的任务?'), title: t('确定删除选中的任务?'),
content: t('将删除 {{count}} 个任务,删除后将无法恢复', { content: t(
'将删除 {{count}} 个任务,删除后将无法恢复',
{
count: selectedTasks.length, count: selectedTasks.length,
}), },
),
icon: ( icon: (
<ActionAlertCircle <ActionAlertCircle
size={24} size={24}
@@ -369,11 +361,15 @@ const VideoTaskQueue = ({
{/* 任务表格 */} {/* 任务表格 */}
<div className='video-queue-table app-scrollbar'> <div className='video-queue-table app-scrollbar'>
<Table <Table
className='video-queue-grid'
columns={columns} columns={columns}
dataSource={tasks} dataSource={pagedTasks}
rowKey='task_id' rowKey='task_id'
scroll={{ x: 'max-content' }} tableLayout='fixed'
pagination={{ pageSize: 10 }} scroll={{
x: columns.reduce((sum, column) => sum + column.width, 0),
}}
pagination={false}
rowSelection={{ rowSelection={{
selectedRowKeys: selectedTasks, selectedRowKeys: selectedTasks,
onChange: setSelectedTasks, onChange: setSelectedTasks,
@@ -381,10 +377,24 @@ const VideoTaskQueue = ({
disabled: record.status === 'in_progress', disabled: record.status === 'in_progress',
}), }),
}} }}
size='small' size='middle'
empty={t('暂无任务')} empty={t('暂无任务')}
/> />
</div> </div>
{tasks.length > 0 ? (
<Pagination
className='video-queue-pagination'
total={tasks.length}
currentPage={currentPage}
pageSize={pageSize}
onPageChange={setPage}
onPageSizeChange={(size) => {
setPageSize(size);
setPage(1);
}}
/>
) : null}
</div>
</div> </div>
</section> </section>
); );
@@ -1,14 +1,17 @@
.video-workspace { .video-workspace {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 20px;
height: 100%; height: 100%;
padding: 24px; /* 内容边距与用户中心一致(GLOBAL_UI_BASELINE 4.4),底部取一半与图片生成页统一;页头与首块间距由 .uc-page-header 的 18px 提供 */
padding: var(--uc-page-pad-top) var(--uc-page-pad-x)
calc(var(--uc-page-pad-bottom) / 2);
overflow: auto; overflow: auto;
} }
.video-workspace-heading, .video-workspace > .exp-page-header {
.video-workspace-title, flex: none;
}
.video-panel-heading { .video-panel-heading {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -16,12 +19,6 @@
min-width: 0; min-width: 0;
} }
.video-workspace-heading {
flex: none;
flex-wrap: wrap;
justify-content: space-between;
}
.video-workspace-capabilities { .video-workspace-capabilities {
--vw-capability-line: color-mix( --vw-capability-line: color-mix(
in srgb, in srgb,
@@ -54,7 +51,6 @@
flex: none; flex: none;
} }
.video-workspace-icon,
.video-preview-empty-icon { .video-preview-empty-icon {
display: grid; display: grid;
flex: none; flex: none;
@@ -66,20 +62,6 @@
border-radius: 10px; border-radius: 10px;
} }
.video-workspace-heading h1 {
margin: 0;
color: var(--text-primary);
font-size: 28px;
font-weight: 650;
line-height: 32px;
}
.video-workspace-heading p {
margin: 4px 0 0;
color: var(--text-secondary);
font-size: 13px;
}
.video-workspace-body { .video-workspace-body {
display: flex; display: flex;
flex: 1; flex: 1;
@@ -134,13 +116,54 @@
} }
.video-queue { .video-queue {
/* 表格配色与密钥管理列表(key-management.css 的 --km-*)同值 */
--vq-head-bg: #f8f9fc;
--vq-head-text: #687589;
--vq-row-split: #f0f0f0;
--vq-text: rgba(0, 0, 0, 0.88);
position: relative;
flex: none; flex: none;
min-width: 0; min-width: 0;
}
html.dark .video-queue {
--vq-head-bg: var(--ui-color-fill-0);
--vq-head-text: var(--text-secondary);
--vq-row-split: var(--border-subtle);
--vq-text: var(--uc-heading);
}
.video-queue-panel {
background: var(--surface-card); background: var(--surface-card);
border: 1px solid var(--border-subtle); border: 1px solid var(--border-subtle);
border-radius: 12px; border-radius: 12px;
} }
/* 宽屏:队列占位只保留折叠条高度(52px 按钮 + 2px 边框),展开内容以浮层自底向上覆盖,
不推挤上方的参数 / 预览区;窄屏整页滚动,保持文档流内展开 */
@media (min-width: 1025px) {
.video-queue {
height: 54px;
}
.video-queue-panel {
position: absolute;
right: 0;
bottom: 0;
left: 0;
z-index: 20;
}
.video-queue[data-expanded='true'] .video-queue-panel {
box-shadow: 0 -12px 32px
color-mix(in srgb, var(--text-primary) 14%, transparent);
}
.video-queue[data-expanded='true'] .video-queue-table {
max-height: clamp(160px, 40dvh, 400px);
}
}
.video-queue-heading { .video-queue-heading {
margin: 0; margin: 0;
} }
@@ -219,8 +242,60 @@
min-width: 0; min-width: 0;
max-height: clamp(120px, 24dvh, 260px); max-height: clamp(120px, 24dvh, 260px);
overflow: auto; overflow: auto;
border-end-start-radius: 11px; /* 预留滚动条位置:行数变化或下拉展开时不因滚动条出现 / 消失而横向抖动 */
border-end-end-radius: 11px; scrollbar-gutter: stable;
}
/* 表格样式与交互对齐密钥管理列表:middle 尺寸、表头 46px 常规字重、行分隔线、文字链接操作 */
.video-queue-grid .ant-table-thead > tr > th {
--center-table-head-bg: var(--vq-head-bg);
height: 46px;
padding-block: 0;
border-bottom-color: var(--vq-row-split);
background: var(--vq-head-bg);
color: var(--vq-head-text);
font-weight: 400;
}
.video-queue-grid .ant-table-thead > tr > th::before {
display: none;
}
.video-queue-grid .ant-table-tbody > tr > td {
border-bottom-color: var(--vq-row-split);
color: var(--vq-text);
}
.video-queue-grid .ant-tag {
margin-inline-end: 0;
}
/* 状态:仅文字 + 边框,单元格内水平垂直居中 */
.video-queue-grid .video-queue-status.ant-tag {
display: inline-flex;
align-items: center;
justify-content: center;
margin: 0;
vertical-align: middle;
}
.video-queue-actions {
display: flex;
align-items: center;
gap: 6px;
}
.video-queue-actions .video-queue-link.ant-btn {
height: auto;
padding: 0;
}
/* 分页器在表格滚动区之外,位置固定,不随表格内容滚动或跳动 */
.video-queue-pagination {
display: flex;
justify-content: flex-end;
padding: 12px 16px;
border-top: 1px solid var(--vq-row-split);
} }
@media (max-width: 767px) { @media (max-width: 767px) {
@@ -230,11 +305,6 @@
} }
@media (max-width: 1024px) { @media (max-width: 1024px) {
.video-workspace {
gap: 16px;
padding: 16px;
}
.video-workspace-body { .video-workspace-body {
flex: none; flex: none;
height: auto; height: auto;
@@ -245,11 +315,6 @@
min-height: 0; min-height: 0;
} }
.video-workspace-heading h1 {
font-size: 24px;
line-height: 28px;
}
.video-queue-table { .video-queue-table {
max-height: 320px; max-height: 320px;
} }
@@ -0,0 +1,45 @@
import React from 'react';
import { Breadcrumb } from 'antd';
import { useTranslation } from 'react-i18next';
import UserCenterPageHeader from '../../../components/common/UserCenterPageHeader';
import '../experience-page.css';
/**
* 体验中心子页统一页头:复用用户中心页头规格(GLOBAL_UI_BASELINE 4.4 第 2 条),
* 面包屑固定为“体验中心 / 当前页面”,标题 28 / 32px、副标题 14 / 22px、右侧操作走 extra。
* 内容边距由各页根节点读取 --uc-page-pad-*,本组件只负责呈现。
*
* @param {{ title: string, titleSuffix?: React.ReactNode, subtitle?: React.ReactNode, extra?: React.ReactNode, className?: string }} props
*/
export default function ExperiencePageHeader({
title,
titleSuffix,
subtitle,
extra,
className = '',
}) {
const { t } = useTranslation();
return (
<UserCenterPageHeader
className={`exp-page-header ${className}`.trim()}
breadcrumb={
<Breadcrumb
className='ui-dashboard-breadcrumb ui-user-center-breadcrumb'
items={[{ title: t('体验中心') }, { title }]}
/>
}
title={
titleSuffix ? (
<span className='exp-page-title-row'>
<span>{title}</span>
{titleSuffix}
</span>
) : (
title
)
}
subtitle={subtitle}
extra={extra}
/>
);
}
@@ -3,26 +3,28 @@ import {
ChevronRight as ActionChevronRight, ChevronRight as ActionChevronRight,
ChevronLeft as ActionChevronLeft, ChevronLeft as ActionChevronLeft,
} from '@/components/common/icons/ActionIcons'; } from '@/components/common/icons/ActionIcons';
import React, { useMemo, useState, useEffect } from 'react'; import React, { useMemo } from 'react';
import { Link, useLocation } from 'react-router-dom'; import { Link, useLocation } from 'react-router-dom';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { BrainCircuit, Image, Video, Sparkles } from 'lucide-react'; import { BrainCircuit, Image, Video } from 'lucide-react';
import { useSidebarCollapsed } from '../../../hooks/common/useSidebarCollapsed'; import { useSidebarCollapsed } from '../../../hooks/common/useSidebarCollapsed';
import { useExperienceModules } from '../useExperienceModules'; import { useExperienceModules } from '../useExperienceModules';
import { badgeText } from '../../../hooks/creation/creationWatch'; import { badgeText } from '../../../hooks/creation/creationWatch';
/** /**
* 体验中心桌面侧栏:结构、样式与收起交互对齐用户中心侧栏(UserCenterSidebar),
* 共用 center-layout.css 的 .ui-center-sidebar / .ui-center-menu-item / .ui-center-sidebar-collapse,
* 收起状态与其他中心侧栏共用 useSidebarCollapsed。
*
* @param {{ unread?: { image: number, video: number } }} props * @param {{ unread?: { image: number, video: number } }} props
* unread:新创作台中用户不在该页时完成的作品数(WP C-4 未读角标) * unread:新创作台中用户不在该页时完成的作品数(WP C-4 未读角标)
*/ */
const ExperienceSidebar = ({ unread }) => { const ExperienceSidebar = ({ unread }) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [collapsed, toggleCollapsed] = useSidebarCollapsed(); const [collapsed, toggleCollapsed] = useSidebarCollapsed();
const [selectedKeys, setSelectedKeys] = useState([]);
const location = useLocation(); const location = useLocation();
const { isAvailable } = useExperienceModules(); const { isAvailable } = useExperienceModules();
// 统一单一品牌色高亮(云平台风格),不再每项一种颜色
const allNavItems = useMemo( const allNavItems = useMemo(
() => [ () => [
{ {
@@ -59,56 +61,23 @@ const ExperienceSidebar = ({ unread }) => {
[allNavItems, isAvailable], [allNavItems, isAvailable],
); );
// 根据当前路径设置选中的菜单项 // 选中项直接由当前路径推导,避免额外状态与路由不同步
useEffect(() => { const selectedKey =
const currentPath = location.pathname; navItems.find((item) => location.pathname.startsWith(item.to))?.itemKey ||
const matchingItem = navItems.find((item) => '';
currentPath.startsWith(item.to),
);
if (matchingItem) {
setSelectedKeys([matchingItem.itemKey]);
}
}, [location.pathname, navItems]);
return ( return (
<div <aside
className={` className='ui-experience-sidebar ui-center-sidebar'
relative flex flex-col h-full transition-all duration-300 ease-out data-collapsed={collapsed}
bg-white/60 dark:bg-neutral-900/60 backdrop-blur-2xl backdrop-saturate-[1.8]
border-r border-white/40 dark:border-neutral-700/50
shadow-[1px_0_24px_-4px_rgba(0,0,0,0.06)] dark:shadow-[1px_0_24px_-4px_rgba(0,0,0,0.3)]
${collapsed ? 'w-[68px]' : 'w-[240px]'}
`}
>
{/* 毛玻璃内层光泽 */}
<div className='absolute inset-0 bg-gradient-to-b from-white/40 via-white/10 to-white/20 dark:from-white/[0.06] dark:via-transparent dark:to-white/[0.03] pointer-events-none' />
{/* 顶部装饰渐变 —— /8 /3 步进 Tailwind 不生成,改用 /10 两 stop 确保可见 */}
<div className='absolute top-0 left-0 right-0 h-32 bg-gradient-to-b from-brand-from/10 to-transparent pointer-events-none' />
{/* Logo/标题区域 */}
{!collapsed && (
<div className='px-4 pt-5 pb-3'>
<div className='flex items-center gap-2'>
<div className='p-1.5 bg-gradient-to-br from-brand-from to-brand-to rounded-lg'>
<Sparkles size={16} className='text-white' />
</div>
<span className='font-bold text-gray-900 dark:text-white'>
{t('体验中心')}
</span>
</div>
</div>
)}
{/* 导航区域 */}
<nav
className={`relative flex-1 px-3 ${collapsed ? 'pt-4' : 'pt-2'} space-y-1.5 overflow-y-auto overflow-x-hidden`}
> >
<nav className='ui-center-sidebar-nav'>
<div className='ui-org-group-items'>
{navItems.map((item) => { {navItems.map((item) => {
const isSelected = selectedKeys.includes(item.itemKey); const active = selectedKey === item.itemKey;
const IconComponent = item.icon; const Icon = item.icon;
const unreadCount = const unreadCount =
item.unreadKey && !isSelected ? unread?.[item.unreadKey] || 0 : 0; item.unreadKey && !active ? unread?.[item.unreadKey] || 0 : 0;
const unreadLabel = unreadCount const unreadLabel = unreadCount
? t('{{n}} 个新作品', { n: unreadCount }) ? t('{{n}} 个新作品', { n: unreadCount })
: ''; : '';
@@ -117,141 +86,50 @@ const ExperienceSidebar = ({ unread }) => {
<Link <Link
key={item.itemKey} key={item.itemKey}
to={item.to} to={item.to}
className='ui-center-menu-item'
data-active={active || undefined}
aria-current={active ? 'page' : undefined}
aria-label={ aria-label={
unreadLabel ? `${item.text}(${unreadLabel})` : undefined unreadLabel ? `${item.text}(${unreadLabel})` : undefined
} }
onClick={() => setSelectedKeys([item.itemKey])} title={collapsed ? item.text : undefined}
className={`
group relative flex items-center gap-3 rounded-xl transition-all duration-200
${collapsed ? 'justify-center p-3' : 'px-3 py-2.5'}
${
isSelected
? 'bg-brand/10 dark:bg-brand/15 shadow-sm shadow-brand/5'
: 'hover:bg-brand/5 dark:hover:bg-brand/10'
}
`}
> >
{/* 选中指示器 —— 统一品牌色 */} <Icon size={16} strokeWidth={1.5} aria-hidden='true' />
{isSelected && ( {!collapsed && (
<div className='absolute left-0 top-1/2 -translate-y-1/2 w-1 h-6 rounded-r-full bg-gradient-to-b from-brand-from to-brand-to' /> <span className='ui-center-menu-label'>{item.text}</span>
)} )}
{!collapsed && item.beta && (
{/* 图标 —— 激活:品牌渐变实底;非激活:中性,hover 转品牌 */} <span className='ui-org-beta'>
<div {I18N_TECHNICAL_TEXT.BETA}
className={` </span>
relative flex-shrink-0 p-1.5 rounded-lg transition-all duration-200 )}
${ {unreadCount > 0 ? (
isSelected
? 'bg-gradient-to-br from-brand-from to-brand-to shadow-lg shadow-brand/25'
: 'bg-gray-100/80 dark:bg-neutral-800/80 group-hover:bg-brand/10 group-hover:scale-105'
}
`}
>
<IconComponent
size={18}
strokeWidth={2}
className={
isSelected
? 'text-white'
: 'text-gray-500 dark:text-gray-400 group-hover:text-brand-deep dark:group-hover:text-brand-from transition-colors'
}
/>
{unreadCount > 0 && collapsed ? (
<span <span
className='exp-unread-badge absolute -top-1.5 -right-1.5' className='exp-unread-badge ui-experience-unread'
aria-hidden='true' aria-hidden='true'
> >
{badgeText(unreadCount)} {badgeText(unreadCount)}
</span> </span>
) : null} ) : null}
</div>
{/* 文字 */}
{!collapsed && (
<span className='flex min-w-0 items-center gap-2'>
<span
className={`
text-sm transition-colors truncate
${
isSelected
? 'text-brand-deep dark:text-brand-from font-semibold'
: 'font-medium text-gray-600 dark:text-gray-300 group-hover:text-brand-deep dark:group-hover:text-brand-from'
}
`}
>
{item.text}
</span>
{item.beta && (
<span className='shrink-0 rounded-full border border-orange-300/70 bg-orange-50 px-1.5 py-0.5 font-mono text-[8px] font-bold tracking-wider text-orange-700'>
{I18N_TECHNICAL_TEXT.BETA}
</span>
)}
{unreadCount > 0 ? (
<span className='exp-unread-badge' aria-hidden='true'>
{badgeText(unreadCount)}
</span>
) : null}
</span>
)}
{/* Tooltip for collapsed state */}
{collapsed && (
<div
className='
absolute left-full ml-2 px-2.5 py-1.5
bg-gray-900 dark:bg-white text-white dark:text-gray-900
text-xs font-medium rounded-lg shadow-lg
opacity-0 invisible group-hover:opacity-100 group-hover:visible
transition-all duration-200 whitespace-nowrap z-50
'
>
{item.text}
<div
className='absolute left-0 top-1/2 -translate-x-1 -translate-y-1/2
border-4 border-transparent border-r-gray-900 dark:border-r-white'
/>
</div>
)}
</Link> </Link>
); );
})} })}
</div>
</nav> </nav>
{/* 底部分隔线装饰 */}
<div className='mx-4 h-px bg-gradient-to-r from-transparent via-gray-200/60 dark:via-neutral-700/60 to-transparent' />
{/* 底部折叠按钮 */}
<div className='relative p-3'>
<button <button
type='button'
className='app-action-button ui-center-sidebar-collapse'
onClick={toggleCollapsed} onClick={toggleCollapsed}
className={[ aria-label={collapsed ? t('展开导航') : t('收起导航')}
'app-action-button',
`
flex items-center justify-center gap-2 w-full py-2 rounded-lg
text-gray-500 dark:text-gray-400 text-sm font-medium
bg-white/50 dark:bg-neutral-800/50
border border-gray-200/40 dark:border-neutral-700/40
hover:bg-brand/10 dark:hover:bg-brand/15
hover:text-brand-deep dark:hover:text-brand-from
hover:border-brand/30
transition-all duration-200
${collapsed ? 'px-2' : 'px-3'}
`,
]
.filter(Boolean)
.join(' ')}
> >
{collapsed ? ( {collapsed ? (
<ActionChevronRight size={16} strokeWidth={2.5} /> <ActionChevronRight size={16} />
) : ( ) : (
<> <ActionChevronLeft size={16} />
<ActionChevronLeft size={16} strokeWidth={2.5} />
<span>{t('收起')}</span>
</>
)} )}
{!collapsed && <span>{t('收起导航')}</span>}
</button> </button>
</div> </aside>
</div>
); );
}; };
@@ -1,19 +1,28 @@
import React, { useContext } from 'react'; import React, { useContext } from 'react';
import { useTranslation } from 'react-i18next';
import ImageGenerationTab from './AICreation/ImageGenerationTab'; import ImageGenerationTab from './AICreation/ImageGenerationTab';
import CreationStudio from '../../../components/creation/CreationStudio'; import CreationStudio from '../../../components/creation/CreationStudio';
import ExperiencePageHeader from './ExperiencePageHeader';
import { StatusContext } from '../../../context/Status'; import { StatusContext } from '../../../context/Status';
import { isCreationStudioEnabled } from '../../../helpers/creationStudio'; import { isCreationStudioEnabled } from '../../../helpers/creationStudio';
const ImageGeneration = () => { const ImageGeneration = () => {
const { t } = useTranslation();
const [statusState] = useContext(StatusContext); const [statusState] = useContext(StatusContext);
// 灰度开关开启时使用新创作台,关闭时保持旧页面不变 // 灰度开关开启时使用新创作台,关闭时保持旧页面不变
if (isCreationStudioEnabled(statusState?.status)) { if (isCreationStudioEnabled(statusState?.status)) {
return <CreationStudio key='image' kind='image' />; return <CreationStudio key='image' kind='image' />;
} }
return ( return (
<div className='h-full min-h-0'> <div className='exp-image-page app-scrollbar'>
<ExperiencePageHeader
title={t('图片生成')}
subtitle={t('输入描述即可生成图片')}
/>
<div className='exp-image-page-body'>
<ImageGenerationTab /> <ImageGenerationTab />
</div> </div>
</div>
); );
}; };
@@ -1,8 +1,9 @@
import React, { useContext } from 'react'; import React, { useContext } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Clapperboard, Film, Sparkles, Video } from 'lucide-react'; import { Clapperboard, Film, Sparkles } from 'lucide-react';
import VideoGenerationTab from './AICreation/VideoGenerationTab'; import VideoGenerationTab from './AICreation/VideoGenerationTab';
import CreationStudio from '../../../components/creation/CreationStudio'; import CreationStudio from '../../../components/creation/CreationStudio';
import ExperiencePageHeader from './ExperiencePageHeader';
import { StatusContext } from '../../../context/Status'; import { StatusContext } from '../../../context/Status';
import { isCreationStudioEnabled } from '../../../helpers/creationStudio'; import { isCreationStudioEnabled } from '../../../helpers/creationStudio';
@@ -17,16 +18,10 @@ const VideoGeneration = () => {
return ( return (
<div className='video-workspace app-scrollbar'> <div className='video-workspace app-scrollbar'>
<header className='video-workspace-heading'> <ExperiencePageHeader
<div className='video-workspace-title'> title={t('视频生成')}
<span className='video-workspace-icon' aria-hidden='true'> subtitle={t('使用 AI 创建令人惊叹的视频内容')}
<Video size={22} /> extra={
</span>
<div>
<h1>{t('视频生成')}</h1>
<p>{t('使用 AI 创建令人惊叹的视频内容')}</p>
</div>
</div>
<ul className='video-workspace-capabilities'> <ul className='video-workspace-capabilities'>
<li> <li>
<Clapperboard size={14} aria-hidden='true' /> <Clapperboard size={14} aria-hidden='true' />
@@ -41,7 +36,8 @@ const VideoGeneration = () => {
{t('多模型支持')} {t('多模型支持')}
</li> </li>
</ul> </ul>
</header> }
/>
<VideoGenerationTab /> <VideoGenerationTab />
</div> </div>
); );
@@ -0,0 +1,133 @@
/*
* 体验中心子页(云端大脑 / 图片生成 / 视频生成)页头与页级布局。
* 页头几何沿用 user-center.css 的 .uc-page-header(GLOBAL_UI_BASELINE 4.4),此处只补体验中心特有部分;
* 内容边距统一读取 --uc-page-pad-*(桌面 30 / 36 / 36px,≤ 768px 16 / 16 / 24px)。
*/
/* 标题后缀(如 BETA):与 28px 标题垂直居中,不改变标题行高 */
.exp-page-title-row {
display: inline-flex;
align-items: center;
flex-wrap: wrap;
gap: 10px;
}
/* 图片生成:页头 + 双栏工作区。宽屏双栏各自滚动,窄屏整页滚动 */
.exp-image-page {
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
padding-top: var(--uc-page-pad-top);
}
.exp-image-page > .exp-page-header {
flex: none;
padding-inline: var(--uc-page-pad-x);
}
.exp-image-page-body {
flex: 1 1 auto;
min-height: 0;
}
/* 覆盖工作区原 p-4 / lg:p-6:左右与页头对齐,顶部间距由页头 18px 提供;
底部按需求取标准下边距的一半,让两栏尽量多占可视高度 */
.exp-image-page .image-generation-workspace {
padding: 0 var(--uc-page-pad-x) calc(var(--uc-page-pad-bottom) / 2);
}
/* 宽屏:左侧参数栏固定(仅表单内部滚动);右侧“生成历史”整列(工具栏 + 图片网格)
作为一个局部滚动容器,向下滚动时工具栏随之移出,让出更多图片可视面积 */
@media (min-width: 1024px) {
/* 滚动视口与左侧参数卡同为 12px 圆角:底部被裁切的卡片按圆角收边,两栏底边圆角对齐 */
.exp-image-page .image-generation-results {
overflow-x: hidden;
overflow-y: auto;
overscroll-behavior: contain;
scrollbar-gutter: stable;
border-radius: 12px;
}
.exp-image-page .image-generation-results .image-task-list {
height: auto;
min-height: 100%;
}
/* 列表区占满工具栏以下的剩余高度,空状态在其中水平垂直居中 */
.exp-image-page .image-generation-results .task-list-scrollable {
display: flex;
flex: 1 0 auto;
flex-direction: column;
overflow: visible;
}
.exp-image-page .image-generation-results .image-history-content {
display: flex;
flex: 1 0 auto;
flex-direction: column;
}
/* 舒适密度:两行卡片按可视高度均分拉伸,第二行底边与左侧参数卡底边(同为 12px 圆角)对齐。
行高 = (视口高 - 工具栏 56 - 列表上内边距 10 - 行间距 12) / 2,限定在 260–440px,
更矮或更高的屏幕回落到区间端点并保持局部滚动 */
.exp-image-page .image-generation-results {
container-type: size;
}
.exp-image-page
.image-generation-results
.image-task-grid[data-density='comfortable'] {
grid-auto-rows: clamp(260px, calc((100cqh - 78px) / 2), 440px);
}
.exp-image-page
.image-generation-results
.image-task-grid[data-density='comfortable']
.image-task-card {
height: 100%;
}
.exp-image-page
.image-generation-results
.image-task-grid[data-density='comfortable']
.image-task-media {
flex: 1 1 auto;
min-height: 120px;
aspect-ratio: auto;
}
/* 拉伸出的高度全部给缩略图,信息区保持内容高度,避免与操作行之间出现空白 */
.exp-image-page
.image-generation-results
.image-task-grid[data-density='comfortable']
.image-task-info {
flex: none;
}
.exp-image-page .image-generation-results .image-history-content {
padding-bottom: 0;
}
.exp-image-page .image-generation-results .image-history-empty {
display: flex;
flex: 1 0 auto;
align-items: center;
justify-content: center;
}
}
@media (max-width: 1023.98px) {
.exp-image-page {
overflow-y: auto;
}
.exp-image-page-body {
flex: none;
}
.exp-image-page .image-generation-workspace {
height: auto;
overflow: visible;
}
}
+8 -2
View File
@@ -169,13 +169,18 @@ const ExperienceCenter = () => {
// 新创作台:视口高度用 dvh,微信 H5 / 移动端键盘弹起时底部创作台与生成按钮保持可见 // 新创作台:视口高度用 dvh,微信 H5 / 移动端键盘弹起时底部创作台与生成按钮保持可见
const dynamicViewport = const dynamicViewport =
(isVideoGeneration || isImageGeneration) && creationStudioEnabled; (isVideoGeneration || isImageGeneration) && creationStudioEnabled;
// 云端大脑 / 图片生成 / 视频生成(非新创作台)与 /console/analytics 统一纯色页底:
// 读取 --uc-page-bg(浅色 #f8fafc,深色 --surface-bg-base),不叠加装饰光晕层
const consolePageBg =
isCloudBrain ||
((isVideoGeneration || isImageGeneration) && !creationStudioEnabled);
return ( return (
<div <div
className={`flex flex-col md:flex-row ${dynamicViewport ? 'h-screen supports-[height:100dvh]:h-dvh' : 'h-screen'} bg-[var(--surface-bg-base)] overflow-hidden ${hasMarquee ? 'pt-[91px] md:pt-[107px]' : 'pt-14 md:pt-[72px]'}`} className={`flex flex-col md:flex-row ${dynamicViewport ? 'h-screen supports-[height:100dvh]:h-dvh' : 'h-screen'} ${consolePageBg ? 'bg-[var(--uc-page-bg,var(--surface-bg-base))]' : 'bg-[var(--surface-bg-base)]'} overflow-hidden ${hasMarquee ? 'pt-[91px] md:pt-[107px]' : 'pt-14 md:pt-[72px]'}`}
> >
{/* Sidebar - 桌面端 */} {/* Sidebar - 桌面端 */}
<div className='hidden md:block'> <div className='hidden md:block flex-shrink-0 h-full'>
<ExperienceSidebar unread={unread} /> <ExperienceSidebar unread={unread} />
</div> </div>
@@ -191,6 +196,7 @@ const ExperienceCenter = () => {
* text-model 特例:TextModel 自带 via-white 亮底保证聊天可读性,由其自身渲染,此处跳过。 * text-model 特例:TextModel 自带 via-white 亮底保证聊天可读性,由其自身渲染,此处跳过。
* 沉浸式生成页(视频/图片)用 rich 大光球,密钥管理(Token 列表)用 subtle。 */} * 沉浸式生成页(视频/图片)用 rich 大光球,密钥管理(Token 列表)用 subtle。 */}
{!isTextModel && {!isTextModel &&
!consolePageBg &&
(!(isVideoGeneration || isImageGeneration) || (!(isVideoGeneration || isImageGeneration) ||
creationStudioEnabled) && ( creationStudioEnabled) && (
<PageBackground <PageBackground
+22 -1
View File
@@ -190,10 +190,31 @@
padding: 0; padding: 0;
} }
:is(.ui-console-sidebar, .ui-user-sidebar) .ui-center-sidebar-nav { :is(.ui-console-sidebar, .ui-user-sidebar, .ui-experience-sidebar)
.ui-center-sidebar-nav {
padding-top: 24px; padding-top: 24px;
} }
/* 体验中心侧栏:与用户中心侧栏同构,仅补未读角标定位(展开态靠右,收起态贴图标右上角) */
.ui-experience-sidebar .ui-center-menu-item {
position: relative;
}
.ui-experience-sidebar .ui-experience-unread {
margin-left: auto;
}
.ui-experience-sidebar .ui-org-beta + .ui-experience-unread {
margin-left: 0;
}
.ui-experience-sidebar[data-collapsed='true'] .ui-experience-unread {
position: absolute;
top: 4px;
left: calc(50% + 4px);
margin-left: 0;
}
.ui-console-submenu-toggle { .ui-console-submenu-toggle {
width: 100%; width: 100%;
border: 0; border: 0;