Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6080eda584 | |||
| fca6543445 | |||
| 41ce8b5e58 | |||
| b7b19d01f6 |
@@ -10,6 +10,46 @@
|
||||
|
||||
## 2026-11-20
|
||||
|
||||
### 优化 · 体验中心视频生成工作区
|
||||
|
||||
- **范围**:视频生成页的参数面板、视频预览和任务队列。
|
||||
- **变更**:以图片生成工作区的描边卡片为基准,统一标题、控件和空态;参数面板与任务队列可通过键盘折叠,任务队列不再遮挡预览;表单滚动区保留高级参数的展开高度,避免队列展开或窗口较矮时压缩折叠项。
|
||||
- **影响**:跟随系统主题配置;保持模型、视频生成、计价、任务和灰度开关契约。
|
||||
- **回滚**:仅逆向恢复本条对应的页面结构和样式。
|
||||
- **关联**:`src/pages/ExperienceCenter/components/AICreation/VideoGenerationTab.jsx`、`src/pages/ExperienceCenter/components/AICreation/Video/VideoWorkspace.css`。
|
||||
|
||||
### 修复 · 官网设置品牌名称对齐
|
||||
|
||||
- **范围**:控制台官网设置的关于页签、说明、首页共用提示及校验提示。
|
||||
- **变更**:统一使用“微元算力”,同步九个语言包。
|
||||
- **影响**:不改变配置结构、表单校验或保存逻辑;联调存量文案仅替换实查命中的文章标题和正文。
|
||||
- **回滚**:逆向恢复本条的文案差异;如需回滚联调数据,先比对最新配置与保存前备份,只恢复本次变动的两处,避免覆盖后续编辑。
|
||||
- **关联**:`src/pages/WebsiteSettings/model.js`、`src/i18n/locales/`、`/api/website/page-config`。
|
||||
|
||||
### 优化 · 图片生成创作表单
|
||||
|
||||
- **范围**:体验中心图片生成页左侧创作表单。
|
||||
- **变更**:固定桌面端标题与生成区,归组模型和生成方式,整合提示词工具、模板、参考图与参数的视觉层次;移动端可收起表单并保留生成操作。
|
||||
- **影响**:沿用系统主题色与现有生成、引用、计价流程;右侧历史不变。
|
||||
- **回滚**:仅逆向恢复本条对应的表单结构和局部样式差异。
|
||||
- **关联**:`src/pages/ExperienceCenter/components/AICreation/ImageGenerationForm.jsx`、`src/pages/ExperienceCenter/components/AICreation/Image/ImageGenerationForm.css`、`src/pages/ExperienceCenter/components/AICreation/Image/ImageSizePicker.jsx`。
|
||||
|
||||
### 优化 · 体验中心图片生成工作区
|
||||
|
||||
- **范围**:图片生成页的双栏工作区、创作表单和生成历史。
|
||||
- **变更**:以模型超市的描边卡片为参考,统一缩略图、状态占位和操作区;窄屏堆叠,选中和焦点状态跟随系统主题色。
|
||||
- **影响**:保留任务、模型和计价流程;历史卡片在各显示密度下均可打开详情和操作菜单。
|
||||
- **回滚**:逆向恢复本条的页面布局、表单及历史卡片差异。
|
||||
- **关联**:`src/pages/ExperienceCenter/components/AICreation/ImageGenerationTab.jsx`、`ImageGenerationForm.jsx`、`ImageTaskList.jsx`。
|
||||
|
||||
### 修复 · 风控看板自动封号历史
|
||||
|
||||
- 复用运营看板折叠面板外框,展开时由分隔线连接标题和内容;保留默认展开、筛选、刷新、分页与解封行为。
|
||||
|
||||
### 修复 · 控制台调用质量维度分布
|
||||
|
||||
- 对齐维度页签、数据来源提示和表格间距;表格随内容增高,空态不滚动,仅数据列超宽时支持横向滚动。保留排序、下钻与前 50 项查询规则。
|
||||
|
||||
### 性能 · 开发预热与公共首屏分包
|
||||
|
||||
- **范围**:Vite 开发和生产配置、应用启动、首页和认证页的加载边界。
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { Select, Table, TabPane, Tabs, Tooltip } from '@/components/ui';
|
||||
import { Layers } from 'lucide-react';
|
||||
import { useIsMobile } from '@/hooks/common/useIsMobile';
|
||||
import {
|
||||
ORDER_OPTIONS,
|
||||
ORG_DIMS,
|
||||
@@ -27,6 +28,8 @@ export const RateBar = ({ value }) => (
|
||||
/** 维度分布:每行可点击,把该维度值加入筛选(下钻) */
|
||||
const QualityBreakdown = ({ quality, t }) => {
|
||||
const { scope, get, params, setFilters } = quality;
|
||||
const isPlatform = scope !== 'org';
|
||||
const isMobile = useIsMobile();
|
||||
const dims = scope === 'org' ? ORG_DIMS : PLATFORM_DIMS;
|
||||
const [dim, setDim] = useState('model');
|
||||
const [orderBy, setOrderBy] = useState('total');
|
||||
@@ -171,6 +174,9 @@ const QualityBreakdown = ({ quality, t }) => {
|
||||
setFilters({ [dimSpec.filterKey]: row.key });
|
||||
};
|
||||
|
||||
const rows = data?.rows || [];
|
||||
const isPlatformEmpty = isPlatform && rows.length === 0;
|
||||
|
||||
return (
|
||||
<div className='quality-card'>
|
||||
<div className='quality-card-head'>
|
||||
@@ -189,7 +195,9 @@ const QualityBreakdown = ({ quality, t }) => {
|
||||
onChange={setOrderBy}
|
||||
/>
|
||||
</div>
|
||||
<div className='quality-card-body quality-nested-tabs'>
|
||||
<div
|
||||
className={`quality-card-body quality-nested-tabs${isPlatform ? ' quality-breakdown-body' : ''}`}
|
||||
>
|
||||
<Tabs type='button' size='small' activeKey={dim} onChange={setDim}>
|
||||
{dims.map((d) => (
|
||||
<TabPane key={d.value} itemKey={d.value} tab={t(d.label)} />
|
||||
@@ -199,17 +207,37 @@ const QualityBreakdown = ({ quality, t }) => {
|
||||
<QualityMetaNotice meta={data.meta} scope={scope} t={t} />
|
||||
)}
|
||||
{error ? (
|
||||
<div className={isPlatform ? 'quality-breakdown-result' : undefined}>
|
||||
<div className='quality-empty'>{qualityErrorText(t, error)}</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className='overflow-x-auto app-scrollbar mt-2'>
|
||||
<div
|
||||
className={
|
||||
isPlatform
|
||||
? 'quality-breakdown-result'
|
||||
: 'overflow-x-auto app-scrollbar mt-2'
|
||||
}
|
||||
>
|
||||
<Table
|
||||
className={
|
||||
isPlatformEmpty ? 'quality-breakdown-empty' : undefined
|
||||
}
|
||||
size='small'
|
||||
rowKey={(row) => `${row.key}|${row.key2 || ''}`}
|
||||
loading={loading}
|
||||
columns={columns}
|
||||
dataSource={data?.rows || []}
|
||||
columns={
|
||||
isPlatformEmpty
|
||||
? (isMobile ? columns.slice(0, 1) : columns).map(
|
||||
(column) => ({
|
||||
...column,
|
||||
width: undefined,
|
||||
}),
|
||||
)
|
||||
: columns
|
||||
}
|
||||
dataSource={rows}
|
||||
pagination={false}
|
||||
scroll={{ x: 960 }}
|
||||
scroll={{ x: isPlatformEmpty ? undefined : 960 }}
|
||||
onRow={(row) =>
|
||||
canDrill(row)
|
||||
? {
|
||||
@@ -224,11 +252,11 @@ const QualityBreakdown = ({ quality, t }) => {
|
||||
}
|
||||
empty={<div className='quality-empty'>{t('暂无数据')}</div>}
|
||||
/>
|
||||
{data && data.total_rows > (data.rows || []).length && (
|
||||
{data && data.total_rows > rows.length && (
|
||||
<div className='mt-2 text-xs text-[var(--text-secondary)]'>
|
||||
{t('共 {{total}} 项,仅展示排序后的前 {{shown}} 项', {
|
||||
total: data.total_rows,
|
||||
shown: (data.rows || []).length,
|
||||
shown: rows.length,
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -63,6 +63,32 @@
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.quality-breakdown-body {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 12px;
|
||||
padding-block-start: 12px;
|
||||
}
|
||||
|
||||
.quality-breakdown-body .ant-tabs > .ant-tabs-nav {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.quality-breakdown-result {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.quality-breakdown-empty .ant-table-thead > tr > th {
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
@media (max-width: 680px) {
|
||||
.quality-breakdown-body .ant-tabs .ant-tabs-tab + .ant-tabs-tab {
|
||||
margin-inline-start: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 筛选栏 */
|
||||
.quality-filter-grid {
|
||||
display: grid;
|
||||
|
||||
@@ -11356,7 +11356,10 @@
|
||||
"官网展示:{{value}}": "Website display: {{value}}",
|
||||
"{{team}} · 研发占比 {{ratio}}": "{{team}} · R&D ratio {{ratio}}",
|
||||
"降幅": "reduction",
|
||||
"首页与关于微词元共用": "shared by Home and About",
|
||||
"关于微元算力": "About 微元算力",
|
||||
"配置官网关于微元算力区域展示的团队与服务信息。": "Configure the team and service information shown in the About 微元算力 section.",
|
||||
"首页与关于微元算力共用": "Shared by Home and About 微元算力",
|
||||
"请完善关于微元算力的配置": "Please complete the About 微元算力 configuration",
|
||||
"四个页签共用一份配置,保存时将统一校验并提交。": "All four tabs share one configuration. Saving validates and submits all settings together.",
|
||||
"富文本工具栏": "Rich text toolbar",
|
||||
"正文段落": "Body paragraph",
|
||||
|
||||
@@ -10788,7 +10788,10 @@
|
||||
"官网展示:{{value}}": "Affichage sur le site : {{value}}",
|
||||
"{{team}} · 研发占比 {{ratio}}": "{{team}} · part R&D {{ratio}}",
|
||||
"降幅": "baisse",
|
||||
"首页与关于微词元共用": "partagé entre Accueil et À propos",
|
||||
"关于微元算力": "À propos de 微元算力",
|
||||
"配置官网关于微元算力区域展示的团队与服务信息。": "Configurez les informations sur l’équipe et les services affichées dans la rubrique À propos de 微元算力.",
|
||||
"首页与关于微元算力共用": "Commun à l’accueil et à la rubrique À propos de 微元算力",
|
||||
"请完善关于微元算力的配置": "Veuillez compléter la configuration de la rubrique À propos de 微元算力",
|
||||
"四个页签共用一份配置,保存时将统一校验并提交。": "Les quatre onglets partagent une configuration et sont soumis uniformément à la vérification et à la validation lorsqu 'ils sont sauvegardés.",
|
||||
"结算状态: {{label}}": "Statut du règlement: {{label}}",
|
||||
"确认未生效:授权、凭据或操作内容已变化,请刷新任务后重试。": "La confirmation n'est pas effective: l'autorisation, les informations d'identification ou le contenu de l'action ont changé, veuillez actualiser la tâche et réessayer.",
|
||||
|
||||
@@ -11330,7 +11330,10 @@
|
||||
"官网展示:{{value}}": "公式サイト表示:{{value}}",
|
||||
"{{team}} · 研发占比 {{ratio}}": "{{team}} · 研究開発比率 {{ratio}}",
|
||||
"降幅": "削減率",
|
||||
"首页与关于微词元共用": "ホームと会社概要で共用",
|
||||
"关于微元算力": "微元算力について",
|
||||
"配置官网关于微元算力区域展示的团队与服务信息。": "公式サイトの「微元算力について」に表示するチームとサービスの情報を設定します。",
|
||||
"首页与关于微元算力共用": "ホームと「微元算力について」で共用",
|
||||
"请完善关于微元算力的配置": "「微元算力について」の設定を完了してください",
|
||||
"四个页签共用一份配置,保存时将统一校验并提交。": "4つのタブは1つの構成を共有し、保存時に均一に検証およびコミットされます。",
|
||||
"富文本工具栏": "リッチテキストツールバー",
|
||||
"正文段落": "本文段落",
|
||||
|
||||
@@ -11334,7 +11334,10 @@
|
||||
"官网展示:{{value}}": "웹사이트 표시: {{value}}",
|
||||
"{{team}} · 研发占比 {{ratio}}": "{{team}} · R&D 비율 {{ratio}}",
|
||||
"降幅": "감소폭",
|
||||
"首页与关于微词元共用": "홈과 회사 소개에서 공용",
|
||||
"关于微元算力": "미원산력 소개",
|
||||
"配置官网关于微元算力区域展示的团队与服务信息。": "공식 웹사이트의 미원산력 소개에 표시할 팀 및 서비스 정보를 설정합니다.",
|
||||
"首页与关于微元算力共用": "홈과 미원산력 소개에서 공용",
|
||||
"请完善关于微元算力的配置": "미원산력 소개 설정을 완료해 주세요",
|
||||
"四个页签共用一份配置,保存时将统一校验并提交。": "네 개의 탭은 구성을 공유하며, 이 구성은 저장 시 확인되고 제출됩니다.",
|
||||
"富文本工具栏": "서식 있는 텍스트 도구 모음",
|
||||
"正文段落": "본문 단락",
|
||||
|
||||
@@ -10540,7 +10540,10 @@
|
||||
"官网展示:{{value}}": "На сайте: {{value}}",
|
||||
"{{team}} · 研发占比 {{ratio}}": "{{team}} · доля R&D {{ratio}}",
|
||||
"降幅": "снижение",
|
||||
"首页与关于微词元共用": "общее для главной и раздела «О нас»",
|
||||
"关于微元算力": "О компании 微元算力",
|
||||
"配置官网关于微元算力区域展示的团队与服务信息。": "Настройте сведения о команде и услугах в разделе «О компании 微元算力».",
|
||||
"首页与关于微元算力共用": "Общее для главной и раздела «О компании 微元算力»",
|
||||
"请完善关于微元算力的配置": "Завершите настройку раздела «О компании 微元算力»",
|
||||
"四个页签共用一份配置,保存时将统一校验并提交。": "Четыре страницы совместно используют один экземпляр конфигурации, при сохранении будет проведена единая проверка и отправка.",
|
||||
"{{count}} 处非法输入": "{{count}} неверный вход (ы)",
|
||||
"{{count}} 个已验证渠道": "{{count}} верифицированные каналы",
|
||||
|
||||
@@ -11330,7 +11330,10 @@
|
||||
"官网展示:{{value}}": "แสดงบนเว็บไซต์: {{value}}",
|
||||
"{{team}} · 研发占比 {{ratio}}": "{{team}} · สัดส่วน R&D {{ratio}}",
|
||||
"降幅": "ลดลง",
|
||||
"首页与关于微词元共用": "ใช้ร่วมกันระหว่างหน้าแรกและเกี่ยวกับเรา",
|
||||
"关于微元算力": "เกี่ยวกับ 微元算力",
|
||||
"配置官网关于微元算力区域展示的团队与服务信息。": "กำหนดข้อมูลทีมและบริการที่แสดงในส่วนเกี่ยวกับ 微元算力 บนเว็บไซต์ทางการ",
|
||||
"首页与关于微元算力共用": "ใช้ร่วมกันระหว่างหน้าแรกและส่วนเกี่ยวกับ 微元算力",
|
||||
"请完善关于微元算力的配置": "โปรดกำหนดค่าส่วนเกี่ยวกับ 微元算力 ให้ครบถ้วน",
|
||||
"四个页签共用一份配置,保存时将统一校验并提交。": "แท็บทั้งสี่จะใช้การกําหนดค่าร่วมกันและจะได้รับการตรวจสอบและส่งเมื่อบันทึก",
|
||||
"富文本工具栏": "แถบเครื่องมือข้อความที่มีรูปแบบ",
|
||||
"正文段落": "ย่อหน้าเนื้อหา",
|
||||
|
||||
@@ -11330,7 +11330,10 @@
|
||||
"官网展示:{{value}}": "Hiển thị trên website: {{value}}",
|
||||
"{{team}} · 研发占比 {{ratio}}": "{{team}} · tỷ lệ R&D {{ratio}}",
|
||||
"降幅": "mức giảm",
|
||||
"首页与关于微词元共用": "dùng chung cho Trang chủ và Giới thiệu",
|
||||
"关于微元算力": "Giới thiệu 微元算力",
|
||||
"配置官网关于微元算力区域展示的团队与服务信息。": "Cấu hình thông tin đội ngũ và dịch vụ hiển thị trong mục Giới thiệu 微元算力 trên trang web chính thức.",
|
||||
"首页与关于微元算力共用": "Dùng chung cho Trang chủ và Giới thiệu 微元算力",
|
||||
"请完善关于微元算力的配置": "Vui lòng hoàn tất cấu hình mục Giới thiệu 微元算力",
|
||||
"四个页签共用一份配置,保存时将统一校验并提交。": "Bốn tab dùng chung một bản sao của bố trí và được kiểm tra và cam kết thống nhất khi bạn lưu lại.",
|
||||
"富文本工具栏": "Thanh công cụ văn bản có định dạng",
|
||||
"正文段落": "Đoạn văn bản",
|
||||
|
||||
@@ -11330,7 +11330,10 @@
|
||||
"官网展示:{{value}}": "官網展示:{{value}}",
|
||||
"{{team}} · 研发占比 {{ratio}}": "{{team}} · 研發佔比 {{ratio}}",
|
||||
"降幅": "降幅",
|
||||
"首页与关于微词元共用": "首頁與關於微詞元共用",
|
||||
"关于微元算力": "關於微元算力",
|
||||
"配置官网关于微元算力区域展示的团队与服务信息。": "設定官網關於微元算力區域顯示的團隊與服務資訊。",
|
||||
"首页与关于微元算力共用": "首頁與關於微元算力共用",
|
||||
"请完善关于微元算力的配置": "請完善關於微元算力的設定",
|
||||
"四个页签共用一份配置,保存时将统一校验并提交。": "四個頁籤共用一份配置,保存時將統一校驗並提交。",
|
||||
"富文本工具栏": "富文字工具列",
|
||||
"正文段落": "內文段落",
|
||||
|
||||
@@ -11245,7 +11245,10 @@
|
||||
"官网展示:{{value}}": "官网展示:{{value}}",
|
||||
"{{team}} · 研发占比 {{ratio}}": "{{team}} · 研发占比 {{ratio}}",
|
||||
"降幅": "降幅",
|
||||
"首页与关于微词元共用": "首页与关于微词元共用",
|
||||
"关于微元算力": "关于微元算力",
|
||||
"配置官网关于微元算力区域展示的团队与服务信息。": "配置官网关于微元算力区域展示的团队与服务信息。",
|
||||
"首页与关于微元算力共用": "首页与关于微元算力共用",
|
||||
"请完善关于微元算力的配置": "请完善关于微元算力的配置",
|
||||
"四个页签共用一份配置,保存时将统一校验并提交。": "四个页签共用一份配置,保存时将统一校验并提交。",
|
||||
"富文本工具栏": "富文本工具栏",
|
||||
"正文段落": "正文段落",
|
||||
|
||||
@@ -506,12 +506,12 @@ const Analytics = () => {
|
||||
/>
|
||||
|
||||
{/* 自动封号历史 */}
|
||||
<div className='mt-6 mb-6'>
|
||||
<div className='analytics-fold-panel'>
|
||||
<CollapsibleHeader
|
||||
icon={<History className='w-5 h-5' />}
|
||||
title={t('自动封号历史')}
|
||||
isOpen={banLogsOpen}
|
||||
onToggle={() => setBanLogsOpen(!banLogsOpen)}
|
||||
onToggle={() => setBanLogsOpen((open) => !open)}
|
||||
t={t}
|
||||
extra={
|
||||
<span className='text-xs text-gray-400 ml-2'>
|
||||
@@ -520,7 +520,7 @@ const Analytics = () => {
|
||||
}
|
||||
/>
|
||||
<Collapsible isOpen={banLogsOpen} keepDOM>
|
||||
<div className='mt-2 px-5 py-4 bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-100 dark:border-gray-700'>
|
||||
<div className='min-w-0 px-5 py-4'>
|
||||
<RiskControlBanLogs
|
||||
loading={risk.banLogLoading}
|
||||
banLogs={risk.banLogs}
|
||||
|
||||
@@ -7,12 +7,20 @@
|
||||
--igf-muted: var(--text-secondary);
|
||||
--igf-line: var(--border-subtle);
|
||||
--igf-surface: var(--surface-card);
|
||||
--igf-accent: var(--ui-color-primary);
|
||||
--igf-accent: var(--brand-accent);
|
||||
--igf-fill: color-mix(in srgb, var(--text-primary) 4%, var(--surface-card));
|
||||
--igf-danger: var(--ui-color-danger);
|
||||
--igf-warning: var(--ui-color-warning);
|
||||
--igf-ring: color-mix(in srgb, var(--ui-color-primary) 55%, transparent);
|
||||
--igf-ring: var(--brand-accent);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--igf-line);
|
||||
border-radius: 12px;
|
||||
background: var(--igf-surface);
|
||||
color: var(--igf-ink);
|
||||
}
|
||||
|
||||
.igf-form-scroll {
|
||||
@@ -20,7 +28,182 @@
|
||||
min-height: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
padding: 16px;
|
||||
padding: 14px 16px 16px;
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
|
||||
.igf-form-scroll[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.igf-header {
|
||||
display: flex;
|
||||
flex: none;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 15px 16px;
|
||||
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 {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.igf-header-actions {
|
||||
display: flex;
|
||||
flex: none;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.igf-title {
|
||||
margin: 0;
|
||||
font-size: 21px;
|
||||
font-weight: 650;
|
||||
line-height: 27px;
|
||||
}
|
||||
|
||||
.igf-description {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
color: var(--igf-muted);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.igf-section + .igf-section {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.igf-field-heading {
|
||||
margin: 0 0 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 650;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.igf-configuration,
|
||||
.igf-parameters {
|
||||
padding: 12px;
|
||||
border: 1px solid var(--igf-line);
|
||||
border-radius: 10px;
|
||||
background: var(--igf-fill);
|
||||
}
|
||||
|
||||
.igf-mode-field {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.igf-mode-group.cp-option-group {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
gap: 3px;
|
||||
background: var(--igf-surface);
|
||||
}
|
||||
|
||||
.igf-mode-group .cp-option {
|
||||
flex: 1 1 auto;
|
||||
padding-inline: 6px;
|
||||
}
|
||||
|
||||
.igf-mode-group .cp-option.is-selected {
|
||||
border-color: var(--igf-accent);
|
||||
background: var(--brand-selection-bg);
|
||||
color: var(--brand-selection-text);
|
||||
}
|
||||
|
||||
.igf-editor {
|
||||
border: 1px solid var(--igf-line);
|
||||
border-radius: 10px;
|
||||
background: var(--igf-fill);
|
||||
}
|
||||
|
||||
.igf-editor:focus-within {
|
||||
border-color: var(--igf-accent);
|
||||
}
|
||||
|
||||
.igf-editor textarea.ant-input {
|
||||
min-height: 78px;
|
||||
padding: 9px 10px;
|
||||
resize: vertical;
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.igf-editor-toolbar,
|
||||
.igf-editor-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.igf-editor-toolbar {
|
||||
justify-content: space-between;
|
||||
padding: 4px 6px;
|
||||
border-top: 1px solid var(--igf-line);
|
||||
}
|
||||
|
||||
.igf-editor-actions .ant-btn {
|
||||
padding-inline: 7px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.igf-shortcut {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
padding: 1px 5px;
|
||||
border: 1px solid var(--igf-line);
|
||||
border-radius: 5px;
|
||||
color: var(--igf-muted);
|
||||
font-size: 11px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.igf-history-item {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
max-width: min(280px, 70vw);
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.igf-templates {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.igf-templates .ant-btn {
|
||||
flex: 1 1 27%;
|
||||
min-height: 28px;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.igf-templates-label {
|
||||
flex-basis: 100%;
|
||||
color: var(--igf-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.igf-generate .igf-submit.ant-btn {
|
||||
height: 42px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* Keep disabled generation actions grounded in the same surface and border token. */
|
||||
@@ -139,13 +322,36 @@
|
||||
}
|
||||
|
||||
.igf-slots {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.igf-slots .cp-slot {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 9px;
|
||||
}
|
||||
|
||||
.igf-reference-hint {
|
||||
margin: 6px 0 0;
|
||||
}
|
||||
|
||||
.igf-size .cp-option-group--ratio {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 78px), 1fr));
|
||||
}
|
||||
|
||||
.igf-size .cp-option-group--ratio .cp-option {
|
||||
min-width: 64px;
|
||||
gap: 3px;
|
||||
min-width: 0;
|
||||
padding: 6px 4px;
|
||||
}
|
||||
|
||||
.igf-size .cp-option-group--ratio .cp-option-label {
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.igf-size-dims {
|
||||
@@ -175,6 +381,35 @@
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.igf-advanced-trigger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
min-height: 34px;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid var(--igf-line);
|
||||
border-radius: 8px;
|
||||
color: var(--igf-muted);
|
||||
font-size: 13px;
|
||||
text-align: start;
|
||||
}
|
||||
|
||||
.igf-advanced-trigger span {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.igf-advanced-trigger:hover,
|
||||
.igf-advanced-trigger[aria-expanded='true'] {
|
||||
border-color: var(--igf-accent);
|
||||
background: var(--brand-selection-bg);
|
||||
color: var(--brand-selection-text);
|
||||
}
|
||||
|
||||
.igf-advanced-content {
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
.igf-generate {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -183,11 +418,20 @@
|
||||
|
||||
.igf-generate-wrap {
|
||||
flex: 0 0 auto;
|
||||
padding: 16px 16px max(16px, env(safe-area-inset-bottom));
|
||||
padding: 12px 16px max(12px, env(safe-area-inset-bottom));
|
||||
border-top: 1px solid var(--igf-line);
|
||||
background: var(--igf-surface);
|
||||
}
|
||||
|
||||
.igf-collapsed-summary {
|
||||
overflow: hidden;
|
||||
margin: 0 0 8px;
|
||||
color: var(--igf-muted);
|
||||
font-size: 12px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.igf-quote {
|
||||
min-height: 18px;
|
||||
color: var(--igf-muted);
|
||||
|
||||
@@ -15,6 +15,20 @@ import {
|
||||
|
||||
const CUSTOM = '__custom__';
|
||||
|
||||
const formatPreset = ({ width, height, label }) => {
|
||||
const dimensions = `${width}×${height}`;
|
||||
const caption = label
|
||||
.replace(/\s*[((]\s*\d+\s*[x×]\s*\d+\s*[))]\s*$/i, '')
|
||||
.trim();
|
||||
return {
|
||||
dimensions,
|
||||
caption:
|
||||
caption.toLowerCase().replace(/\s/g, '').replace('x', '×') === dimensions
|
||||
? ''
|
||||
: caption,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 图像尺寸(schema type = 'size'):预设按宽高比图标展示;仅当 schema 下发 custom_size 时
|
||||
* 提供"自定义",宽高输入框失焦 / 回车时按 min / max / step 吸附。
|
||||
@@ -83,7 +97,9 @@ const ImageSizePicker = ({ param, value, onChange }) => {
|
||||
getOptionAriaLabel={(opt) => {
|
||||
if (opt === CUSTOM) return t('自定义尺寸');
|
||||
const p = presets.find((x) => x.value === opt);
|
||||
return p ? `${p.label || ''} ${p.width}×${p.height}`.trim() : opt;
|
||||
if (!p) return opt;
|
||||
const { caption, dimensions } = formatPreset(p);
|
||||
return caption ? `${caption} ${dimensions}` : dimensions;
|
||||
}}
|
||||
renderOption={(opt) => {
|
||||
if (opt === CUSTOM) {
|
||||
@@ -97,16 +113,16 @@ const ImageSizePicker = ({ param, value, onChange }) => {
|
||||
);
|
||||
}
|
||||
const p = presets.find((x) => x.value === opt);
|
||||
if (!p) return opt;
|
||||
const { caption, dimensions } = formatPreset(p);
|
||||
return (
|
||||
<>
|
||||
<RatioShape ratio={`${p.width}:${p.height}`} />
|
||||
<span className='cp-option-label tabular-nums'>
|
||||
{p.label || `${p.width}×${p.height}`}
|
||||
</span>
|
||||
{p.label ? (
|
||||
<span className='igf-size-dims tabular-nums'>
|
||||
{p.width}×{p.height}
|
||||
{caption || dimensions}
|
||||
</span>
|
||||
{caption ? (
|
||||
<span className='igf-size-dims tabular-nums'>{dimensions}</span>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { I18N_TECHNICAL_TEXT } from '../../../../i18n/technicalText.js';
|
||||
import {
|
||||
Wallet as ActionWallet,
|
||||
Zap as ActionZap,
|
||||
RotateCcw as ActionRotateCcw,
|
||||
ChevronDown as ActionChevronDown,
|
||||
ChevronUp as ActionChevronUp,
|
||||
History as ActionHistory,
|
||||
Settings as ActionSettings,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import React, { useEffect, useId, useRef, useState } from 'react';
|
||||
import {
|
||||
Button,
|
||||
Collapsible,
|
||||
@@ -43,7 +44,7 @@ import {
|
||||
import ImageSizePicker from './Image/ImageSizePicker';
|
||||
import './Image/ImageGenerationForm.css';
|
||||
|
||||
const { Title, Text } = Typography;
|
||||
const { Text } = Typography;
|
||||
|
||||
// sessionStorage prompt 历史 key
|
||||
const PROMPT_HISTORY_KEY = 'expCenter.imageGen.promptHistory.v1';
|
||||
@@ -119,20 +120,9 @@ const hasImageTaskType = (dataTransfer) =>
|
||||
Array.from(dataTransfer.types).includes('application/x-image-task'),
|
||||
);
|
||||
|
||||
const Section = ({ title, extra, children, className = '' }) => (
|
||||
<div
|
||||
className={`mb-4 rounded-3xl border border-[var(--igf-line)] bg-white/[0.28] p-3 backdrop-blur-xl dark:bg-white/[0.045] ${className}`}
|
||||
>
|
||||
{title || extra ? (
|
||||
<div className='flex items-center justify-between gap-2 mb-2'>
|
||||
{title ? (
|
||||
<Text strong className='text-sm text-gray-700 dark:text-gray-200'>
|
||||
{title}
|
||||
</Text>
|
||||
) : null}
|
||||
{extra}
|
||||
</div>
|
||||
) : null}
|
||||
const Section = ({ title, children, className = '' }) => (
|
||||
<div className={`igf-section ${className}`}>
|
||||
{title && <h2 className='igf-field-heading'>{title}</h2>}
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
@@ -145,6 +135,10 @@ const ImageGenerationForm = ({ creation }) => {
|
||||
const { t } = useTranslation();
|
||||
const navigate = useNavigate();
|
||||
const isMobile = useIsMobile();
|
||||
const bodyId = useId();
|
||||
const advancedId = useId();
|
||||
const promptId = useId();
|
||||
const quoteId = useId();
|
||||
const [mobileCollapsed, setMobileCollapsed] = useState(false);
|
||||
const [showAdvanced, setShowAdvanced] = useState(false);
|
||||
const [dropActive, setDropActive] = useState(false);
|
||||
@@ -348,10 +342,10 @@ const ImageGenerationForm = ({ creation }) => {
|
||||
theme='solid'
|
||||
size='large'
|
||||
block
|
||||
icon={<ActionWallet size={16} />}
|
||||
icon={<ActionWallet size={16} aria-hidden='true' />}
|
||||
aria-describedby={quoteId}
|
||||
onClick={() => navigate('/console/topup')}
|
||||
className='!rounded-2xl'
|
||||
style={{ height: '48px', fontSize: '15px', fontWeight: 700 }}
|
||||
className='igf-submit'
|
||||
>
|
||||
{t('去充值')}
|
||||
</Button>
|
||||
@@ -362,26 +356,17 @@ const ImageGenerationForm = ({ creation }) => {
|
||||
size='large'
|
||||
block
|
||||
loading={submitting}
|
||||
icon={<ActionZap size={16} aria-hidden='true' />}
|
||||
aria-describedby={quoteId}
|
||||
onClick={handleSubmit}
|
||||
disabled={isButtonDisabled}
|
||||
className='!rounded-2xl !transition-colors'
|
||||
style={{
|
||||
background: isButtonDisabled
|
||||
? 'var(--ui-color-fill-1)'
|
||||
: 'linear-gradient(135deg, var(--brand-gradient-from) 0%, var(--brand-primary) 52%, var(--brand-gradient-to) 100%)',
|
||||
border: isButtonDisabled
|
||||
? '1px solid var(--igf-line)'
|
||||
: '1px solid transparent',
|
||||
color: isButtonDisabled ? 'var(--ui-color-text-3)' : 'white',
|
||||
height: '48px',
|
||||
fontSize: '15px',
|
||||
fontWeight: '700',
|
||||
}}
|
||||
className='igf-submit'
|
||||
>
|
||||
{submitting ? t('提交中...') : t('生成图片')}
|
||||
</Button>
|
||||
)}
|
||||
<div
|
||||
id={quoteId}
|
||||
className={`igf-quote${needTopUp ? ' is-warning' : ''}`}
|
||||
aria-live='polite'
|
||||
role={isButtonDisabled ? 'note' : undefined}
|
||||
@@ -521,98 +506,80 @@ const ImageGenerationForm = ({ creation }) => {
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`image-generation-form relative flex h-full min-h-0 flex-col overflow-hidden rounded-[28px] border border-[var(--igf-line)] bg-white/[0.42] shadow-[0_24px_80px_rgba(15,23,42,0.10)] backdrop-blur-2xl backdrop-saturate-150 transition-colors dark:bg-neutral-950/[0.40] dark:shadow-[0_24px_80px_rgba(0,0,0,0.35)]${dropActive ? ' is-drop-active' : ''}`}
|
||||
className={`image-generation-form${dropActive ? ' is-drop-active' : ''}`}
|
||||
onDragEnter={handleDragEnter}
|
||||
onDragOver={handleDragOver}
|
||||
onDragLeave={handleDragLeave}
|
||||
onDrop={handleDrop}
|
||||
>
|
||||
<div className='igf-form-scroll app-scrollbar'>
|
||||
{/* 标题 */}
|
||||
<div className='mb-5 rounded-3xl border border-white/60 bg-white/[0.50] p-4 shadow-sm backdrop-blur-xl dark:border-white/10 dark:bg-white/[0.05]'>
|
||||
<div className='flex items-center justify-between gap-2'>
|
||||
<div className='flex-1 min-w-0'>
|
||||
<div className='mb-2 inline-flex items-center gap-2 rounded-full border border-brand/25 bg-brand/10 px-2.5 py-1 text-[11px] font-medium text-brand-deep dark:border-brand/25 dark:bg-brand/15 dark:text-brand-from'>
|
||||
<Sparkles size={12} />
|
||||
{t('AI 图片创作')}
|
||||
</div>
|
||||
<Title
|
||||
heading={4}
|
||||
style={{ margin: 0 }}
|
||||
className='text-gray-900 dark:text-white'
|
||||
>
|
||||
{t('图片生成')}
|
||||
</Title>
|
||||
<Text
|
||||
type='secondary'
|
||||
size='small'
|
||||
className='text-gray-500 dark:text-gray-400 mt-1 block truncate'
|
||||
<header className='igf-header'>
|
||||
<span className='igf-header-icon' aria-hidden='true'>
|
||||
<Sparkles size={19} />
|
||||
</span>
|
||||
<div className='igf-header-copy'>
|
||||
<h1 className='igf-title'>{t('图片生成')}</h1>
|
||||
<span
|
||||
className='igf-description'
|
||||
title={
|
||||
formBodyHidden
|
||||
? selectedModel?.display_name || selectedModel?.model
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{formBodyHidden && selectedModel
|
||||
? selectedModel.display_name || selectedModel.model
|
||||
: t('输入描述即可生成图片')}
|
||||
</Text>
|
||||
</span>
|
||||
</div>
|
||||
<div className='flex items-center gap-1'>
|
||||
<div className='igf-header-actions'>
|
||||
{!formBodyHidden && (
|
||||
<Tooltip content={t('重置')}>
|
||||
<Button
|
||||
icon={<ActionRotateCcw size={12} />}
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<ActionRotateCcw size={15} aria-hidden='true' />}
|
||||
theme='outline'
|
||||
aria-label={t('重置')}
|
||||
onClick={handleReset}
|
||||
className='!text-gray-500 hover:!text-brand-deep dark:hover:!text-brand-from'
|
||||
>
|
||||
{t('重置')}
|
||||
</Button>
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
{isMobile && (
|
||||
<Button
|
||||
icon={
|
||||
mobileCollapsed ? (
|
||||
<ActionChevronDown size={14} />
|
||||
<ActionChevronDown size={15} aria-hidden='true' />
|
||||
) : (
|
||||
<ActionChevronUp size={14} />
|
||||
<ActionChevronUp size={15} aria-hidden='true' />
|
||||
)
|
||||
}
|
||||
size='small'
|
||||
theme='borderless'
|
||||
theme='outline'
|
||||
title={mobileCollapsed ? t('展开') : t('收起')}
|
||||
onClick={() => setMobileCollapsed(!mobileCollapsed)}
|
||||
className='!text-gray-500'
|
||||
>
|
||||
{mobileCollapsed ? t('展开') : t('收起')}
|
||||
</Button>
|
||||
aria-label={mobileCollapsed ? t('展开') : t('收起')}
|
||||
aria-controls={bodyId}
|
||||
aria-expanded={!formBodyHidden}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{/* 移动端折叠时只显示生成按钮 + 简略 */}
|
||||
{formBodyHidden && (
|
||||
<div className='mt-2'>
|
||||
{renderGenerateArea()}
|
||||
<Text
|
||||
type='tertiary'
|
||||
size='small'
|
||||
className='block mt-2 text-center'
|
||||
<div
|
||||
id={bodyId}
|
||||
className='igf-form-scroll app-scrollbar'
|
||||
hidden={formBodyHidden}
|
||||
>
|
||||
{prompt
|
||||
? prompt.length > 50
|
||||
? prompt.slice(0, 50) + '...'
|
||||
: prompt
|
||||
: t('点击展开编辑参数')}
|
||||
</Text>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!formBodyHidden && (
|
||||
<>
|
||||
{/* 模型选择 */}
|
||||
<Section title={t('选择模型')}>{renderModelSection()}</Section>
|
||||
<Section className='igf-configuration'>
|
||||
<div className='igf-field-heading'>{t('选择模型')}</div>
|
||||
{renderModelSection()}
|
||||
|
||||
{/* 生成方式(来自 schema modes) */}
|
||||
{selectedModel && modeOptions.length > 1 ? (
|
||||
<Section title={t('生成方式')}>
|
||||
<div className='igf-mode-field'>
|
||||
<div className='igf-field-heading'>{t('生成方式')}</div>
|
||||
<OptionGroup
|
||||
variant='segmented'
|
||||
className='igf-mode-group'
|
||||
options={modeOptions.map((o) => o.mode)}
|
||||
value={formData.mode}
|
||||
onChange={setMode}
|
||||
@@ -632,30 +599,36 @@ const ImageGenerationForm = ({ creation }) => {
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</Section>
|
||||
</div>
|
||||
) : null}
|
||||
</Section>
|
||||
|
||||
{/* 提示词 + 模板 + 历史 */}
|
||||
<Section
|
||||
title={t('提示词')}
|
||||
extra={
|
||||
<div className='flex items-center gap-2'>
|
||||
{/* AI 优化提示词 —— 按钮始终可点击,handler 内判断并 Toast 解释原因 */}
|
||||
<button
|
||||
type='button'
|
||||
title={<label htmlFor={promptId}>{t('提示词')}</label>}
|
||||
className='igf-prompt-section'
|
||||
>
|
||||
<div className='igf-editor'>
|
||||
<TextArea
|
||||
id={promptId}
|
||||
variant='borderless'
|
||||
placeholder={t('描述你想要生成的图片内容...')}
|
||||
value={prompt}
|
||||
onChange={setPrompt}
|
||||
onKeyDown={handlePromptKeyDown}
|
||||
rows={3}
|
||||
maxCount={2000}
|
||||
showClear
|
||||
/>
|
||||
<div className='igf-editor-toolbar'>
|
||||
<div className='igf-editor-actions'>
|
||||
<Button
|
||||
type='text'
|
||||
size='small'
|
||||
icon={<ActionZap size={13} aria-hidden='true' />}
|
||||
onClick={handleOptimizePrompt}
|
||||
aria-label={t('AI 优化提示词')}
|
||||
className={[
|
||||
'app-action-button',
|
||||
[
|
||||
'flex items-center gap-1 text-[10px] transition-colors',
|
||||
optimizing
|
||||
? 'text-brand-from'
|
||||
: 'text-gray-400 hover:text-brand-deep dark:hover:text-brand-from',
|
||||
].join(' '),
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' ')}
|
||||
aria-busy={optimizing}
|
||||
title={
|
||||
textModels?.length
|
||||
? t('AI 优化提示词 (使用 {{m}})', {
|
||||
@@ -664,102 +637,71 @@ const ImageGenerationForm = ({ creation }) => {
|
||||
: t('AI 优化提示词')
|
||||
}
|
||||
>
|
||||
<Sparkles
|
||||
size={10}
|
||||
className={optimizing ? 'animate-pulse' : ''}
|
||||
/>
|
||||
<span>{optimizing ? t('优化中...') : t('AI 优化')}</span>
|
||||
</button>
|
||||
|
||||
{optimizing ? t('优化中...') : t('AI 优化')}
|
||||
</Button>
|
||||
{promptHistory.length > 0 && (
|
||||
<Dropdown
|
||||
trigger='click'
|
||||
position='bottomRight'
|
||||
position='bottomLeft'
|
||||
render={
|
||||
<Dropdown.Menu style={{ maxWidth: 360 }}>
|
||||
{promptHistory.map((p, idx) => (
|
||||
{promptHistory.map((item) => (
|
||||
<Dropdown.Item
|
||||
key={idx}
|
||||
onClick={() => setPrompt(p)}
|
||||
key={item}
|
||||
onClick={() => setPrompt(item)}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
maxWidth: 320,
|
||||
overflow: 'hidden',
|
||||
textOverflow: 'ellipsis',
|
||||
whiteSpace: 'nowrap',
|
||||
}}
|
||||
title={p}
|
||||
>
|
||||
{p}
|
||||
</div>
|
||||
<span className='igf-history-item' title={item}>
|
||||
{item}
|
||||
</span>
|
||||
</Dropdown.Item>
|
||||
))}
|
||||
</Dropdown.Menu>
|
||||
}
|
||||
>
|
||||
<button
|
||||
type='button'
|
||||
className='app-action-button flex items-center gap-1 text-[10px] text-gray-400 hover:text-brand-deep dark:hover:text-brand-from transition-colors'
|
||||
<Button
|
||||
type='text'
|
||||
size='small'
|
||||
icon={<ActionHistory size={13} aria-hidden='true' />}
|
||||
>
|
||||
<ActionHistory size={10} />
|
||||
<span>{t('历史')}</span>
|
||||
</button>
|
||||
{t('历史')}
|
||||
</Button>
|
||||
</Dropdown>
|
||||
)}
|
||||
<span className='flex items-center gap-1 text-[10px] text-gray-400'>
|
||||
</div>
|
||||
{!isMobile && (
|
||||
<kbd className='igf-shortcut' title={t('生成图片')}>
|
||||
{IS_MAC ? (
|
||||
<Command size={10} />
|
||||
<Command size={11} />
|
||||
) : (
|
||||
<span>{I18N_TECHNICAL_TEXT.CTRL}</span>
|
||||
I18N_TECHNICAL_TEXT.CTRL
|
||||
)}
|
||||
<span>+</span>
|
||||
<span>{I18N_TECHNICAL_TEXT.ENTER}</span>
|
||||
<span>{t('生成')}</span>
|
||||
</span>
|
||||
{I18N_TECHNICAL_TEXT.ENTER}
|
||||
</kbd>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<TextArea
|
||||
placeholder={t('描述你想要生成的图片内容...')}
|
||||
value={prompt}
|
||||
onChange={setPrompt}
|
||||
onKeyDown={handlePromptKeyDown}
|
||||
rows={3}
|
||||
maxCount={2000}
|
||||
showClear
|
||||
className='[&_.ant-input-textarea]:!rounded-2xl [&_.ant-input-textarea]:!border-white/[0.55] [&_.ant-input-textarea]:!bg-white/[0.55] [&_.ant-input-textarea]:!shadow-inner dark:[&_.ant-input-textarea]:!border-white/10 dark:[&_.ant-input-textarea]:!bg-white/[0.06] [&_.ant-input-textarea:hover]:!border-brand/30 [&_.ant-input-textarea:focus]:!border-brand'
|
||||
/>
|
||||
|
||||
<div className='flex flex-wrap items-center gap-1.5 mt-2'>
|
||||
<div className='flex items-center gap-1 text-[10px] text-gray-400 mr-1'>
|
||||
<Sparkles size={10} />
|
||||
<div className='igf-templates'>
|
||||
<div className='igf-templates-label'>
|
||||
<span>{t('快速模板')}</span>
|
||||
</div>
|
||||
{PROMPT_TEMPLATES.map((tpl) => (
|
||||
<Tag
|
||||
<Button
|
||||
key={tpl.label}
|
||||
theme='outline'
|
||||
size='small'
|
||||
color='grey'
|
||||
onClick={() => handleApplyTemplate(tpl)}
|
||||
className='!cursor-pointer !rounded-full !border-white/50 !bg-white/[0.45] !backdrop-blur hover:!bg-brand/10 dark:!border-white/10 dark:!bg-white/[0.06] dark:hover:!bg-brand/15 hover:!text-brand-deep dark:hover:!text-brand-from !transition-colors'
|
||||
>
|
||||
{t(tpl.label)}
|
||||
</Tag>
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
{/* 参考图:编辑模式的带标签槽位;当前模型 / 模式用不到的图片置灰保留 */}
|
||||
{selectedModel && imageSlots.length > 0 ? (
|
||||
<Section
|
||||
title={t('参考图片')}
|
||||
extra={
|
||||
<Text type='tertiary' className='!text-[10px]'>
|
||||
{t('可从右侧历史拖拽图片到这里')}
|
||||
</Text>
|
||||
}
|
||||
>
|
||||
<Section title={t('参考图片')} className='igf-reference'>
|
||||
<div className='igf-slots'>
|
||||
{imageSlots.map((entry) => {
|
||||
const slot = entry.slot;
|
||||
@@ -784,6 +726,11 @@ const ImageGenerationForm = ({ creation }) => {
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
{!isMobile && (
|
||||
<p className='igf-muted igf-reference-hint'>
|
||||
{t('可从右侧历史拖拽图片到这里')}
|
||||
</p>
|
||||
)}
|
||||
{hasUnusedImage ? (
|
||||
<div className='igf-muted igf-note' role='note'>
|
||||
{t(
|
||||
@@ -796,7 +743,10 @@ const ImageGenerationForm = ({ creation }) => {
|
||||
|
||||
{/* 尺寸 + 常用参数(画质 / 数量等) */}
|
||||
{selectedModel && (sizeParam || dockParams.length > 0) ? (
|
||||
<Section title={sizeParam ? t('尺寸') : t('生成参数')}>
|
||||
<Section
|
||||
className='igf-parameters'
|
||||
title={sizeParam ? t('尺寸') : t('生成参数')}
|
||||
>
|
||||
{sizeParam ? (
|
||||
<ImageSizePicker
|
||||
param={sizeParam}
|
||||
@@ -819,14 +769,15 @@ const ImageGenerationForm = ({ creation }) => {
|
||||
|
||||
{/* 高级选项 */}
|
||||
{selectedModel && advancedParams.length > 0 ? (
|
||||
<Section>
|
||||
<Section className='igf-advanced'>
|
||||
<button
|
||||
type='button'
|
||||
onClick={() => setShowAdvanced(!showAdvanced)}
|
||||
aria-expanded={showAdvanced}
|
||||
className='app-action-button flex items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400 hover:text-brand-deep dark:hover:text-brand-from transition-colors'
|
||||
aria-controls={advancedId}
|
||||
className='igf-advanced-trigger'
|
||||
>
|
||||
<ActionSettings size={12} />
|
||||
<ActionSettings size={15} aria-hidden='true' />
|
||||
<span>{t('高级选项')}</span>
|
||||
{showAdvanced ? (
|
||||
<ActionChevronUp size={12} />
|
||||
@@ -835,7 +786,7 @@ const ImageGenerationForm = ({ creation }) => {
|
||||
)}
|
||||
</button>
|
||||
<Collapsible isOpen={showAdvanced} keepDOM>
|
||||
<div className='pt-3'>
|
||||
<div id={advancedId} className='igf-advanced-content'>
|
||||
<ParamRenderer
|
||||
params={visibleParams}
|
||||
values={formData.params}
|
||||
@@ -850,9 +801,14 @@ const ImageGenerationForm = ({ creation }) => {
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{!formBodyHidden && (
|
||||
<div className='igf-generate-wrap'>{renderGenerateArea()}</div>
|
||||
<footer className='igf-generate-wrap'>
|
||||
{formBodyHidden && (
|
||||
<p className='igf-collapsed-summary' title={prompt || undefined}>
|
||||
{prompt || t('点击展开编辑参数')}
|
||||
</p>
|
||||
)}
|
||||
{renderGenerateArea()}
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -60,17 +60,15 @@ const ImageGenerationTab = () => {
|
||||
return (
|
||||
<>
|
||||
{/*
|
||||
移动端(< md):Tab 整体允许竖向滚动 —— 表单和任务列表按自然高度堆叠,用户上下滚浏览。
|
||||
桌面端(>= md):保持 overflow-hidden,左右两栏各自内部滚动。
|
||||
窄屏堆叠并整体滚动,宽屏双栏各自滚动。
|
||||
*/}
|
||||
<div className='h-full min-h-0 flex flex-col md:flex-row gap-4 p-3 sm:p-4 overflow-y-auto md:overflow-hidden'>
|
||||
<div className='image-generation-workspace h-full min-h-0 flex flex-col lg:flex-row gap-4 p-4 lg:p-6 overflow-y-auto lg:overflow-hidden'>
|
||||
{/* 左侧:生成参数表单 */}
|
||||
<div className='w-full md:w-[22rem] xl:w-[24rem] md:flex-shrink-0 md:h-full'>
|
||||
<div className='w-full shrink-0 lg:w-[20rem] xl:w-[22rem] lg:h-full'>
|
||||
<ImageGenerationForm creation={creation} />
|
||||
</div>
|
||||
|
||||
{/* 右侧:任务列表 —— flex-1 只在桌面端生效,移动端按内容高度展开 */}
|
||||
<div className='md:flex-1 md:min-h-0 flex flex-col'>
|
||||
<div className='min-w-0 lg:flex-1 lg:min-h-0 flex flex-col'>
|
||||
<ImageTaskList
|
||||
tasks={tasks}
|
||||
onRefresh={refreshTasks}
|
||||
|
||||
@@ -227,22 +227,19 @@ useCallback; // 事件处理函数优化
|
||||
### CSS 变量
|
||||
|
||||
```css
|
||||
--ui-color-primary // 主色
|
||||
--ui-color-success // 成功色
|
||||
--ui-color-warning // 警告色
|
||||
--ui-color-danger // 危险色
|
||||
--ui-color-bg-2 // 背景色
|
||||
--ui-color-border // 边框色
|
||||
--brand-accent // 聚焦与选中边框
|
||||
--brand-selection-bg // 筛选和收藏选中底色
|
||||
--surface-card // 卡片背景
|
||||
--border-subtle // 描边与操作区分隔线
|
||||
```
|
||||
|
||||
### 自定义类
|
||||
|
||||
```css
|
||||
.task-card-hover // 卡片悬停效果
|
||||
.task-list-scroll // 滚动条样式
|
||||
.stat-card // 统计卡片样式
|
||||
.image-preview-container // 图片预览容器
|
||||
.progress-pulse // 进度条动画
|
||||
.image-task-grid // 密度与响应式列数
|
||||
.image-task-card // 统一描边卡片
|
||||
.image-task-media // 统一 4:3 缩略图与状态占位
|
||||
.image-task-actions // 各密度均可访问的卡片操作
|
||||
```
|
||||
|
||||
## 浏览器兼容性
|
||||
|
||||
@@ -1,155 +1,429 @@
|
||||
/* 任务卡片悬停效果 */
|
||||
.task-card-hover {
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
.image-task-list {
|
||||
--ih-status-warning: var(--ui-color-warning);
|
||||
--ih-status-error: var(--ui-color-danger);
|
||||
--ih-dimension-bg: rgb(15 23 42 / 0.8);
|
||||
--ih-dimension-text: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.task-card-hover:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
|
||||
.image-history-toolbar {
|
||||
flex: none;
|
||||
padding: 16px;
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 12px;
|
||||
background: var(--surface-card);
|
||||
}
|
||||
|
||||
/* 滚动条样式已统一到 index.css 的 .app-scrollbar */
|
||||
|
||||
/* 统计卡片悬停效果 */
|
||||
.stat-card {
|
||||
transition: all 0.3s ease;
|
||||
.image-history-heading,
|
||||
.image-history-title-row,
|
||||
.image-history-tools,
|
||||
.image-history-status,
|
||||
.image-history-filters,
|
||||
.image-history-compare {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.stat-card:hover {
|
||||
transform: scale(1.02);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
.image-history-heading {
|
||||
justify-content: space-between;
|
||||
gap: 12px 16px;
|
||||
}
|
||||
|
||||
/* 图片预览悬停效果 */
|
||||
.image-preview-container {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
.image-history-title-row {
|
||||
gap: 12px 16px;
|
||||
}
|
||||
.image-history-title-row h2 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
line-height: 26px;
|
||||
font-weight: 650;
|
||||
}
|
||||
.image-history-status {
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.image-preview-container::after {
|
||||
.image-history-status-button,
|
||||
.image-history-clear {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-height: 34px;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 8px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.image-history-status-button:hover,
|
||||
.image-history-status-button[aria-pressed='true'],
|
||||
.image-history-clear:hover {
|
||||
background: var(--brand-selection-bg);
|
||||
color: var(--brand-selection-text);
|
||||
}
|
||||
|
||||
.image-history-status-button[aria-pressed='true'] {
|
||||
border-color: var(--brand-accent);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.image-history-count {
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
min-width: 18px;
|
||||
padding: 0 4px;
|
||||
border-radius: 5px;
|
||||
background: var(--surface-bg-base);
|
||||
color: var(--text-secondary);
|
||||
font-size: 11px;
|
||||
line-height: 18px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.image-history-status-button[aria-pressed='true'] .image-history-count {
|
||||
background: var(--surface-card);
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.image-history-filters {
|
||||
margin-top: 12px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.image-history-tools {
|
||||
flex-wrap: nowrap;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
gap: 6px;
|
||||
}
|
||||
.image-history-tools .image-task-search {
|
||||
width: 180px;
|
||||
min-width: 0;
|
||||
}
|
||||
.image-history-tools .ant-btn {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.image-task-model-filter {
|
||||
width: min(100%, 190px);
|
||||
}
|
||||
.image-task-size-filter {
|
||||
width: min(100%, 128px);
|
||||
}
|
||||
|
||||
.image-history-tools .ant-btn[aria-pressed='true'],
|
||||
.image-task-favorite.ant-btn[aria-pressed='true'] {
|
||||
border-color: var(--brand-accent);
|
||||
background: var(--brand-selection-bg);
|
||||
color: var(--brand-selection-text);
|
||||
}
|
||||
|
||||
.image-history-compare {
|
||||
margin-top: 12px;
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
background: var(--brand-selection-bg);
|
||||
color: var(--brand-selection-text);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.image-task-list .task-list-scrollable {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
.image-history-content {
|
||||
padding: 16px 0 4px;
|
||||
}
|
||||
|
||||
.image-history-empty-description {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.image-history-empty-description strong {
|
||||
color: var(--text-primary);
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.image-task-group-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.image-task-group-header h3 {
|
||||
margin: 0;
|
||||
font-size: 15px;
|
||||
line-height: 22px;
|
||||
font-weight: 650;
|
||||
}
|
||||
.image-task-group-header::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0);
|
||||
transition: background 0.3s;
|
||||
pointer-events: none;
|
||||
flex: 1;
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.image-preview-container:hover::after {
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
.image-task-grid {
|
||||
--ih-card-min: 268px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(
|
||||
auto-fill,
|
||||
minmax(min(100%, var(--ih-card-min)), 1fr)
|
||||
);
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
/* 进度条动画 */
|
||||
@keyframes pulse {
|
||||
0%,
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.image-task-grid[data-density='compact'] {
|
||||
--ih-card-min: 208px;
|
||||
gap: 12px;
|
||||
}
|
||||
.image-task-grid[data-density='grid'] {
|
||||
--ih-card-min: 144px;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
/* 处理中状态左侧彩条流光 */
|
||||
@keyframes brandShimmer {
|
||||
0% {
|
||||
background-position: 0% 0%;
|
||||
}
|
||||
100% {
|
||||
background-position: 0% 200%;
|
||||
}
|
||||
.image-task-card.ant-card {
|
||||
min-width: 0;
|
||||
border-color: var(--border-subtle);
|
||||
border-radius: 12px;
|
||||
background: var(--surface-card);
|
||||
color: var(--text-primary);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* drop target highlight */
|
||||
.image-ref-drop-active {
|
||||
outline: 2px dashed var(--brand-primary) !important;
|
||||
outline-offset: -4px;
|
||||
.image-task-card.ant-card:focus-within,
|
||||
.image-task-card.ant-card[data-selected='true'] {
|
||||
border-color: var(--brand-accent);
|
||||
}
|
||||
|
||||
.image-task-card.ant-card > .image-task-card-layout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.image-task-media {
|
||||
position: relative;
|
||||
aspect-ratio: 4 / 3;
|
||||
overflow: hidden;
|
||||
border-radius: 8px;
|
||||
background: var(--surface-bg-base);
|
||||
}
|
||||
|
||||
.image-task-media[data-status='failed'] {
|
||||
background: color-mix(
|
||||
in srgb,
|
||||
var(--brand-primary) 8%,
|
||||
transparent
|
||||
) !important;
|
||||
var(--ih-status-error) 5%,
|
||||
var(--surface-bg-base)
|
||||
);
|
||||
}
|
||||
|
||||
.progress-pulse {
|
||||
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
||||
.image-task-preview {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
border-radius: inherit;
|
||||
cursor: zoom-in;
|
||||
}
|
||||
.image-task-preview[aria-pressed] {
|
||||
cursor: pointer;
|
||||
}
|
||||
.image-task-preview img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
/* 按钮组动画 */
|
||||
.action-buttons {
|
||||
.image-task-dimensions {
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
bottom: 8px;
|
||||
padding: 2px 6px;
|
||||
border-radius: 5px;
|
||||
background: var(--ih-dimension-bg);
|
||||
color: var(--ih-dimension-text);
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.image-task-favorite.ant-btn,
|
||||
.image-task-select.ant-checkbox-wrapper {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
z-index: 1;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
min-width: 34px;
|
||||
height: 34px;
|
||||
margin: 0;
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 8px;
|
||||
background: var(--surface-card);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.image-task-select.ant-checkbox-wrapper .ant-checkbox {
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.image-task-placeholder {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.action-buttons > * {
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.action-buttons > *:hover {
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
/* 空状态样式 */
|
||||
.empty-state {
|
||||
padding: 60px 20px;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
padding: 8px;
|
||||
color: var(--text-secondary);
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
line-height: 15px;
|
||||
}
|
||||
|
||||
/* 搜索框样式增强 */
|
||||
.search-input-enhanced {
|
||||
transition: all 0.3s;
|
||||
.image-task-placeholder strong {
|
||||
color: var(--text-primary);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.search-input-enhanced:focus-within {
|
||||
box-shadow: 0 0 0 2px rgba(var(--ui-color-primary-rgb), 0.2);
|
||||
.image-task-status-icon {
|
||||
display: grid;
|
||||
flex-shrink: 0;
|
||||
place-items: center;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
margin-bottom: 2px;
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 9px;
|
||||
background: var(--surface-card);
|
||||
color: var(--brand-accent);
|
||||
}
|
||||
|
||||
/* 标签组样式 */
|
||||
.tag-group {
|
||||
.image-task-media[data-status='failed'] .image-task-status-icon {
|
||||
color: var(--ih-status-error);
|
||||
}
|
||||
.image-task-media[data-status='success'] .image-task-status-icon {
|
||||
color: var(--ih-status-warning);
|
||||
}
|
||||
.image-task-progress {
|
||||
width: min(100%, 132px);
|
||||
}
|
||||
|
||||
.image-task-error,
|
||||
.image-task-prompt {
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
overflow-wrap: anywhere;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.image-task-error {
|
||||
max-width: 90%;
|
||||
color: inherit;
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 2px;
|
||||
}
|
||||
.image-task-error-detail {
|
||||
max-width: min(70vw, 300px);
|
||||
max-height: 200px;
|
||||
overflow: auto;
|
||||
overflow-wrap: anywhere;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.image-task-info {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding: 10px 3px 2px;
|
||||
min-width: 0;
|
||||
}
|
||||
.image-task-prompt {
|
||||
min-height: 40px;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.image-task-meta {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
color: var(--text-secondary);
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
}
|
||||
.image-task-meta time {
|
||||
flex-shrink: 0;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.image-task-model {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.image-task-actions {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
margin-top: auto;
|
||||
padding-top: 8px;
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
}
|
||||
.image-task-primary-action {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.image-task-actions .ant-btn {
|
||||
min-height: 30px;
|
||||
}
|
||||
.image-task-list button:focus-visible {
|
||||
outline: 2px solid var(--brand-accent);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
.image-task-list .image-task-preview:focus-visible {
|
||||
outline-offset: -3px;
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 768px) {
|
||||
.task-card-content {
|
||||
flex-direction: column !important;
|
||||
}
|
||||
|
||||
.image-preview-container {
|
||||
width: 100% !important;
|
||||
min-height: 200px !important;
|
||||
}
|
||||
|
||||
.stat-cards-grid {
|
||||
grid-template-columns: 1fr !important;
|
||||
@media (hover: hover) {
|
||||
.image-task-card.ant-card:hover {
|
||||
border-color: var(--brand-accent);
|
||||
}
|
||||
}
|
||||
|
||||
/* Badge 样式覆盖 - 修复默认蓝色圆形背景 */
|
||||
|
||||
/* 历史标题区域的 Badge 特定样式 */
|
||||
|
||||
/* 图片生成页局部控件留白:避免搜索/筛选内容贴住玻璃卡片边框 */
|
||||
|
||||
.image-task-list .image-task-group-header {
|
||||
margin-left: -4px;
|
||||
margin-right: -4px;
|
||||
border: 1px solid rgb(255 255 255 / 0.45);
|
||||
border-radius: 14px;
|
||||
box-shadow: 0 10px 26px rgb(15 23 42 / 0.06);
|
||||
@media (min-width: 1024px) {
|
||||
.image-task-list .task-list-scrollable {
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.dark .image-task-list .image-task-group-header {
|
||||
border-color: rgb(255 255 255 / 0.1);
|
||||
box-shadow: 0 10px 26px rgb(0 0 0 / 0.24);
|
||||
}
|
||||
|
||||
/* ===== 触屏命中区兜底 ===== */
|
||||
@media (hover: none) {
|
||||
@media (max-width: 599px) {
|
||||
.image-history-toolbar {
|
||||
padding: 12px;
|
||||
}
|
||||
.image-history-tools {
|
||||
width: 100%;
|
||||
}
|
||||
.image-history-tools .image-task-search {
|
||||
flex: 1;
|
||||
}
|
||||
.image-task-model-filter,
|
||||
.image-task-size-filter {
|
||||
flex: 1 1 110px;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Card, Checkbox } from 'antd';
|
||||
import { GitCompare as ActionGitCompare } from '@/components/common/icons/ActionIcons';
|
||||
import {
|
||||
Rows as ActionRows,
|
||||
@@ -6,8 +7,6 @@ import {
|
||||
Star as ActionStar,
|
||||
RefreshCw as ActionRefreshCw,
|
||||
X as ActionX,
|
||||
Download as ActionDownload,
|
||||
Copy as ActionCopy,
|
||||
Eye as ActionEye,
|
||||
MoreHorizontal as ActionMoreHorizontal,
|
||||
RotateCcw as ActionRotateCcw,
|
||||
@@ -33,9 +32,7 @@ import {
|
||||
Download,
|
||||
Copy,
|
||||
Search,
|
||||
CheckCircle2,
|
||||
AlertCircle,
|
||||
Clock,
|
||||
Image as ImageIcon,
|
||||
CornerUpLeft,
|
||||
ImagePlus,
|
||||
@@ -49,7 +46,7 @@ import { showSuccess, showError, renderQuota } from '../../../../helpers';
|
||||
import './ImageTaskList.css';
|
||||
import ImageCompareModal from './ImageCompareModal';
|
||||
|
||||
const { Title, Text } = Typography;
|
||||
const { Text } = Typography;
|
||||
|
||||
// 持久化偏好
|
||||
const PREF_KEY = 'expCenter.imageGen.uiPrefs.v1';
|
||||
@@ -337,31 +334,6 @@ const ImageTaskList = ({
|
||||
return () => observer.disconnect();
|
||||
}, [visibleCount, filteredTasks.length]);
|
||||
|
||||
// 状态配置
|
||||
const getStatusConfig = (status) => {
|
||||
const configs = {
|
||||
processing: {
|
||||
color: 'brand',
|
||||
bar: 'var(--brand-primary)',
|
||||
text: t('生成中'),
|
||||
icon: <Clock size={12} />,
|
||||
},
|
||||
success: {
|
||||
color: 'green',
|
||||
bar: '#10b981',
|
||||
text: t('已完成'),
|
||||
icon: <CheckCircle2 size={12} />,
|
||||
},
|
||||
failed: {
|
||||
color: 'red',
|
||||
bar: '#f43f5e',
|
||||
text: t('失败'),
|
||||
icon: <AlertCircle size={12} />,
|
||||
},
|
||||
};
|
||||
return configs[status] || configs.processing;
|
||||
};
|
||||
|
||||
// 时间格式化
|
||||
const formatTime = (isoString) => {
|
||||
if (!isoString) return '';
|
||||
@@ -525,28 +497,23 @@ const ImageTaskList = ({
|
||||
|
||||
// 当前密度模式(控制卡片尺寸 + 信息密度)
|
||||
const density = prefs.density;
|
||||
const cardMinWidth =
|
||||
density === 'grid' ? 140 : density === 'compact' ? 180 : 240;
|
||||
|
||||
const STATUS_TABS = [
|
||||
{ key: 'all', label: t('全部'), count: statistics.total, color: 'default' },
|
||||
{ key: 'all', label: t('全部'), count: statistics.total },
|
||||
{
|
||||
key: 'success',
|
||||
label: t('已完成'),
|
||||
count: statistics.success,
|
||||
color: 'green',
|
||||
},
|
||||
{
|
||||
key: 'processing',
|
||||
label: t('生成中'),
|
||||
count: statistics.processing,
|
||||
color: 'brand',
|
||||
},
|
||||
{
|
||||
key: 'failed',
|
||||
label: t('失败'),
|
||||
count: statistics.failed,
|
||||
color: 'red',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -567,23 +534,14 @@ const ImageTaskList = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className='image-task-list h-full flex flex-col overflow-hidden rounded-[28px] border border-white/[0.55] bg-white/[0.38] shadow-[0_24px_80px_rgba(15,23,42,0.08)] backdrop-blur-2xl backdrop-saturate-150 dark:border-white/10 dark:bg-neutral-950/[0.38] dark:shadow-[0_24px_80px_rgba(0,0,0,0.32)]'>
|
||||
<section className='image-task-list' aria-labelledby='image-history-title'>
|
||||
{/* 顶部:标题 + 状态徽标 tab + 操作 */}
|
||||
<div
|
||||
className='border-b border-white/[0.45] bg-white/25 backdrop-blur-xl dark:border-white/10 dark:bg-white/[0.035]'
|
||||
style={{ padding: '12px 16px', flexShrink: 0 }}
|
||||
>
|
||||
<div className='image-history-toolbar'>
|
||||
{/* 第一行:状态 tabs + 操作 */}
|
||||
<div className='flex items-center justify-between gap-2 flex-wrap'>
|
||||
<div className='flex items-center gap-2 flex-wrap'>
|
||||
<Title
|
||||
heading={6}
|
||||
style={{ margin: 0 }}
|
||||
className='text-gray-800 dark:text-gray-100 mr-1'
|
||||
>
|
||||
{t('生成历史')}
|
||||
</Title>
|
||||
<div className='flex items-center gap-1 rounded-2xl border border-white/50 bg-white/[0.35] p-0.5 backdrop-blur dark:border-white/10 dark:bg-white/[0.06]'>
|
||||
<div className='image-history-heading'>
|
||||
<div className='image-history-title-row'>
|
||||
<h2 id='image-history-title'>{t('生成历史')}</h2>
|
||||
<div className='image-history-status'>
|
||||
{STATUS_TABS.map((tab) => {
|
||||
const active = filterStatus === tab.key;
|
||||
return (
|
||||
@@ -592,45 +550,24 @@ const ImageTaskList = ({
|
||||
type='button'
|
||||
aria-pressed={active}
|
||||
onClick={() => setFilterStatus(tab.key)}
|
||||
className={[
|
||||
'px-2.5 py-1 text-xs rounded-md transition-all flex items-center gap-1 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand',
|
||||
active
|
||||
? 'bg-white/80 dark:bg-white/10 text-brand-deep dark:text-brand-from shadow-sm font-medium'
|
||||
: 'text-gray-500 dark:text-gray-400 hover:text-brand-deep dark:hover:text-brand-from',
|
||||
].join(' ')}
|
||||
className='image-history-status-button'
|
||||
>
|
||||
<span>{tab.label}</span>
|
||||
<span
|
||||
className={[
|
||||
'text-[10px] rounded px-1',
|
||||
active
|
||||
? 'bg-brand/10 dark:bg-brand/15 text-brand-deep dark:text-brand-from'
|
||||
: tab.color === 'red'
|
||||
? 'bg-rose-50 dark:bg-rose-900/20 text-rose-500'
|
||||
: tab.color === 'green'
|
||||
? 'bg-emerald-50 dark:bg-emerald-900/20 text-emerald-600'
|
||||
: tab.color === 'brand'
|
||||
? 'bg-brand/10 dark:bg-brand/15 text-brand-deep dark:text-brand-from'
|
||||
: 'bg-gray-100 dark:bg-neutral-700 text-gray-500',
|
||||
].join(' ')}
|
||||
>
|
||||
{tab.count}
|
||||
</span>
|
||||
<span className='image-history-count'>{tab.count}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='flex items-center gap-1.5'>
|
||||
<div className='image-history-tools'>
|
||||
<Input
|
||||
prefix={<Search size={14} className='text-gray-400' />}
|
||||
prefix={<Search size={14} />}
|
||||
placeholder={t('搜索...')}
|
||||
value={searchInput}
|
||||
onChange={setSearchInput}
|
||||
className='image-task-search !rounded-xl'
|
||||
size='small'
|
||||
style={{ width: 168 }}
|
||||
aria-label={t('搜索...')}
|
||||
className='image-task-search'
|
||||
showClear
|
||||
/>
|
||||
|
||||
@@ -671,9 +608,7 @@ const ImageTaskList = ({
|
||||
<ActionLayoutGrid size={14} />
|
||||
)
|
||||
}
|
||||
size='small'
|
||||
theme='borderless'
|
||||
className='!text-gray-500 hover:!text-brand-deep dark:hover:!text-brand-from'
|
||||
theme='outline'
|
||||
aria-label={t('切换显示密度')}
|
||||
title={t('切换显示密度')}
|
||||
/>
|
||||
@@ -682,18 +617,12 @@ const ImageTaskList = ({
|
||||
{/* 多选模式切换 */}
|
||||
<Button
|
||||
icon={<ActionGitCompare size={14} />}
|
||||
size='small'
|
||||
theme={selectMode ? 'light' : 'borderless'}
|
||||
theme={selectMode ? 'light' : 'outline'}
|
||||
type={selectMode ? 'primary' : 'tertiary'}
|
||||
onClick={() => {
|
||||
if (selectMode) exitSelectMode();
|
||||
else setSelectMode(true);
|
||||
}}
|
||||
className={
|
||||
selectMode
|
||||
? ''
|
||||
: '!text-gray-500 hover:!text-brand-deep dark:hover:!text-brand-from'
|
||||
}
|
||||
aria-label={t('对比模式')}
|
||||
aria-pressed={selectMode}
|
||||
title={t('对比模式')}
|
||||
@@ -708,14 +637,8 @@ const ImageTaskList = ({
|
||||
color={favOnly ? 'var(--brand-primary)' : 'currentColor'}
|
||||
/>
|
||||
}
|
||||
size='small'
|
||||
theme='borderless'
|
||||
theme={favOnly ? 'light' : 'outline'}
|
||||
onClick={() => setFavOnly((v) => !v)}
|
||||
className={
|
||||
favOnly
|
||||
? '!text-brand-deep dark:!text-brand-from'
|
||||
: '!text-gray-500 hover:!text-brand-deep dark:hover:!text-brand-from'
|
||||
}
|
||||
aria-label={t('只看收藏')}
|
||||
aria-pressed={favOnly}
|
||||
title={t('只看收藏')}
|
||||
@@ -723,10 +646,8 @@ const ImageTaskList = ({
|
||||
|
||||
<Button
|
||||
icon={<ActionRefreshCw size={14} />}
|
||||
size='small'
|
||||
theme='borderless'
|
||||
theme='outline'
|
||||
onClick={() => onRefresh(true, false)}
|
||||
className='!text-gray-500 hover:!text-brand-deep dark:hover:!text-brand-from'
|
||||
aria-label={t('刷新任务列表')}
|
||||
title={t('刷新任务列表')}
|
||||
/>
|
||||
@@ -735,13 +656,12 @@ const ImageTaskList = ({
|
||||
|
||||
{/* 第二行:筛选 chips(仅在有可选/激活时显示) */}
|
||||
{(modelOptions.length > 0 || sizeOptions.length > 0) && (
|
||||
<div className='flex items-center gap-1.5 flex-wrap mt-2'>
|
||||
<div className='image-history-filters'>
|
||||
<Select
|
||||
value={modelFilter}
|
||||
onChange={setModelFilter}
|
||||
size='small'
|
||||
style={{ width: 180 }}
|
||||
className='image-task-filter-select !rounded-xl'
|
||||
className='image-task-model-filter'
|
||||
aria-label={t('模型')}
|
||||
placeholder={t('模型')}
|
||||
>
|
||||
<Select.Option value='all'>{t('全部模型')}</Select.Option>
|
||||
@@ -754,9 +674,8 @@ const ImageTaskList = ({
|
||||
<Select
|
||||
value={sizeFilter}
|
||||
onChange={setSizeFilter}
|
||||
size='small'
|
||||
style={{ width: 130 }}
|
||||
className='image-task-filter-select !rounded-xl'
|
||||
className='image-task-size-filter'
|
||||
aria-label={t('尺寸')}
|
||||
placeholder={t('尺寸')}
|
||||
>
|
||||
<Select.Option value='all'>{t('全部尺寸')}</Select.Option>
|
||||
@@ -770,7 +689,7 @@ const ImageTaskList = ({
|
||||
<button
|
||||
type='button'
|
||||
onClick={clearAllFilters}
|
||||
className='app-action-button inline-flex items-center gap-1 rounded-full px-2 py-1 text-[11px] text-gray-400 hover:bg-brand/10 hover:text-brand-deep dark:hover:bg-brand/15 dark:hover:text-brand-from transition-colors'
|
||||
className='image-history-clear'
|
||||
>
|
||||
<ActionX size={11} />
|
||||
{t('清除筛选')}
|
||||
@@ -781,20 +700,17 @@ const ImageTaskList = ({
|
||||
|
||||
{/* 多选模式下的操作条 */}
|
||||
{selectMode && (
|
||||
<div className='flex items-center gap-2 mt-2 px-3 py-1.5 bg-brand/10 dark:bg-brand/15 rounded-xl'>
|
||||
<Text
|
||||
size='small'
|
||||
className='!text-brand-deep dark:!text-brand-from'
|
||||
>
|
||||
{t('已选 {{n}} 张', { n: selectedIds.size })}{' '}
|
||||
<span className='text-gray-400'>· {t('最多 4 张')}</span>
|
||||
</Text>
|
||||
<div className='image-history-compare'>
|
||||
<span>
|
||||
{t('已选 {{n}} 张', { n: selectedIds.size })} · {t('最多 4 张')}
|
||||
</span>
|
||||
<div className='flex-1' />
|
||||
<Button
|
||||
size='small'
|
||||
type='primary'
|
||||
theme='solid'
|
||||
icon={<ActionGitCompare size={12} />}
|
||||
aria-label={t('对比')}
|
||||
onClick={openCompare}
|
||||
disabled={selectedIds.size < 2}
|
||||
>
|
||||
@@ -808,26 +724,28 @@ const ImageTaskList = ({
|
||||
</div>
|
||||
|
||||
{/* 任务列表 */}
|
||||
<div
|
||||
className='task-list-scrollable app-scrollbar relative'
|
||||
style={{ flex: 1, overflowY: 'auto', overflowX: 'hidden' }}
|
||||
>
|
||||
<div style={{ padding: '16px' }}>
|
||||
<div className='task-list-scrollable app-scrollbar'>
|
||||
<div className='image-history-content'>
|
||||
{filteredTasks.length === 0 ? (
|
||||
<div className='py-6'>
|
||||
<Empty
|
||||
image={
|
||||
<IllustrationNoContent style={{ width: 150, height: 150 }} />
|
||||
}
|
||||
title={
|
||||
searchKeyword || hasActiveFilters
|
||||
? t('未找到匹配的任务')
|
||||
: t('开始你的第一张 AI 图')
|
||||
}
|
||||
description={
|
||||
searchKeyword || hasActiveFilters
|
||||
<span
|
||||
className='image-history-empty-description'
|
||||
role='status'
|
||||
>
|
||||
<strong>
|
||||
{hasActiveFilters
|
||||
? t('未找到匹配的任务')
|
||||
: t('开始你的第一张 AI 图')}
|
||||
</strong>
|
||||
{hasActiveFilters
|
||||
? t('请尝试调整搜索条件')
|
||||
: t('描述你想要的画面,AI 会帮你生成')
|
||||
: t('描述你想要的画面,AI 会帮你生成')}
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
{!searchKeyword &&
|
||||
@@ -861,29 +779,13 @@ const ImageTaskList = ({
|
||||
<div className='space-y-4'>
|
||||
{groupedTasks.map((group) => (
|
||||
<div key={group.key}>
|
||||
<div
|
||||
className='image-task-group-header sticky top-0 z-10 bg-white/70 dark:bg-neutral-950/70 backdrop-blur-md px-3 py-1.5 mb-2 flex items-center gap-2'
|
||||
style={{ marginTop: '-4px' }}
|
||||
>
|
||||
<Text
|
||||
strong
|
||||
size='small'
|
||||
className='!text-gray-600 dark:!text-gray-300'
|
||||
>
|
||||
{group.label}
|
||||
</Text>
|
||||
<span className='text-[10px] text-gray-400'>
|
||||
({group.tasks.length})
|
||||
<div className='image-task-group-header'>
|
||||
<h3>{group.label}</h3>
|
||||
<span className='image-history-count'>
|
||||
{group.tasks.length}
|
||||
</span>
|
||||
<div className='flex-1 h-px bg-gray-100 dark:bg-neutral-800' />
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: `repeat(auto-fill, minmax(${cardMinWidth}px, 1fr))`,
|
||||
gap: density === 'grid' ? '8px' : '12px',
|
||||
}}
|
||||
>
|
||||
<div className='image-task-grid' data-density={density}>
|
||||
{group.tasks.map((task) => renderTaskCard(task))}
|
||||
</div>
|
||||
</div>
|
||||
@@ -927,132 +829,74 @@ const ImageTaskList = ({
|
||||
tasks={compareTasks}
|
||||
onClose={() => setCompareOpen(false)}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
||||
// ==================== 渲染任务卡 ====================
|
||||
function renderTaskCard(task) {
|
||||
const statusConfig = getStatusConfig(task.status);
|
||||
const isFailed = task.status === 'failed';
|
||||
const isSuccess = task.status === 'success';
|
||||
const isProcessing = task.status === 'processing';
|
||||
const isFav = favorites.has(task.id);
|
||||
const isSelected = selectedIds.has(task.id);
|
||||
|
||||
// 失败卡片视觉降级:整张红色调,图区变薄
|
||||
const failedClass = isFailed
|
||||
? 'border-rose-200/70 dark:border-rose-900/40 bg-rose-50/[0.45] dark:bg-rose-900/10'
|
||||
: 'border-white/60 dark:border-white/10 bg-white/[0.62] dark:bg-white/[0.06] backdrop-blur';
|
||||
|
||||
const selectedClass = isSelected
|
||||
? 'ring-2 ring-brand ring-offset-1 dark:ring-offset-neutral-900'
|
||||
: '';
|
||||
const hoverBorderClass = isFailed
|
||||
? 'hover:border-rose-300/80 dark:hover:border-rose-800/60'
|
||||
: 'hover:border-brand/25';
|
||||
|
||||
// 图区高度:失败和紧凑统一 1:1;舒适模式按真实比例
|
||||
const imageBoxStyle = isFailed
|
||||
? { height: '64px' }
|
||||
: density === 'comfortable' && task.width && task.height
|
||||
? { aspectRatio: `${task.width} / ${task.height}` }
|
||||
: { aspectRatio: '1 / 1' };
|
||||
|
||||
const cardClickable = selectMode && isSuccess && task.imageUrl;
|
||||
const canSelect = selectMode && isSuccess && Boolean(task.imageUrl);
|
||||
const hasImage = isSuccess && task.imageUrl && !failedImageIds.has(task.id);
|
||||
|
||||
return (
|
||||
<div
|
||||
<Card
|
||||
key={task.id}
|
||||
className={`image-task-card group relative rounded-2xl overflow-hidden border shadow-sm transition-all duration-200 hover:-translate-y-0.5 ${hoverBorderClass} hover:shadow-[0_18px_45px_rgba(15,23,42,0.12)] dark:hover:shadow-[0_18px_45px_rgba(0,0,0,0.35)] ${failedClass} ${selectedClass} ${cardClickable ? 'cursor-pointer' : ''}`}
|
||||
onClick={
|
||||
cardClickable
|
||||
? (e) => {
|
||||
e.stopPropagation();
|
||||
toggleSelect(task.id);
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
className='image-task-card'
|
||||
data-selected={isSelected}
|
||||
classNames={{ body: 'image-task-card-layout' }}
|
||||
draggable={isSuccess && !!task.imageUrl && !selectMode}
|
||||
onDragStart={(e) => handleDragStart(e, task)}
|
||||
onDragStart={(event) => handleDragStart(event, task)}
|
||||
>
|
||||
{/* 左侧状态彩色条 */}
|
||||
<div
|
||||
className='absolute left-0 top-0 bottom-0'
|
||||
style={{
|
||||
width: '3px',
|
||||
backgroundColor: statusConfig.bar,
|
||||
...(isProcessing
|
||||
? {
|
||||
backgroundImage:
|
||||
'linear-gradient(180deg, var(--brand-gradient-from), var(--brand-primary), var(--brand-gradient-from))',
|
||||
backgroundSize: '100% 200%',
|
||||
animation: 'brandShimmer 1.5s linear infinite',
|
||||
<div className='image-task-media' data-status={task.status}>
|
||||
{isSuccess && !selectMode && (
|
||||
<Button
|
||||
className='image-task-favorite'
|
||||
theme='outline'
|
||||
size='small'
|
||||
icon={
|
||||
<ActionStar size={15} fill={isFav ? 'currentColor' : 'none'} />
|
||||
}
|
||||
: {}),
|
||||
}}
|
||||
onClick={() => toggleFavorite(task.id)}
|
||||
aria-label={isFav ? t('取消收藏') : t('收藏')}
|
||||
aria-pressed={isFav}
|
||||
title={isFav ? t('取消收藏') : t('收藏')}
|
||||
/>
|
||||
|
||||
{/* 收藏按钮 - 右上 */}
|
||||
{isSuccess && (
|
||||
)}
|
||||
{canSelect && (
|
||||
<Checkbox
|
||||
className='image-task-select'
|
||||
checked={isSelected}
|
||||
aria-label={`${t('对比')}:${task.prompt || task.model || task.id}`}
|
||||
onChange={() => toggleSelect(task.id)}
|
||||
/>
|
||||
)}
|
||||
{hasImage ? (
|
||||
<button
|
||||
type='button'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
toggleFavorite(task.id);
|
||||
className='image-task-preview'
|
||||
aria-label={selectMode ? t('对比') : t('预览')}
|
||||
aria-pressed={selectMode ? isSelected : undefined}
|
||||
onClick={() => {
|
||||
if (selectMode) {
|
||||
toggleSelect(task.id);
|
||||
return;
|
||||
}
|
||||
setPreviewImageUrl(task.imageUrl);
|
||||
setPreviewTaskId(task.id);
|
||||
setPreviewVisible(true);
|
||||
}}
|
||||
className={[
|
||||
'app-action-button',
|
||||
[
|
||||
'absolute top-1.5 left-2 z-10 w-6 h-6 rounded-full flex items-center justify-center transition-all',
|
||||
isFav
|
||||
? 'bg-brand text-white shadow-md shadow-brand/30'
|
||||
: 'bg-black/40 text-white/80 opacity-0 group-hover:opacity-100 [@media(hover:none)]:opacity-100 hover:bg-brand',
|
||||
].join(' '),
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' ')}
|
||||
title={isFav ? t('取消收藏') : t('收藏')}
|
||||
>
|
||||
<ActionStar size={11} fill={isFav ? 'white' : 'none'} />
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* 多选 checkbox */}
|
||||
{selectMode && isSuccess && (
|
||||
<div
|
||||
className={[
|
||||
'absolute top-1.5 right-1.5 z-10 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-all',
|
||||
isSelected
|
||||
? 'bg-brand border-brand text-white'
|
||||
: 'bg-white/80 border-gray-300',
|
||||
].join(' ')}
|
||||
>
|
||||
{isSelected && (
|
||||
<CheckCircle2 size={10} strokeWidth={3} color='white' />
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 图区 */}
|
||||
<div
|
||||
className='relative overflow-hidden bg-gray-50 dark:bg-neutral-800'
|
||||
style={imageBoxStyle}
|
||||
>
|
||||
{isSuccess && task.imageUrl && !failedImageIds.has(task.id) ? (
|
||||
<>
|
||||
<img
|
||||
// 关键:key 含 imageUrl,URL 变化时强制重新挂载 → 浏览器重新发起加载(不会沿用旧的 error 状态)
|
||||
key={task.imageUrl}
|
||||
src={task.imageUrl}
|
||||
alt=''
|
||||
className='w-full h-full object-cover transition-transform duration-300 group-hover:scale-105'
|
||||
loading='lazy'
|
||||
onClick={() => {
|
||||
if (selectMode) return;
|
||||
setPreviewImageUrl(task.imageUrl);
|
||||
setPreviewTaskId(task.id);
|
||||
setPreviewVisible(true);
|
||||
}}
|
||||
draggable={false}
|
||||
onError={async () => {
|
||||
// COS 预签名 URL 过期 → 自动调一次 refresh-url;仍失败 → 标记永久占位
|
||||
const id = task.id;
|
||||
@@ -1075,161 +919,62 @@ const ImageTaskList = ({
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* 尺寸角标(多选模式下让位给 checkbox) */}
|
||||
{!selectMode && (
|
||||
<div className='absolute top-1.5 right-1.5 px-1.5 py-0.5 bg-black/50 rounded text-[10px] text-white'>
|
||||
{!selectMode && task.width > 0 && task.height > 0 && (
|
||||
<span className='image-task-dimensions'>
|
||||
{task.width}×{task.height}
|
||||
</div>
|
||||
</span>
|
||||
)}
|
||||
|
||||
{/* hover 浮层快捷动作 —— 容器 pointer-events:none 让渐变区点击穿透到 img(保留点图预览),
|
||||
按钮单独 pointer-events:auto 恢复可点击 */}
|
||||
{!selectMode && (
|
||||
<div
|
||||
className='absolute inset-x-0 bottom-0 px-2 py-2 bg-gradient-to-t from-black/80 via-black/40 to-transparent opacity-0 group-hover:opacity-100 [@media(hover:none)]:opacity-100 transition-opacity flex items-center justify-center gap-1'
|
||||
style={{ pointerEvents: 'none' }}
|
||||
>
|
||||
<button
|
||||
type='button'
|
||||
style={{ pointerEvents: 'auto' }}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleDownload(task);
|
||||
}}
|
||||
className='app-action-button w-7 h-7 rounded-full bg-white/15 hover:bg-brand backdrop-blur-sm flex items-center justify-center text-white transition-colors'
|
||||
title={t('下载')}
|
||||
>
|
||||
<ActionDownload size={13} />
|
||||
</button>
|
||||
<button
|
||||
type='button'
|
||||
style={{ pointerEvents: 'auto' }}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleCopyPrompt(task.prompt);
|
||||
}}
|
||||
className='app-action-button w-7 h-7 rounded-full bg-white/15 hover:bg-brand backdrop-blur-sm flex items-center justify-center text-white transition-colors'
|
||||
title={t('复制提示词')}
|
||||
>
|
||||
<ActionCopy size={13} />
|
||||
</button>
|
||||
{onUseAsReference && (
|
||||
<button
|
||||
type='button'
|
||||
style={{ pointerEvents: 'auto' }}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onUseAsReference(task);
|
||||
}}
|
||||
className='app-action-button w-7 h-7 rounded-full bg-white/15 hover:bg-brand backdrop-blur-sm flex items-center justify-center text-white transition-colors'
|
||||
title={t('用作参考图')}
|
||||
>
|
||||
<ImagePlus size={13} />
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type='button'
|
||||
style={{ pointerEvents: 'auto' }}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onViewDetail(task);
|
||||
}}
|
||||
className='app-action-button w-7 h-7 rounded-full bg-white/15 hover:bg-brand backdrop-blur-sm flex items-center justify-center text-white transition-colors'
|
||||
title={t('详情')}
|
||||
>
|
||||
<ActionEye size={13} />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
) : isSuccess && task.imageUrl && failedImageIds.has(task.id) ? (
|
||||
// 自动刷新尝试过仍失败 → 失败占位(用户可点菜单"刷新链接"重试)
|
||||
<div className='flex flex-col items-center justify-center h-full px-2 text-center'>
|
||||
<AlertCircle size={18} className='text-amber-500 mb-1' />
|
||||
<Text type='tertiary' className='!text-[10px]'>
|
||||
{t('图片加载失败')}
|
||||
</Text>
|
||||
<Text
|
||||
type='tertiary'
|
||||
className='!text-[9px] !text-gray-400 mt-0.5'
|
||||
>
|
||||
{t('从菜单点"刷新链接"重试')}
|
||||
</Text>
|
||||
</div>
|
||||
) : isSuccess && !task.imageUrl ? (
|
||||
<div className='flex flex-col items-center justify-center h-full'>
|
||||
<AlertCircle size={18} className='text-amber-400 mb-0.5' />
|
||||
<Text type='tertiary' className='!text-[10px]'>
|
||||
{t('链接已失效')}
|
||||
</Text>
|
||||
</div>
|
||||
) : isProcessing ? (
|
||||
<div className='flex flex-col items-center justify-center h-full'>
|
||||
<div className='w-7 h-7 rounded-full border-2 border-gray-200 border-t-brand animate-spin mb-1' />
|
||||
<Text type='tertiary' className='!text-[10px]'>
|
||||
{t('生成中')}
|
||||
</Text>
|
||||
</div>
|
||||
) : isFailed ? (
|
||||
<div className='flex items-center justify-center h-full gap-1.5'>
|
||||
<AlertCircle size={14} className='text-rose-500' />
|
||||
<Text className='!text-[11px] !text-rose-700 dark:!text-rose-300'>
|
||||
{t('失败')}
|
||||
</Text>
|
||||
</div>
|
||||
) : (
|
||||
<div className='flex flex-col items-center justify-center h-full'>
|
||||
<ImageIcon size={18} className='text-gray-300 mb-0.5' />
|
||||
<Text type='tertiary' className='!text-[10px]'>
|
||||
{t('等待中')}
|
||||
</Text>
|
||||
</div>
|
||||
<div className='image-task-placeholder'>
|
||||
<span className='image-task-status-icon' aria-hidden='true'>
|
||||
{isFailed || isSuccess ? (
|
||||
<AlertCircle size={21} />
|
||||
) : (
|
||||
<ImageIcon size={21} />
|
||||
)}
|
||||
</span>
|
||||
<strong>
|
||||
{isFailed
|
||||
? t('失败')
|
||||
: isSuccess
|
||||
? t(task.imageUrl ? '图片加载失败' : '链接已失效')
|
||||
: isProcessing
|
||||
? t('生成中')
|
||||
: t('等待中')}
|
||||
</strong>
|
||||
{isSuccess && task.imageUrl && (
|
||||
<span>{t('从菜单点"刷新链接"重试')}</span>
|
||||
)}
|
||||
{isFailed && task.errorMessage && (
|
||||
<Popover
|
||||
content={
|
||||
<div className='image-task-error-detail'>
|
||||
{task.errorMessage}
|
||||
</div>
|
||||
|
||||
{/* 底部信息(紧凑/网格模式下省略部分内容) */}
|
||||
<div
|
||||
className='flex flex-col'
|
||||
style={{ padding: density === 'grid' ? '6px 8px' : '8px 10px' }}
|
||||
}
|
||||
trigger='click'
|
||||
position='top'
|
||||
showArrow
|
||||
>
|
||||
{/* 时间 + 收藏 */}
|
||||
{density !== 'grid' && (
|
||||
<div className='flex items-center justify-between mb-1'>
|
||||
<Text type='tertiary' className='!text-[10px]'>
|
||||
{formatTime(task.createdAt)}
|
||||
</Text>
|
||||
{task.model && (
|
||||
<Text
|
||||
type='tertiary'
|
||||
className='!text-[10px] truncate ml-2 max-w-[60%]'
|
||||
title={task.model}
|
||||
<button
|
||||
type='button'
|
||||
className='image-task-error'
|
||||
title={t('点击查看完整错误')}
|
||||
>
|
||||
{task.model}
|
||||
</Text>
|
||||
{task.errorMessage}
|
||||
</button>
|
||||
</Popover>
|
||||
)}
|
||||
</div>
|
||||
{isFailed && task.refundedQuota > 0 && (
|
||||
<span>
|
||||
{t('已退还 {{amount}}', {
|
||||
amount: renderQuota(task.refundedQuota),
|
||||
})}
|
||||
</span>
|
||||
)}
|
||||
|
||||
{/* Prompt 预览 */}
|
||||
{density === 'comfortable' && task.prompt && (
|
||||
<div
|
||||
className='text-[11px] text-gray-600 dark:text-gray-300 leading-snug mb-1.5'
|
||||
style={{
|
||||
display: '-webkit-box',
|
||||
WebkitLineClamp: 2,
|
||||
WebkitBoxOrient: 'vertical',
|
||||
overflow: 'hidden',
|
||||
wordBreak: 'break-word',
|
||||
}}
|
||||
title={task.prompt}
|
||||
>
|
||||
{task.prompt}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 处理中进度条 */}
|
||||
{isProcessing && (
|
||||
<div className='mb-1.5'>
|
||||
<div className='image-task-progress'>
|
||||
<Progress
|
||||
percent={parseInt(task.progress) || 0}
|
||||
size='small'
|
||||
@@ -1238,64 +983,33 @@ const ImageTaskList = ({
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 失败错误简介 */}
|
||||
{isFailed && task.errorMessage && (
|
||||
<Popover
|
||||
content={
|
||||
<div
|
||||
style={{ maxWidth: 300, maxHeight: 200, overflow: 'auto' }}
|
||||
>
|
||||
<Text
|
||||
size='small'
|
||||
style={{ wordBreak: 'break-word', whiteSpace: 'pre-wrap' }}
|
||||
>
|
||||
{task.errorMessage}
|
||||
</Text>
|
||||
</div>
|
||||
}
|
||||
trigger='click'
|
||||
position='top'
|
||||
showArrow
|
||||
>
|
||||
<div
|
||||
className='text-[10px] text-rose-700 dark:text-rose-300 leading-snug mb-1.5 cursor-pointer hover:underline'
|
||||
style={{
|
||||
display: '-webkit-box',
|
||||
WebkitLineClamp: 2,
|
||||
WebkitBoxOrient: 'vertical',
|
||||
overflow: 'hidden',
|
||||
wordBreak: 'break-word',
|
||||
}}
|
||||
title={t('点击查看完整错误')}
|
||||
>
|
||||
{task.errorMessage}
|
||||
</div>
|
||||
</Popover>
|
||||
)}
|
||||
|
||||
{/* 失败退款:按任务实际退还额度展示(不写死"不扣费") */}
|
||||
{isFailed && task.refundedQuota > 0 && (
|
||||
<div className='text-[10px] text-gray-500 dark:text-gray-400 leading-snug mb-1.5 tabular-nums'>
|
||||
{t('已退还 {{amount}}', {
|
||||
amount: renderQuota(task.refundedQuota),
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 操作按钮 */}
|
||||
{density !== 'grid' && (
|
||||
<div className='flex gap-1 mt-auto pt-1 border-t border-gray-100 dark:border-neutral-800'>
|
||||
<div className='image-task-info'>
|
||||
{density === 'comfortable' && (
|
||||
<strong className='image-task-prompt' title={task.prompt}>
|
||||
{task.prompt || task.model}
|
||||
</strong>
|
||||
)}
|
||||
<div className='image-task-meta'>
|
||||
<span className='image-task-model' title={task.model}>
|
||||
{task.model}
|
||||
</span>
|
||||
<time dateTime={task.createdAt}>{formatTime(task.createdAt)}</time>
|
||||
</div>
|
||||
<div className='image-task-actions'>
|
||||
{isSuccess && (
|
||||
<>
|
||||
<Button
|
||||
icon={<ActionEye size={11} />}
|
||||
size='small'
|
||||
className='flex-1 !rounded-md !text-[10px]'
|
||||
style={{ height: '24px' }}
|
||||
className='image-task-primary-action'
|
||||
aria-label={t('查看')}
|
||||
onClick={() => onViewDetail(task)}
|
||||
>
|
||||
{density === 'comfortable' ? t('查看') : ''}
|
||||
{t('查看')}
|
||||
</Button>
|
||||
<Dropdown
|
||||
trigger='click'
|
||||
@@ -1359,12 +1073,8 @@ const ImageTaskList = ({
|
||||
<Button
|
||||
icon={<ActionMoreHorizontal size={11} />}
|
||||
size='small'
|
||||
className='!rounded-md'
|
||||
style={{
|
||||
height: '24px',
|
||||
width: '24px',
|
||||
minWidth: '24px',
|
||||
}}
|
||||
aria-label={t('更多操作')}
|
||||
title={t('更多操作')}
|
||||
/>
|
||||
</Dropdown>
|
||||
</>
|
||||
@@ -1374,17 +1084,17 @@ const ImageTaskList = ({
|
||||
<Button
|
||||
icon={<ActionRotateCcw size={11} />}
|
||||
size='small'
|
||||
className='flex-1 !rounded-md !text-[10px]'
|
||||
style={{ height: '24px' }}
|
||||
className='image-task-primary-action'
|
||||
aria-label={t('重试')}
|
||||
onClick={() => onRetry(task.id)}
|
||||
>
|
||||
{density === 'comfortable' ? t('重试') : ''}
|
||||
{t('重试')}
|
||||
</Button>
|
||||
<Button
|
||||
icon={<ActionTrash2 size={11} />}
|
||||
size='small'
|
||||
className='!rounded-md'
|
||||
style={{ height: '24px', width: '24px', minWidth: '24px' }}
|
||||
aria-label={t('删除')}
|
||||
title={t('删除')}
|
||||
onClick={() => {
|
||||
if (window.confirm(t('确定要删除这个任务吗?')))
|
||||
onDelete(task.id);
|
||||
@@ -1396,20 +1106,19 @@ const ImageTaskList = ({
|
||||
<Button
|
||||
icon={<ActionTrash2 size={11} />}
|
||||
size='small'
|
||||
className='w-full !rounded-md !text-[10px]'
|
||||
style={{ height: '24px' }}
|
||||
className='image-task-primary-action'
|
||||
aria-label={t('取消')}
|
||||
onClick={() => {
|
||||
if (window.confirm(t('确定要取消这个任务吗?')))
|
||||
onDelete(task.id);
|
||||
}}
|
||||
>
|
||||
{density === 'comfortable' ? t('取消') : ''}
|
||||
{t('取消')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,17 +7,21 @@
|
||||
--vip-muted: var(--text-secondary);
|
||||
--vip-line: var(--border-subtle);
|
||||
--vip-surface: var(--surface-card);
|
||||
--vip-accent: var(--ui-color-primary);
|
||||
--vip-tint: color-mix(in srgb, var(--ui-color-primary) 10%, transparent);
|
||||
--vip-accent: var(--brand-accent);
|
||||
--vip-tint: var(--brand-selection-bg);
|
||||
--vip-fill: color-mix(in srgb, var(--text-primary) 4%, var(--surface-card));
|
||||
--vip-danger: var(--ui-color-danger);
|
||||
--vip-warning: var(--ui-color-warning);
|
||||
--vip-ring: color-mix(in srgb, var(--ui-color-primary) 55%, transparent);
|
||||
--vip-ring: var(--brand-accent);
|
||||
|
||||
position: relative;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
max-height: 100%;
|
||||
min-height: 0;
|
||||
border: 1px solid var(--vip-line);
|
||||
border-radius: 12px;
|
||||
background: var(--vip-surface);
|
||||
}
|
||||
|
||||
.video-input-panel button:focus-visible,
|
||||
@@ -26,36 +30,35 @@
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.vip-collapse-row {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-bottom: 12px;
|
||||
.vip-fields {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 12px;
|
||||
overflow: auto;
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
|
||||
.vip-collapse-btn {
|
||||
color: var(--vip-accent) !important;
|
||||
.vip-fields:not([hidden]) {
|
||||
display: grid;
|
||||
align-content: start;
|
||||
grid-auto-rows: max-content;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.vip-expand-fab {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
z-index: 100;
|
||||
.vip-fields[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.vip-expand-fab .ant-btn {
|
||||
border-top-left-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
color: var(--ui-color-primary);
|
||||
.vip-prompt textarea::placeholder,
|
||||
textarea.vip-prompt::placeholder {
|
||||
color: var(--vip-muted);
|
||||
}
|
||||
|
||||
.vip-card {
|
||||
margin-bottom: 12px;
|
||||
padding: 14px 16px;
|
||||
padding: 12px;
|
||||
border: 1px solid var(--vip-line);
|
||||
border-radius: 12px;
|
||||
background: var(--vip-surface);
|
||||
border-radius: 10px;
|
||||
background: var(--vip-fill);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@@ -79,7 +82,7 @@
|
||||
height: 26px;
|
||||
border-radius: 8px;
|
||||
background: var(--vip-tint);
|
||||
color: var(--vip-accent);
|
||||
color: var(--brand-selection-text);
|
||||
}
|
||||
|
||||
.vip-card-extra {
|
||||
@@ -158,6 +161,13 @@
|
||||
color: var(--vip-danger);
|
||||
}
|
||||
|
||||
.video-input-panel .cp-option-group {
|
||||
--cp-accent: var(--brand-selection-text);
|
||||
--cp-accent-tint: var(--brand-selection-bg);
|
||||
--cp-accent-line: color-mix(in srgb, var(--brand-accent) 45%, transparent);
|
||||
--cp-ring: var(--brand-accent);
|
||||
}
|
||||
|
||||
.vip-mode-option {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -198,8 +208,8 @@
|
||||
|
||||
.vip-advanced {
|
||||
border: 1px solid var(--vip-line);
|
||||
border-radius: 12px;
|
||||
background: var(--vip-surface);
|
||||
border-radius: 10px;
|
||||
background: var(--vip-fill);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
ChevronRight as ActionChevronRight,
|
||||
ChevronLeft as ActionChevronLeft,
|
||||
ChevronDown as ActionChevronDown,
|
||||
ChevronUp as ActionChevronUp,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import React from 'react';
|
||||
import React, { useId } from 'react';
|
||||
import {
|
||||
Button,
|
||||
Collapse,
|
||||
@@ -76,13 +76,9 @@ const formatModelPrice = (t, model, resolution) => {
|
||||
return unit ? `${amount}${t(unit)}` : amount;
|
||||
};
|
||||
|
||||
const VideoInputPanel = ({
|
||||
creation,
|
||||
onCollapse,
|
||||
collapsed,
|
||||
collapsible = true,
|
||||
}) => {
|
||||
const VideoInputPanel = ({ creation, onCollapse, collapsed, scrollRef }) => {
|
||||
const { t } = useTranslation();
|
||||
const fieldsId = useId();
|
||||
const {
|
||||
formData,
|
||||
setFormData,
|
||||
@@ -109,20 +105,6 @@ const VideoInputPanel = ({
|
||||
setFormData((prev) => ({ ...prev, [field]: value }));
|
||||
};
|
||||
|
||||
// 单列(手机)布局不提供折叠:没有相邻面板可以让位,收起只会留下一片空白,
|
||||
// 而唯一的恢复入口是一个浮在屏幕左侧垂直中央的裸箭头。
|
||||
if (collapsed && collapsible) {
|
||||
return (
|
||||
<div className='vip-expand-fab'>
|
||||
<Button
|
||||
icon={<ActionChevronRight size={20} />}
|
||||
onClick={onCollapse}
|
||||
aria-label={t('展开')}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const advancedParams = visibleParams.filter(
|
||||
(p) => p.placement === 'advanced',
|
||||
);
|
||||
@@ -248,20 +230,34 @@ const VideoInputPanel = ({
|
||||
entry.labelIndex ? `${t(entry.label)} ${entry.labelIndex}` : t(entry.label);
|
||||
|
||||
return (
|
||||
<div className='video-input-panel'>
|
||||
{collapsible && (
|
||||
<div className='vip-collapse-row'>
|
||||
<section className='video-input-panel'>
|
||||
<header className='video-panel-header'>
|
||||
<div className='video-panel-heading'>
|
||||
<SlidersHorizontal size={17} aria-hidden='true' />
|
||||
<h2>{t('参数设置')}</h2>
|
||||
</div>
|
||||
<Button
|
||||
icon={<ActionChevronLeft size={18} />}
|
||||
icon={
|
||||
collapsed ? (
|
||||
<ActionChevronDown size={16} />
|
||||
) : (
|
||||
<ActionChevronUp size={16} />
|
||||
)
|
||||
}
|
||||
onClick={onCollapse}
|
||||
size='small'
|
||||
type='tertiary'
|
||||
className='vip-collapse-btn'
|
||||
aria-label={t('收起')}
|
||||
aria-label={collapsed ? t('展开创作台') : t('收起创作台')}
|
||||
aria-expanded={!collapsed}
|
||||
aria-controls={fieldsId}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
</header>
|
||||
<div
|
||||
id={fieldsId}
|
||||
hidden={collapsed}
|
||||
ref={scrollRef}
|
||||
className='vip-fields app-scrollbar'
|
||||
>
|
||||
<Section icon={Wand2} title={t('选择模型')}>
|
||||
{renderModelSection()}
|
||||
</Section>
|
||||
@@ -336,7 +332,8 @@ const VideoInputPanel = ({
|
||||
}
|
||||
onClearSelection={clearPortraitAsset}
|
||||
/>
|
||||
{formData.images?.first_frame?.identityType === 'real_person' ? (
|
||||
{formData.images?.first_frame?.identityType ===
|
||||
'real_person' ? (
|
||||
<Tag color='green' size='small'>
|
||||
{t('真人人像')}
|
||||
</Tag>
|
||||
@@ -348,8 +345,9 @@ const VideoInputPanel = ({
|
||||
|
||||
<Section icon={Sparkles} title={t('场景模板')}>
|
||||
<Select
|
||||
aria-label={t('场景模板')}
|
||||
placeholder={t('选择场景模板(可选)')}
|
||||
value={formData.selectedTemplate}
|
||||
value={formData.selectedTemplate || undefined}
|
||||
onChange={(value) => updateField('selectedTemplate', value)}
|
||||
style={{ width: '100%' }}
|
||||
showClear
|
||||
@@ -371,6 +369,7 @@ const VideoInputPanel = ({
|
||||
|
||||
<Section icon={Video} title={t('提示词')}>
|
||||
<TextArea
|
||||
aria-label={t('提示词')}
|
||||
placeholder={t(
|
||||
'描述你想要生成的视频内容,例如:一只可爱的猫咪在草地上玩耍',
|
||||
)}
|
||||
@@ -379,6 +378,7 @@ const VideoInputPanel = ({
|
||||
autosize={{ minRows: 4, maxRows: 8 }}
|
||||
maxLength={2000}
|
||||
showClear
|
||||
className='vip-prompt'
|
||||
/>
|
||||
<Text type='tertiary' size='small' className='vip-counter'>
|
||||
{formData.prompt?.length || 0} / 2000
|
||||
@@ -423,6 +423,7 @@ const VideoInputPanel = ({
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,66 +1,107 @@
|
||||
/* 视频预览面板 - 电影感动画背景(增强版) */
|
||||
|
||||
/* 动态光晕1 - 缓慢飘动 */
|
||||
@keyframes videoPreviewFloat1 {
|
||||
0%,
|
||||
100% {
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
25% {
|
||||
transform: translate3d(50px, -30px, 0);
|
||||
}
|
||||
50% {
|
||||
transform: translate3d(80px, 20px, 0);
|
||||
}
|
||||
75% {
|
||||
transform: translate3d(30px, 50px, 0);
|
||||
}
|
||||
.video-preview-panel.ant-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
border-color: var(--border-subtle);
|
||||
border-radius: 12px;
|
||||
background: var(--surface-card);
|
||||
}
|
||||
|
||||
/* 动态光晕2 - 反向飘动 */
|
||||
@keyframes videoPreviewFloat2 {
|
||||
0%,
|
||||
100% {
|
||||
transform: translate3d(0, 0, 0);
|
||||
}
|
||||
25% {
|
||||
transform: translate3d(-60px, 40px, 0);
|
||||
}
|
||||
50% {
|
||||
transform: translate3d(-30px, -50px, 0);
|
||||
}
|
||||
75% {
|
||||
transform: translate3d(-70px, -20px, 0);
|
||||
}
|
||||
.video-preview-panel > .ant-card-body {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 脉动效果 */
|
||||
@keyframes videoPreviewPulse {
|
||||
0%,
|
||||
100% {
|
||||
opacity: 0.4;
|
||||
transform: scale(1);
|
||||
.video-preview-header {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.video-preview-actions {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.video-preview-actions .ant-typography {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.video-generate-button {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.video-preview-stage {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
border-end-start-radius: 11px;
|
||||
border-end-end-radius: 11px;
|
||||
}
|
||||
|
||||
.video-preview-empty {
|
||||
--vp-stage: color-mix(in srgb, var(--text-primary) 4%, var(--surface-card));
|
||||
display: grid;
|
||||
align-content: center;
|
||||
justify-items: center;
|
||||
gap: 10px;
|
||||
height: calc(100% - 32px);
|
||||
min-height: 180px;
|
||||
margin: 16px;
|
||||
padding: 24px;
|
||||
border: 1px dashed var(--border-subtle);
|
||||
border-radius: 10px;
|
||||
background: var(--vp-stage);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.video-preview-empty-icon {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.video-preview-empty h3 {
|
||||
margin: 0;
|
||||
color: var(--text-primary);
|
||||
font-size: 18px;
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.video-preview-empty p {
|
||||
margin: 0;
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.video-preview-header {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
50% {
|
||||
opacity: 1;
|
||||
transform: scale(1.1);
|
||||
|
||||
.video-preview-actions {
|
||||
justify-content: flex-start;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.video-help-button {
|
||||
margin-inline-start: auto;
|
||||
}
|
||||
|
||||
.video-preview-empty {
|
||||
height: auto;
|
||||
min-height: 190px;
|
||||
margin: 12px;
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 动画类 - GPU 加速 */
|
||||
.video-preview-glow1 {
|
||||
animation: videoPreviewFloat1 12s ease-in-out infinite;
|
||||
will-change: transform;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
.video-preview-glow2 {
|
||||
animation: videoPreviewFloat2 15s ease-in-out infinite;
|
||||
will-change: transform;
|
||||
backface-visibility: hidden;
|
||||
}
|
||||
|
||||
.video-preview-glow3 {
|
||||
animation: videoPreviewPulse 6s ease-in-out infinite;
|
||||
will-change: opacity, transform;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,6 @@ const VideoPreviewPanel = ({
|
||||
videoMaxHeight: '600px',
|
||||
buttonSize: 'large',
|
||||
titleSize: 4,
|
||||
iconSize: 64,
|
||||
progressWidth: 120,
|
||||
};
|
||||
}
|
||||
@@ -102,7 +101,6 @@ const VideoPreviewPanel = ({
|
||||
videoMaxHeight: '500px',
|
||||
buttonSize: 'default',
|
||||
titleSize: 5,
|
||||
iconSize: 56,
|
||||
progressWidth: 100,
|
||||
};
|
||||
}
|
||||
@@ -113,7 +111,6 @@ const VideoPreviewPanel = ({
|
||||
videoMaxHeight: '400px',
|
||||
buttonSize: 'default',
|
||||
titleSize: 5,
|
||||
iconSize: 48,
|
||||
progressWidth: 90,
|
||||
};
|
||||
}
|
||||
@@ -124,7 +121,6 @@ const VideoPreviewPanel = ({
|
||||
videoMaxHeight: '350px',
|
||||
buttonSize: 'small',
|
||||
titleSize: 6,
|
||||
iconSize: 40,
|
||||
progressWidth: 80,
|
||||
};
|
||||
};
|
||||
@@ -241,28 +237,8 @@ const VideoPreviewPanel = ({
|
||||
const renderTopBar = () => {
|
||||
// 优先显示从任务列表选择的任务
|
||||
const displayTask = selectedTaskForPlay || currentTask;
|
||||
const normalizedStatus = normalizeVideoTaskStatus(displayTask?.status);
|
||||
const isCompleted = normalizedStatus === 'success';
|
||||
|
||||
// 检查是否有视频URL
|
||||
let _hasVideo = false;
|
||||
if (displayTask) {
|
||||
const videoUrl = getVideoURLFromDetail(displayTask);
|
||||
_hasVideo = isCompleted && !!videoUrl;
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
padding: windowWidth > 768 ? '16px 20px' : '12px 16px',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '12px',
|
||||
backgroundColor: 'var(--ui-color-bg-1)',
|
||||
borderBottom: '1px solid var(--ui-color-border)',
|
||||
flexShrink: 0,
|
||||
}}
|
||||
>
|
||||
<div className='video-preview-actions'>
|
||||
{needTopUp ? (
|
||||
<Button
|
||||
type='warning'
|
||||
@@ -283,14 +259,7 @@ const VideoPreviewPanel = ({
|
||||
onClick={isButtonDisabled ? undefined : handleGenerate}
|
||||
disabled={isButtonDisabled || submitting}
|
||||
loading={submitting}
|
||||
style={{
|
||||
fontWeight: 600,
|
||||
background:
|
||||
isButtonDisabled || submitting
|
||||
? undefined
|
||||
: 'linear-gradient(135deg, var(--ui-color-primary) 0%, var(--ui-color-primary-active, var(--ui-color-primary)) 100%)',
|
||||
border: 'none',
|
||||
}}
|
||||
className='video-generate-button'
|
||||
>
|
||||
{submitting
|
||||
? t('提交中...')
|
||||
@@ -344,8 +313,6 @@ const VideoPreviewPanel = ({
|
||||
</Text>
|
||||
)}
|
||||
|
||||
<div style={{ flex: 1 }} />
|
||||
|
||||
<Tooltip
|
||||
content={
|
||||
<div style={{ padding: '12px', maxWidth: '300px' }}>
|
||||
@@ -368,11 +335,13 @@ const VideoPreviewPanel = ({
|
||||
</div>
|
||||
}
|
||||
position='bottomRight'
|
||||
trigger='hover'
|
||||
trigger={['hover', 'focus']}
|
||||
showArrow={true}
|
||||
>
|
||||
<Button
|
||||
icon={<ActionHelpCircle size={18} />}
|
||||
className='video-help-button'
|
||||
aria-label={t('使用提示')}
|
||||
type='tertiary'
|
||||
size={windowWidth > 768 ? 'default' : 'small'}
|
||||
/>
|
||||
@@ -702,199 +671,31 @@ const VideoPreviewPanel = ({
|
||||
);
|
||||
}
|
||||
|
||||
// 默认空状态 - 纯CSS电影感动画背景(无网络资源消耗)
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
minHeight: config.minHeight,
|
||||
height: '100%',
|
||||
position: 'relative',
|
||||
borderRadius: '12px',
|
||||
overflow: 'hidden',
|
||||
margin: '16px',
|
||||
background:
|
||||
'linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%)',
|
||||
}}
|
||||
>
|
||||
{/* CSS动画背景 - 流动光效(增强版) */}
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
overflow: 'hidden',
|
||||
pointerEvents: 'none',
|
||||
}}
|
||||
>
|
||||
{/* 动态光晕1 - 紫色 */}
|
||||
<div
|
||||
className='video-preview-glow1'
|
||||
style={{
|
||||
position: 'absolute',
|
||||
width: '60%',
|
||||
height: '60%',
|
||||
top: '10%',
|
||||
left: '5%',
|
||||
background:
|
||||
'radial-gradient(ellipse at center, color-mix(in srgb, var(--brand-gradient-via) 35%, transparent) 0%, color-mix(in srgb, var(--brand-gradient-via) 10%, transparent) 40%, transparent 70%)',
|
||||
borderRadius: '50%',
|
||||
filter: 'blur(40px)',
|
||||
}}
|
||||
/>
|
||||
{/* 动态光晕2 - 橙红色 */}
|
||||
<div
|
||||
className='video-preview-glow2'
|
||||
style={{
|
||||
position: 'absolute',
|
||||
width: '50%',
|
||||
height: '50%',
|
||||
bottom: '10%',
|
||||
right: '5%',
|
||||
background:
|
||||
'radial-gradient(ellipse at center, rgba(251, 146, 60, 0.3) 0%, rgba(251, 146, 60, 0.1) 40%, transparent 70%)',
|
||||
borderRadius: '50%',
|
||||
filter: 'blur(40px)',
|
||||
}}
|
||||
/>
|
||||
{/* 动态光晕3 - 金色中心 */}
|
||||
<div
|
||||
className='video-preview-glow3'
|
||||
style={{
|
||||
position: 'absolute',
|
||||
width: '40%',
|
||||
height: '40%',
|
||||
top: '30%',
|
||||
left: '30%',
|
||||
background:
|
||||
'radial-gradient(ellipse at center, rgba(251, 191, 36, 0.25) 0%, transparent 60%)',
|
||||
borderRadius: '50%',
|
||||
filter: 'blur(30px)',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 电影宽银幕效果 - 上下黑边 */}
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: '6%',
|
||||
background:
|
||||
'linear-gradient(180deg, rgba(0,0,0,0.95) 0%, transparent 100%)',
|
||||
zIndex: 2,
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: '6%',
|
||||
background:
|
||||
'linear-gradient(0deg, rgba(0,0,0,0.95) 0%, transparent 100%)',
|
||||
zIndex: 2,
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* 中央内容区域 */}
|
||||
<div
|
||||
style={{
|
||||
flex: 1,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: config.padding,
|
||||
color: 'white',
|
||||
position: 'relative',
|
||||
zIndex: 3,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.1)',
|
||||
borderRadius: '50%',
|
||||
padding: windowWidth > 1024 ? '32px' : '24px',
|
||||
marginBottom: windowWidth > 768 ? '32px' : '24px',
|
||||
border: '1px solid rgba(255, 255, 255, 0.2)',
|
||||
boxShadow: '0 8px 32px rgba(0, 0, 0, 0.3)',
|
||||
transition: 'transform 0.3s ease',
|
||||
}}
|
||||
onMouseEnter={(e) => {
|
||||
e.currentTarget.style.transform = 'scale(1.05)';
|
||||
}}
|
||||
onMouseLeave={(e) => {
|
||||
e.currentTarget.style.transform = 'scale(1)';
|
||||
}}
|
||||
>
|
||||
<Film
|
||||
size={config.iconSize}
|
||||
style={{
|
||||
color: 'rgba(255, 220, 180, 0.9)',
|
||||
filter: 'drop-shadow(0 2px 12px rgba(255,200,150,0.4))',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Title
|
||||
heading={config.titleSize}
|
||||
style={{
|
||||
marginBottom: '12px',
|
||||
color: 'rgba(255, 250, 245, 0.95)',
|
||||
fontWeight: 700,
|
||||
textShadow: '0 4px 20px rgba(0, 0, 0, 0.6)',
|
||||
letterSpacing: '3px',
|
||||
}}
|
||||
>
|
||||
{t('AI 视频生成')}
|
||||
</Title>
|
||||
|
||||
<Text
|
||||
style={{
|
||||
marginBottom: windowWidth > 768 ? '24px' : '16px',
|
||||
textAlign: 'center',
|
||||
fontSize: windowWidth > 768 ? '16px' : '14px',
|
||||
padding: '0 16px',
|
||||
color: 'rgba(255, 255, 255, 0.7)',
|
||||
maxWidth: '500px',
|
||||
lineHeight: '1.8',
|
||||
textShadow: '0 2px 8px rgba(0, 0, 0, 0.5)',
|
||||
}}
|
||||
>
|
||||
<div className='video-preview-empty'>
|
||||
<span className='video-preview-empty-icon' aria-hidden='true'>
|
||||
<Film size={28} />
|
||||
</span>
|
||||
<h3>{t('AI 视频生成')}</h3>
|
||||
<p>
|
||||
{formData.mode === 'text2video'
|
||||
? t('输入提示词,让 AI 为你创造精彩视频')
|
||||
: t('上传图片并输入提示词,生成动态视频')}
|
||||
</Text>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<Card
|
||||
style={{ height: '100%', display: 'flex', flexDirection: 'column' }}
|
||||
styles={{
|
||||
body: {
|
||||
flex: 1,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
overflow: 'hidden',
|
||||
padding: 0,
|
||||
},
|
||||
}}
|
||||
>
|
||||
{/* 始终显示的顶部操作栏 */}
|
||||
<Card className='video-preview-panel'>
|
||||
<header className='video-panel-header video-preview-header'>
|
||||
<div className='video-panel-heading'>
|
||||
<Film size={17} aria-hidden='true' />
|
||||
<h2>{t('视频预览')}</h2>
|
||||
</div>
|
||||
{renderTopBar()}
|
||||
|
||||
{/* 内容区域 */}
|
||||
<div style={{ flex: 1, overflow: 'auto' }}>{renderPreview()}</div>
|
||||
</header>
|
||||
<div className='video-preview-stage app-scrollbar'>{renderPreview()}</div>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -4,8 +4,9 @@ import {
|
||||
RefreshCw as ActionRefreshCw,
|
||||
Trash2 as ActionTrash2,
|
||||
AlertCircle as ActionAlertCircle,
|
||||
ChevronDown as ActionChevronDown,
|
||||
} from '@/components/common/icons/ActionIcons';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState, useId } from 'react';
|
||||
import {
|
||||
Table,
|
||||
Button,
|
||||
@@ -17,8 +18,7 @@ import {
|
||||
Badge,
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
ChevronUp,
|
||||
ChevronDown,
|
||||
ListVideo,
|
||||
CheckCircle2,
|
||||
AlertCircle,
|
||||
Clock,
|
||||
@@ -47,32 +47,7 @@ const VideoTaskQueue = ({
|
||||
// 8 列合计 1190px 塞进 ~340px 容器、按钮全带文字,实际完全用不了。
|
||||
const isCompact = useIsMobile();
|
||||
const [selectedTasks, setSelectedTasks] = useState([]);
|
||||
const [windowHeight, setWindowHeight] = useState(window.innerHeight);
|
||||
|
||||
// 监听窗口高度变化
|
||||
useEffect(() => {
|
||||
const handleResize = () => {
|
||||
setWindowHeight(window.innerHeight);
|
||||
};
|
||||
|
||||
window.addEventListener('resize', handleResize);
|
||||
return () => window.removeEventListener('resize', handleResize);
|
||||
}, []);
|
||||
|
||||
// 计算任务队列高度:不超过屏幕高度的20%(五分之一)
|
||||
// 同时设置最小高度150px,最大高度300px
|
||||
const getQueueHeight = () => {
|
||||
const maxHeightPercent = windowHeight * 0.2; // 屏幕高度的20%
|
||||
// 手机端工具栏本身会换行占掉 ~100px,再按 20%(844px 屏上仅 169px)会让表格只剩
|
||||
// 不到 70px,连表头带分页都放不下。窄屏改用更宽松的下限。
|
||||
const minHeight = isCompact ? 300 : 150;
|
||||
const maxHeight = isCompact ? 420 : 300;
|
||||
|
||||
// 在最小和最大值之间取适当的高度
|
||||
return Math.max(minHeight, Math.min(maxHeightPercent, maxHeight));
|
||||
};
|
||||
|
||||
const queueHeight = getQueueHeight();
|
||||
const queueId = useId();
|
||||
|
||||
// 状态标签映射
|
||||
const getStatusTag = (status) => {
|
||||
@@ -303,65 +278,30 @@ const VideoTaskQueue = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* 折叠触发器 */}
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
bottom: visible ? `${queueHeight}px` : '0',
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: '40px',
|
||||
backgroundColor: 'var(--ui-color-bg-1)',
|
||||
borderTop: '1px solid var(--ui-color-border)',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
cursor: 'pointer',
|
||||
transition: 'bottom 0.3s',
|
||||
zIndex: 10,
|
||||
}}
|
||||
<section className='video-queue'>
|
||||
<h2 className='video-queue-heading'>
|
||||
<button
|
||||
type='button'
|
||||
className='video-queue-toggle'
|
||||
aria-expanded={visible}
|
||||
aria-controls={queueId}
|
||||
onClick={() => setVisible(!visible)}
|
||||
>
|
||||
<Space>
|
||||
{visible ? <ChevronDown size={16} /> : <ChevronUp size={16} />}
|
||||
<span style={{ fontSize: !isCompact ? '14px' : '12px' }}>
|
||||
{t('任务队列')} ({taskStats.total})
|
||||
</span>
|
||||
<ListVideo size={19} aria-hidden='true' />
|
||||
<span>{t('任务队列')}</span>
|
||||
<span className='video-queue-count'>{taskStats.total}</span>
|
||||
{taskStats.in_progress > 0 && (
|
||||
<Badge count={taskStats.in_progress} type='danger' />
|
||||
)}
|
||||
</Space>
|
||||
</div>
|
||||
|
||||
{/* 任务队列抽屉 */}
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
bottom: visible ? '0' : `-${queueHeight}px`,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: `${queueHeight}px`,
|
||||
backgroundColor: 'var(--ui-color-bg-0)',
|
||||
borderTop: '1px solid var(--ui-color-border)',
|
||||
transition: 'bottom 0.3s',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
zIndex: 9,
|
||||
}}
|
||||
>
|
||||
{/* 工具栏 */}
|
||||
<div
|
||||
style={{
|
||||
padding: !isCompact ? '12px 16px' : '8px 12px',
|
||||
borderBottom: '1px solid var(--ui-color-border)',
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
flexWrap: 'wrap',
|
||||
gap: '8px',
|
||||
}}
|
||||
>
|
||||
<ActionChevronDown
|
||||
size={16}
|
||||
className='video-queue-chevron'
|
||||
aria-hidden='true'
|
||||
/>
|
||||
</button>
|
||||
</h2>
|
||||
<div id={queueId} className='video-queue-content' hidden={!visible}>
|
||||
<div className='video-queue-toolbar'>
|
||||
<Space wrap>
|
||||
<Button
|
||||
size={!isCompact ? 'default' : 'small'}
|
||||
@@ -427,7 +367,7 @@ const VideoTaskQueue = ({
|
||||
</div>
|
||||
|
||||
{/* 任务表格 */}
|
||||
<div style={{ flex: 1, overflow: 'auto' }}>
|
||||
<div className='video-queue-table app-scrollbar'>
|
||||
<Table
|
||||
columns={columns}
|
||||
dataSource={tasks}
|
||||
@@ -446,7 +386,7 @@ const VideoTaskQueue = ({
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,211 @@
|
||||
.video-workspace {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
height: 100%;
|
||||
padding: 24px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.video-workspace-heading,
|
||||
.video-panel-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.video-workspace-icon,
|
||||
.video-preview-empty-icon {
|
||||
display: grid;
|
||||
flex: none;
|
||||
place-items: center;
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
color: var(--brand-selection-text);
|
||||
background: var(--brand-selection-bg);
|
||||
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 {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.video-workspace-grid {
|
||||
display: grid;
|
||||
flex: 1;
|
||||
grid-template-columns: clamp(312px, 26%, 420px) minmax(0, 1fr);
|
||||
gap: 16px;
|
||||
min-height: 310px;
|
||||
}
|
||||
|
||||
.video-workspace-composer {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.video-panel-header {
|
||||
display: flex;
|
||||
flex: none;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
min-height: 57px;
|
||||
padding: 10px 16px;
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.video-panel-header:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.video-panel-heading {
|
||||
gap: 8px;
|
||||
color: var(--brand-accent);
|
||||
}
|
||||
|
||||
.video-panel-heading h2 {
|
||||
margin: 0;
|
||||
color: var(--text-primary);
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.video-queue {
|
||||
flex: none;
|
||||
min-width: 0;
|
||||
background: var(--surface-card);
|
||||
border: 1px solid var(--border-subtle);
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.video-queue-heading {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.video-queue-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
min-height: 52px;
|
||||
padding: 8px 16px;
|
||||
border: 0;
|
||||
border-radius: 11px;
|
||||
background: transparent;
|
||||
color: var(--text-primary);
|
||||
text-align: start;
|
||||
font: inherit;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.video-queue-toggle > svg:first-child {
|
||||
color: var(--brand-accent);
|
||||
}
|
||||
|
||||
.video-queue-toggle:hover {
|
||||
background: var(--surface-bg-base);
|
||||
}
|
||||
|
||||
.video-queue-toggle:focus-visible {
|
||||
outline: 2px solid var(--brand-accent);
|
||||
outline-offset: -3px;
|
||||
}
|
||||
|
||||
.video-queue-toggle[aria-expanded='true'] {
|
||||
border-end-start-radius: 0;
|
||||
border-end-end-radius: 0;
|
||||
}
|
||||
|
||||
.video-queue-count {
|
||||
min-width: 23px;
|
||||
padding: 2px 6px;
|
||||
border-radius: 6px;
|
||||
background: var(--surface-bg-base);
|
||||
color: var(--text-secondary);
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.video-queue-chevron {
|
||||
margin-inline-start: auto;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.video-queue-toggle[aria-expanded='true'] .video-queue-chevron {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.video-queue-content {
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.video-queue-toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px 16px;
|
||||
padding: 10px 16px;
|
||||
border-bottom: 1px solid var(--border-subtle);
|
||||
}
|
||||
|
||||
.video-queue-table {
|
||||
min-width: 0;
|
||||
max-height: clamp(120px, 24dvh, 260px);
|
||||
overflow: auto;
|
||||
border-end-start-radius: 11px;
|
||||
border-end-end-radius: 11px;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.video-workspace {
|
||||
gap: 16px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.video-workspace-body {
|
||||
flex: none;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.video-workspace-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.video-workspace-heading h1 {
|
||||
font-size: 24px;
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
.video-queue-table {
|
||||
max-height: 320px;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,21 @@
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import React, { useState, useRef } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import VideoInputPanel from './Video/VideoInputPanel';
|
||||
import VideoPreviewPanel from './Video/VideoPreviewPanel';
|
||||
import VideoTaskQueue from './Video/VideoTaskQueue';
|
||||
import { useVideoGeneration } from '../../../../hooks/video/useVideoGeneration';
|
||||
import { showInfo } from '../../../../helpers';
|
||||
import './Video/VideoWorkspace.css';
|
||||
|
||||
const VideoGenerationTab = () => {
|
||||
const { t } = useTranslation();
|
||||
const [leftPanelCollapsed, setLeftPanelCollapsed] = useState(false);
|
||||
const [taskQueueVisible, setTaskQueueVisible] = useState(false);
|
||||
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
|
||||
const [selectedTaskForPlay, setSelectedTaskForPlay] = useState(null);
|
||||
// 输入面板容器:再生成回填后滚动到面板顶部
|
||||
const inputPanelRef = useRef(null);
|
||||
const inputScrollRef = useRef(null);
|
||||
|
||||
// 监听窗口大小变化
|
||||
useEffect(() => {
|
||||
const handleResize = () => {
|
||||
setWindowWidth(window.innerWidth);
|
||||
};
|
||||
|
||||
window.addEventListener('resize', handleResize);
|
||||
return () => window.removeEventListener('resize', handleResize);
|
||||
}, []);
|
||||
|
||||
const creation = useVideoGeneration();
|
||||
const {
|
||||
// 表单数据
|
||||
@@ -95,155 +85,24 @@ const VideoGenerationTab = () => {
|
||||
showInfo(t('已回填原参数,确认后点击生成'));
|
||||
// 等面板展开渲染后再滚动
|
||||
requestAnimationFrame(() => {
|
||||
inputScrollRef.current?.scrollTo?.({ top: 0, behavior: 'smooth' });
|
||||
inputScrollRef.current?.scrollTo?.({ top: 0 });
|
||||
inputPanelRef.current?.scrollIntoView?.({
|
||||
behavior: 'smooth',
|
||||
block: 'start',
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// 响应式布局配置 - 两列布局(左侧配置区 + 右侧预览区)
|
||||
const getLayoutConfig = () => {
|
||||
// 超大屏幕 (>1920px): 25% - 75%
|
||||
if (windowWidth > 1920) {
|
||||
return {
|
||||
leftWidth: '25%',
|
||||
centerWidth: '75%',
|
||||
minLeftWidth: '350px',
|
||||
minCenterWidth: '800px',
|
||||
direction: 'row',
|
||||
};
|
||||
}
|
||||
// 大屏幕 (1600-1920px): 28% - 72%
|
||||
if (windowWidth > 1600) {
|
||||
return {
|
||||
leftWidth: '28%',
|
||||
centerWidth: '72%',
|
||||
minLeftWidth: '320px',
|
||||
minCenterWidth: '700px',
|
||||
direction: 'row',
|
||||
};
|
||||
}
|
||||
// 中等屏幕 (1280-1600px): 32% - 68%
|
||||
if (windowWidth > 1280) {
|
||||
return {
|
||||
leftWidth: '32%',
|
||||
centerWidth: '68%',
|
||||
minLeftWidth: '300px',
|
||||
minCenterWidth: '600px',
|
||||
direction: 'row',
|
||||
};
|
||||
}
|
||||
// 小屏幕 (1024-1280px): 35% - 65%
|
||||
if (windowWidth > 1024) {
|
||||
return {
|
||||
leftWidth: '35%',
|
||||
centerWidth: '65%',
|
||||
minLeftWidth: '280px',
|
||||
minCenterWidth: '500px',
|
||||
direction: 'row',
|
||||
};
|
||||
}
|
||||
// 超小屏幕 (<1024px): 单列布局
|
||||
return {
|
||||
leftWidth: '100%',
|
||||
centerWidth: '100%',
|
||||
minLeftWidth: '100%',
|
||||
minCenterWidth: '100%',
|
||||
direction: 'column',
|
||||
};
|
||||
};
|
||||
|
||||
const layoutConfig = getLayoutConfig();
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
position: 'relative',
|
||||
overflow: 'hidden',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
flex: 1,
|
||||
overflow: layoutConfig.direction === 'row' ? 'hidden' : 'auto',
|
||||
display: 'flex',
|
||||
flexDirection: layoutConfig.direction === 'row' ? 'row' : 'column',
|
||||
gap: layoutConfig.direction === 'column' ? '16px' : '0',
|
||||
position: 'relative',
|
||||
paddingBottom: '40px', // 为任务队列触发器留出空间
|
||||
}}
|
||||
>
|
||||
{/* 左侧:输入区域(区域1) */}
|
||||
<div
|
||||
ref={inputPanelRef}
|
||||
style={{
|
||||
width:
|
||||
layoutConfig.direction === 'row'
|
||||
? layoutConfig.leftWidth
|
||||
: '100%',
|
||||
minWidth: layoutConfig.minLeftWidth,
|
||||
height: layoutConfig.direction === 'row' ? '100%' : 'auto',
|
||||
// 折叠态不能再预留 500px:面板收起后只剩一个 fixed 定位的浮动箭头,
|
||||
// 这 500px 会变成页面顶部一整块空白
|
||||
minHeight:
|
||||
layoutConfig.direction === 'column' && !leftPanelCollapsed
|
||||
? '500px'
|
||||
: 'auto',
|
||||
flexShrink: layoutConfig.direction === 'row' ? 0 : 1,
|
||||
backgroundColor: 'var(--ui-color-bg-1)',
|
||||
borderRight:
|
||||
layoutConfig.direction === 'row'
|
||||
? '1px solid var(--ui-color-border)'
|
||||
: 'none',
|
||||
borderBottom:
|
||||
layoutConfig.direction === 'column'
|
||||
? '1px solid var(--ui-color-border)'
|
||||
: 'none',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
ref={inputScrollRef}
|
||||
className='app-scrollbar'
|
||||
style={{
|
||||
height: '100%',
|
||||
overflow: 'auto',
|
||||
paddingBottom: layoutConfig.direction === 'row' ? '16px' : '16px',
|
||||
}}
|
||||
>
|
||||
<div className='video-workspace-body'>
|
||||
<div className='video-workspace-grid'>
|
||||
<div ref={inputPanelRef} className='video-workspace-composer'>
|
||||
<VideoInputPanel
|
||||
creation={creation}
|
||||
onCollapse={() => setLeftPanelCollapsed(!leftPanelCollapsed)}
|
||||
collapsed={leftPanelCollapsed}
|
||||
collapsible={layoutConfig.direction === 'row'}
|
||||
onCollapse={() => setLeftPanelCollapsed((current) => !current)}
|
||||
scrollRef={inputScrollRef}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 右侧:预览+生成区域 */}
|
||||
<div
|
||||
style={{
|
||||
flex: 1,
|
||||
height: layoutConfig.direction === 'row' ? '100%' : 'auto',
|
||||
minHeight: layoutConfig.direction === 'column' ? '600px' : 'auto',
|
||||
minWidth: 0,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className='app-scrollbar'
|
||||
style={{
|
||||
height: '100%',
|
||||
backgroundColor: 'var(--ui-color-bg-0)',
|
||||
padding: windowWidth > 768 ? '16px' : '12px',
|
||||
overflow: 'auto',
|
||||
}}
|
||||
>
|
||||
<VideoPreviewPanel
|
||||
formData={formData}
|
||||
generating={generating}
|
||||
@@ -262,19 +121,6 @@ const VideoGenerationTab = () => {
|
||||
onClearSelectedTask={handleClearSelectedTask}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 底部:任务队列(区域4) - 使用 absolute 定位,相对于父容器 */}
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
zIndex: 1000,
|
||||
}}
|
||||
>
|
||||
<VideoTaskQueue
|
||||
visible={taskQueueVisible}
|
||||
setVisible={setTaskQueueVisible}
|
||||
@@ -286,7 +132,6 @@ const VideoGenerationTab = () => {
|
||||
onRegenerate={handleRegenerate}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useContext } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Video, Sparkles, Clapperboard, Film, Play } from 'lucide-react';
|
||||
import { Video } from 'lucide-react';
|
||||
import VideoGenerationTab from './AICreation/VideoGenerationTab';
|
||||
import CreationStudio from '../../../components/creation/CreationStudio';
|
||||
import { StatusContext } from '../../../context/Status';
|
||||
@@ -16,82 +16,18 @@ const VideoGeneration = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='h-full flex flex-col p-6 relative overflow-hidden'>
|
||||
{/* 背景由父级 ExperienceCenter 的 PageBackground(rich) 统一提供,此处不再渲染 */}
|
||||
|
||||
{/* Header */}
|
||||
<div className='relative z-10 flex-shrink-0 mb-6'>
|
||||
<div className='flex items-center gap-4'>
|
||||
{/* 图标容器 */}
|
||||
<div className='relative'>
|
||||
<div className='absolute -inset-2 bg-gradient-to-r from-cyan-500/30 to-blue-500/30 rounded-2xl blur-lg opacity-60' />
|
||||
<div className='relative p-3 bg-gradient-to-br from-cyan-500 via-blue-500 to-brand-to rounded-2xl shadow-xl shadow-cyan-500/30'>
|
||||
<Video size={26} className='text-white' />
|
||||
</div>
|
||||
<Sparkles
|
||||
size={16}
|
||||
className='absolute -top-1 -right-1 text-amber-400 animate-pulse'
|
||||
/>
|
||||
|
||||
{/* 播放动画指示器 */}
|
||||
<div className='absolute -bottom-1 -left-1 w-5 h-5 rounded-full bg-green-500 flex items-center justify-center shadow-lg shadow-green-500/50'>
|
||||
<Play size={10} className='text-white ml-0.5' fill='white' />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 标题文字 */}
|
||||
<div className='video-workspace app-scrollbar'>
|
||||
<header className='video-workspace-heading'>
|
||||
<span className='video-workspace-icon' aria-hidden='true'>
|
||||
<Video size={22} />
|
||||
</span>
|
||||
<div>
|
||||
<h1 className='text-2xl md:text-3xl font-bold flex items-center gap-2'>
|
||||
<span className='bg-clip-text text-transparent bg-gradient-to-r from-cyan-600 via-blue-600 to-brand-to dark:from-cyan-400 dark:via-blue-400 dark:to-brand-to'>
|
||||
{t('视频生成')}
|
||||
</span>
|
||||
</h1>
|
||||
<p className='text-sm text-gray-500 dark:text-gray-400 mt-1'>
|
||||
{t('使用 AI 创建令人惊叹的视频内容')}
|
||||
</p>
|
||||
<h1>{t('视频生成')}</h1>
|
||||
<p>{t('使用 AI 创建令人惊叹的视频内容')}</p>
|
||||
</div>
|
||||
|
||||
{/* 右侧装饰标签 */}
|
||||
<div className='hidden md:flex items-center gap-2 ml-auto'>
|
||||
<div className='flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-gradient-to-r from-cyan-50 to-teal-50 dark:from-cyan-950/30 dark:to-teal-950/30 border border-cyan-200/50 dark:border-cyan-800/30'>
|
||||
<Clapperboard size={14} className='text-cyan-500' />
|
||||
<span className='text-xs font-medium text-cyan-600 dark:text-cyan-400'>
|
||||
{t('图生视频')}
|
||||
</span>
|
||||
</div>
|
||||
<div className='flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-gradient-to-r from-blue-50 to-brand-to/5 dark:from-blue-950/30 dark:to-brand-to/30 border border-blue-200/50 dark:border-blue-800/30'>
|
||||
<Film size={14} className='text-blue-500' />
|
||||
<span className='text-xs font-medium text-blue-600 dark:text-blue-400'>
|
||||
{t('文生视频')}
|
||||
</span>
|
||||
</div>
|
||||
<div className='flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-gradient-to-r from-brand-from/5 to-brand-to/5 dark:from-brand-from/30 dark:to-brand-to/30 border border-brand/50 dark:border-brand-deep/30'>
|
||||
<Sparkles size={14} className='text-brand' />
|
||||
<span className='text-xs font-medium text-brand-deep dark:text-brand-from'>
|
||||
{t('多模型支持')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Content */}
|
||||
<div className='relative z-10 flex-1 min-h-0'>
|
||||
{/* 卡片装饰边框 */}
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-r from-cyan-500/20 via-blue-500/20 to-brand-to/20 rounded-[20px] blur-sm opacity-60' />
|
||||
|
||||
{/* 内容卡片 */}
|
||||
<div className='relative h-full bg-white/70 dark:bg-neutral-900/70 backdrop-blur-xl rounded-2xl border border-white/50 dark:border-neutral-800/50 shadow-xl shadow-cyan-500/5 overflow-hidden'>
|
||||
{/* 顶部装饰线 */}
|
||||
<div className='absolute top-0 left-0 right-0 h-[2px] bg-gradient-to-r from-transparent via-cyan-500/50 to-transparent' />
|
||||
|
||||
{/* 左侧装饰线 */}
|
||||
<div className='absolute top-0 bottom-0 left-0 w-[2px] bg-gradient-to-b from-transparent via-blue-500/30 to-transparent' />
|
||||
|
||||
</header>
|
||||
<VideoGenerationTab />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -190,9 +190,13 @@ const ExperienceCenter = () => {
|
||||
* 子组件不再各自渲染背景,避免双层叠加。
|
||||
* text-model 特例:TextModel 自带 via-white 亮底保证聊天可读性,由其自身渲染,此处跳过。
|
||||
* 沉浸式生成页(视频/图片)用 rich 大光球,密钥管理(Token 列表)用 subtle。 */}
|
||||
{!isTextModel && (
|
||||
{!isTextModel &&
|
||||
(!(isVideoGeneration || isImageGeneration) ||
|
||||
creationStudioEnabled) && (
|
||||
<PageBackground
|
||||
variant={isVideoGeneration || isImageGeneration ? 'rich' : 'subtle'}
|
||||
variant={
|
||||
isVideoGeneration || isImageGeneration ? 'rich' : 'subtle'
|
||||
}
|
||||
animate
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
## 单一表单数据
|
||||
|
||||
首页、关于微词元、预约演示、动态与洞察共用一个配置对象,切换页签保留输入。
|
||||
首页、关于微元算力、预约演示、动态与洞察共用一个配置对象,切换页签保留输入。
|
||||
teamMembers 在两个页签共用,不生成不同的副本。原有 11 个字段均必填。
|
||||
动态与洞察绑定 insights 对象,包含 categories 和 articles,不按页签拆分保存。
|
||||
model.js 定义字段、页签、初始化、标准化和校验规则。
|
||||
|
||||
保存按首页、关于微词元、预约演示、动态与洞察顺序校验全部字段,错误保存在各表单项内。
|
||||
保存按首页、关于微元算力、预约演示、动态与洞察顺序校验全部字段,错误保存在各表单项内。
|
||||
空输入框提示“请输入中文字段名”,选择框提示“请选择中文字段名”,二维码提示“请上传企业微信二维码”。
|
||||
每个非当前页签有错误时只显示一条“请完善某页签的配置”警告,不列出全部字段,不自动切换页签。
|
||||
当前页签只显示表单项错误;切换页签后,其他页签的错误状态仍会显示。
|
||||
|
||||
@@ -14,8 +14,8 @@ export const TABS = [
|
||||
},
|
||||
{
|
||||
key: 'about',
|
||||
label: '关于微词元',
|
||||
description: '配置官网关于微词元区域展示的团队与服务信息。',
|
||||
label: '关于微元算力',
|
||||
description: '配置官网关于微元算力区域展示的团队与服务信息。',
|
||||
fields: ['teamMembers', 'researchRatio', 'headquarters', 'serviceNetwork'],
|
||||
},
|
||||
{
|
||||
@@ -53,7 +53,7 @@ export const FIELDS = {
|
||||
},
|
||||
teamMembers: {
|
||||
label: '团队成员',
|
||||
note: '首页与关于微词元共用',
|
||||
note: '首页与关于微元算力共用',
|
||||
placeholder: '请输入团队成员数量,例如 50',
|
||||
metric: { kind: 'integer', suffix: '+' },
|
||||
},
|
||||
|
||||
@@ -198,7 +198,7 @@ test('saving marks all fields inline and emits one ordered summary per hidden in
|
||||
assert.equal(page.warnings.length, 0);
|
||||
assert.deepEqual(
|
||||
page.messages.map((item) => item.message),
|
||||
['请完善首页的配置', '请完善关于微词元的配置', '请完善预约演示的配置'],
|
||||
['请完善首页的配置', '请完善关于微元算力的配置', '请完善预约演示的配置'],
|
||||
);
|
||||
page.switchTab('home');
|
||||
assert.equal(page.field('paidCustomers').props.error, '请输入付费企业客户');
|
||||
@@ -408,7 +408,7 @@ test('a shared invalid field still flags its hidden tab exactly once', async ()
|
||||
await page.save();
|
||||
assert.deepEqual(
|
||||
page.messages.map((item) => item.message),
|
||||
['请完善关于微词元的配置'],
|
||||
['请完善关于微元算力的配置'],
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user