fix(experience-center): 统一图像与视频生成界面并修复参数显示

对齐表单、预览与任务区,跟随系统主题色,修复图片尺寸选择和视频高级参数显示。已通过本地浏览器验收、Lint、UI 审计和单测;未做生产测试。
This commit is contained in:
zhanjunhao
2026-11-20 18:30:13 +08:00
parent 461f0c577a
commit ab79dfd357
17 changed files with 1819 additions and 1812 deletions
@@ -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,
}}
onClick={() => setVisible(!visible)}
>
<Space>
{visible ? <ChevronDown size={16} /> : <ChevronUp size={16} />}
<span style={{ fontSize: !isCompact ? '14px' : '12px' }}>
{t('任务队列')} ({taskStats.total})
</span>
<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)}
>
<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>
);
};