feat: 自行开发设计 ui样式优化 超管端-控制台 相关的页面
This commit is contained in:
@@ -28,6 +28,8 @@ import {
|
||||
Loader2,
|
||||
} from 'lucide-react';
|
||||
import { exportToCsv, formatTimestampForCsv } from '../../../helpers/exportCsv';
|
||||
import { Space, Statistic } from 'antd';
|
||||
import { useConsolePage } from '../../console/ConsoleContext';
|
||||
|
||||
// CSV 导出:仅当前页已加载的数据,避免一次性拉取全量产生巨大请求
|
||||
export const exportTaskLogsPageCsv = (logs, isAdminUser, t) => {
|
||||
@@ -98,6 +100,7 @@ const TaskLogsActions = ({
|
||||
isAdminUser,
|
||||
usageRecordMode = false,
|
||||
}) => {
|
||||
const consolePage = useConsolePage();
|
||||
const exportButtonClass =
|
||||
'hover:!bg-gray-100 dark:hover:!bg-neutral-800 !transition-all !duration-300';
|
||||
|
||||
@@ -106,6 +109,28 @@ const TaskLogsActions = ({
|
||||
|
||||
const handleExportCsv = () => exportTaskLogsPageCsv(logs, isAdminUser, t);
|
||||
|
||||
if (consolePage) {
|
||||
return (
|
||||
<div className='console-task-stats'>
|
||||
<Space wrap size={24}>
|
||||
<Statistic title={t('本页成功')} value={stats.successCount} />
|
||||
<Statistic title={t('本页失败')} value={stats.failureCount} />
|
||||
<Statistic title={t('本页进行中')} value={stats.pendingCount} />
|
||||
</Space>
|
||||
<Space wrap>
|
||||
{stats.pendingCount > 0 && <span>{t('实时更新中')}</span>}
|
||||
<Button
|
||||
icon={<Download size={16} />}
|
||||
onClick={handleExportCsv}
|
||||
disabled={!logs.length}
|
||||
>
|
||||
{t('导出本页')}
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const StatBadge = ({ icon: Icon, label, value, gradient, iconBg }) => (
|
||||
<div className='relative group'>
|
||||
<div
|
||||
|
||||
@@ -25,13 +25,15 @@ import {
|
||||
Radio,
|
||||
RotateCcw,
|
||||
Search,
|
||||
Settings2,
|
||||
Filter,
|
||||
Activity,
|
||||
Layers,
|
||||
} from 'lucide-react';
|
||||
|
||||
import { DATE_RANGE_PRESETS } from '../../../constants/console.constants';
|
||||
import { useConsolePage } from '../../console/ConsoleContext';
|
||||
import FilterSearchButton from '../../common/table/FilterSearchButton';
|
||||
import { useFilterSearch } from '../../../hooks/common/useFilterSearch';
|
||||
import {
|
||||
TASK_ACTION_FIRST_TAIL_GENERATE,
|
||||
TASK_ACTION_GENERATE,
|
||||
@@ -45,7 +47,6 @@ const TaskLogsFilters = ({
|
||||
formInitValues,
|
||||
setFormApi,
|
||||
refresh,
|
||||
setShowColumnSelector,
|
||||
formApi,
|
||||
loading,
|
||||
isAdminUser,
|
||||
@@ -54,9 +55,11 @@ const TaskLogsFilters = ({
|
||||
hideDateRange = false,
|
||||
t,
|
||||
}) => {
|
||||
const consolePage = useConsolePage();
|
||||
const { scheduleSearch, submitSearch, cancelPendingSearch } =
|
||||
useFilterSearch(refresh);
|
||||
const SearchIcon = Search;
|
||||
const ResetIcon = RotateCcw;
|
||||
const ColumnsIcon = Settings2;
|
||||
const primaryButtonClass =
|
||||
'!bg-gradient-to-r !from-cyan-500 !to-blue-600 !border-0 hover:!from-cyan-600 hover:!to-blue-700 !shadow-md hover:!shadow-lg !transition-all !duration-300';
|
||||
const softButtonClass =
|
||||
@@ -77,6 +80,7 @@ const TaskLogsFilters = ({
|
||||
? getFreshInitValues()
|
||||
: formInitValues;
|
||||
formApi.setValues(fresh, { isOverride: true });
|
||||
cancelPendingSearch();
|
||||
setTimeout(() => {
|
||||
refresh();
|
||||
}, 100);
|
||||
@@ -165,12 +169,13 @@ const TaskLogsFilters = ({
|
||||
);
|
||||
|
||||
// 个人端使用记录:原型为带字段标签的五列筛选卡,重置/搜索位于右下;列设置移至表格卡片标题栏
|
||||
if (usageRecordMode) {
|
||||
if (usageRecordMode || consolePage) {
|
||||
return (
|
||||
<Form
|
||||
initValues={formInitValues}
|
||||
getFormApi={(api) => setFormApi(api)}
|
||||
onSubmit={refresh}
|
||||
onSubmit={consolePage ? submitSearch : refresh}
|
||||
onValueChange={consolePage ? scheduleSearch : undefined}
|
||||
allowEmpty={true}
|
||||
autoComplete='off'
|
||||
layout='vertical'
|
||||
@@ -232,14 +237,18 @@ const TaskLogsFilters = ({
|
||||
</div>
|
||||
<div className='usage-record-filter-actions'>
|
||||
<Button onClick={resetFilters}>{t('重置')}</Button>
|
||||
<Button
|
||||
type='primary'
|
||||
htmlType='submit'
|
||||
loading={loading}
|
||||
icon={<Search size={14} />}
|
||||
>
|
||||
{t('搜索')}
|
||||
</Button>
|
||||
{consolePage ? (
|
||||
<FilterSearchButton loading={loading} />
|
||||
) : (
|
||||
<Button
|
||||
type='primary'
|
||||
htmlType='submit'
|
||||
loading={loading}
|
||||
icon={<Search size={14} />}
|
||||
>
|
||||
{t('搜索')}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
@@ -412,17 +421,6 @@ const TaskLogsFilters = ({
|
||||
>
|
||||
{t('重置')}
|
||||
</Button>
|
||||
|
||||
{/* 列设置按钮 */}
|
||||
<Button
|
||||
type='tertiary'
|
||||
onClick={() => setShowColumnSelector(true)}
|
||||
size='small'
|
||||
icon={<ColumnsIcon className='w-3.5 h-3.5' />}
|
||||
className={softButtonClass}
|
||||
>
|
||||
{t('列设置')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -17,14 +17,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import TableEmpty from '../../common/table/TableEmpty';
|
||||
import React, { useMemo } from 'react';
|
||||
import { Empty as AntEmpty } from 'antd';
|
||||
import { Empty } from '@/components/ui';
|
||||
import CardTable from '../../common/ui/CardTable';
|
||||
import {
|
||||
IllustrationNoResult,
|
||||
IllustrationNoResultDark,
|
||||
} from '../../common/illustrations';
|
||||
|
||||
import { getTaskLogsColumns } from './TaskLogsColumnDefs';
|
||||
|
||||
const TaskLogsTable = (taskLogsData) => {
|
||||
@@ -99,42 +95,7 @@ const TaskLogsTable = (taskLogsData) => {
|
||||
: 'rounded-xl overflow-hidden task-logs-table'
|
||||
}
|
||||
size='middle'
|
||||
empty={
|
||||
usageRecordMode ? (
|
||||
<AntEmpty
|
||||
image={AntEmpty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={
|
||||
<>
|
||||
<div>{t('搜索无结果')}</div>
|
||||
<div className='usage-record-empty-hint'>
|
||||
{t('暂无任务记录')}
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<div className='py-12'>
|
||||
<Empty
|
||||
image={
|
||||
<IllustrationNoResult style={{ width: 180, height: 180 }} />
|
||||
}
|
||||
darkModeImage={
|
||||
<IllustrationNoResultDark style={{ width: 180, height: 180 }} />
|
||||
}
|
||||
description={
|
||||
<div className='flex flex-col items-center gap-2'>
|
||||
<span className='text-gray-500 dark:text-gray-400 text-sm'>
|
||||
{t('搜索无结果')}
|
||||
</span>
|
||||
<span className='text-gray-400 dark:text-gray-500 text-xs'>
|
||||
{t('暂无任务记录')}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
empty={<TableEmpty />}
|
||||
pagination={{
|
||||
currentPage: activePage,
|
||||
pageSize: pageSize,
|
||||
|
||||
@@ -19,9 +19,10 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { Card, Tag as AntTag } from 'antd';
|
||||
import { Clock, Download, Settings } from 'lucide-react';
|
||||
import { Button, Pagination, Tooltip } from '@/components/ui';
|
||||
import { Clock, Download } from 'lucide-react';
|
||||
import { Button, Pagination } from '@/components/ui';
|
||||
import CardPro from '../../common/ui/CardPro';
|
||||
import { ColumnSettingsButton } from '../../common/table/ColumnSettings';
|
||||
import TaskLogsTable from './TaskLogsTable';
|
||||
import TaskLogsActions, {
|
||||
exportTaskLogsPageCsv,
|
||||
@@ -56,7 +57,7 @@ const TaskLogsPage = ({
|
||||
const { t, logs, isAdminUser } = taskLogsData;
|
||||
return (
|
||||
<>
|
||||
<ColumnSelectorModal {...taskLogsData} />
|
||||
<ColumnSelectorModal {...taskLogsData} usageRecordMode />
|
||||
<ContentModal {...taskLogsData} isVideo={false} />
|
||||
{/* 视频预览弹窗 */}
|
||||
<ContentModal
|
||||
@@ -107,14 +108,10 @@ const TaskLogsPage = ({
|
||||
>
|
||||
{t('导出本页')}
|
||||
</Button>
|
||||
<Tooltip content={t('列设置')}>
|
||||
<Button
|
||||
theme='borderless'
|
||||
aria-label={t('列设置')}
|
||||
icon={<Settings size={16} />}
|
||||
onClick={() => taskLogsData.setShowColumnSelector(true)}
|
||||
/>
|
||||
</Tooltip>
|
||||
<ColumnSettingsButton
|
||||
open={taskLogsData.showColumnSelector}
|
||||
onClick={() => taskLogsData.setShowColumnSelector(true)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<TaskLogsTable
|
||||
@@ -148,16 +145,6 @@ const TaskLogsPage = ({
|
||||
return (
|
||||
<div className='relative'>
|
||||
{/* 装饰性网格背景 */}
|
||||
<div
|
||||
className='absolute inset-0 opacity-[0.015] dark:opacity-[0.03] pointer-events-none'
|
||||
style={{
|
||||
backgroundImage: `
|
||||
linear-gradient(rgba(6, 182, 212, 0.5) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(6, 182, 212, 0.5) 1px, transparent 1px)
|
||||
`,
|
||||
backgroundSize: '24px 24px',
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* Modals */}
|
||||
<ColumnSelectorModal {...taskLogsData} />
|
||||
@@ -173,6 +160,7 @@ const TaskLogsPage = ({
|
||||
|
||||
{/* Main Content */}
|
||||
<CardPro
|
||||
tableTitle={taskLogsData.t('任务明细')}
|
||||
type='type2'
|
||||
className='!bg-transparent !border-0 !shadow-none relative'
|
||||
statsArea={
|
||||
@@ -184,7 +172,14 @@ const TaskLogsPage = ({
|
||||
hideDateRange={taskLogsData.usesSharedDateRange}
|
||||
/>
|
||||
}
|
||||
tableActions={
|
||||
<ColumnSettingsButton
|
||||
open={taskLogsData.showColumnSelector}
|
||||
onClick={() => taskLogsData.setShowColumnSelector(true)}
|
||||
/>
|
||||
}
|
||||
paginationArea={createCardProPagination({
|
||||
showRange: false,
|
||||
currentPage: taskLogsData.activePage,
|
||||
pageSize: taskLogsData.pageSize,
|
||||
total: taskLogsData.logCount,
|
||||
@@ -196,18 +191,10 @@ const TaskLogsPage = ({
|
||||
t={taskLogsData.t}
|
||||
>
|
||||
{/* 表格容器 */}
|
||||
<div className='relative mt-4'>
|
||||
{/* 表格装饰光晕 —— 走冷色 cyan→blue→品牌,与任务日志图标族一致 */}
|
||||
<div className='absolute -inset-0.5 bg-gradient-to-r from-cyan-500/20 via-blue-500/20 to-brand-to/20 rounded-2xl opacity-50 blur-sm' />
|
||||
|
||||
{/* 表格内容 —— 统一 .app-card 玻璃卡(去掉散乱的 bg-white/80 + border + rounded) */}
|
||||
<div className='relative app-card overflow-hidden'>
|
||||
<TaskLogsTable
|
||||
{...taskLogsData}
|
||||
compactMode={taskLogsData.compactMode}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<TaskLogsTable
|
||||
{...taskLogsData}
|
||||
compactMode={taskLogsData.compactMode}
|
||||
/>
|
||||
</CardPro>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -18,21 +18,22 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Modal, Button, Checkbox } from '@/components/ui';
|
||||
import { ColumnVisibilitySettings } from '../../../common/table/ColumnSettings';
|
||||
import { getTaskLogsColumns } from '../TaskLogsColumnDefs';
|
||||
|
||||
const ColumnSelectorModal = ({
|
||||
showColumnSelector,
|
||||
setShowColumnSelector,
|
||||
visibleColumns,
|
||||
handleColumnVisibilityChange,
|
||||
handleSelectAll,
|
||||
initDefaultColumns,
|
||||
setVisibleColumns,
|
||||
getDefaultColumnVisibility,
|
||||
COLUMN_KEYS,
|
||||
isAdminUser,
|
||||
isRootUser,
|
||||
copyText,
|
||||
openContentModal,
|
||||
usageRecordMode = false,
|
||||
columns: configuredColumns,
|
||||
t,
|
||||
}) => {
|
||||
// Get all columns for display in selector
|
||||
@@ -43,69 +44,20 @@ const ColumnSelectorModal = ({
|
||||
openContentModal,
|
||||
isAdminUser,
|
||||
isRootUser,
|
||||
usageRecordMode,
|
||||
});
|
||||
|
||||
// 计算"全选"状态时应忽略的 key:当前角色下不可见的管理员专属列
|
||||
// 否则非管理员下 CHANNEL 永远为 false,导致 every 永远为 false、全选框永远半选
|
||||
const isHiddenForRole = (key) => !isAdminUser && key === COLUMN_KEYS.CHANNEL;
|
||||
const effectiveValues = Object.entries(visibleColumns)
|
||||
.filter(([key]) => !isHiddenForRole(key))
|
||||
.map(([, v]) => v);
|
||||
const allChecked =
|
||||
effectiveValues.length > 0 && effectiveValues.every((v) => v === true);
|
||||
const someChecked = effectiveValues.some((v) => v === true);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={t('列设置')}
|
||||
visible={showColumnSelector}
|
||||
onCancel={() => setShowColumnSelector(false)}
|
||||
footer={
|
||||
<div className='flex justify-end gap-2'>
|
||||
<Button onClick={() => initDefaultColumns()}>{t('重置')}</Button>
|
||||
<Button onClick={() => setShowColumnSelector(false)}>
|
||||
{t('取消')}
|
||||
</Button>
|
||||
<Button onClick={() => setShowColumnSelector(false)}>
|
||||
{t('确定')}
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div style={{ marginBottom: 20 }}>
|
||||
<Checkbox
|
||||
checked={allChecked}
|
||||
indeterminate={someChecked && !allChecked}
|
||||
onChange={(e) => handleSelectAll(e.target.checked)}
|
||||
>
|
||||
{t('全选')}
|
||||
</Checkbox>
|
||||
</div>
|
||||
<div
|
||||
className='flex flex-wrap max-h-96 overflow-y-auto rounded-lg p-4'
|
||||
style={{ border: '1px solid var(--ui-color-border)' }}
|
||||
>
|
||||
{allColumns.map((column) => {
|
||||
// Skip admin-only columns for non-admin users
|
||||
if (!isAdminUser && column.key === COLUMN_KEYS.CHANNEL) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div key={column.key} className='w-1/2 mb-4 pr-2'>
|
||||
<Checkbox
|
||||
checked={!!visibleColumns[column.key]}
|
||||
onChange={(e) =>
|
||||
handleColumnVisibilityChange(column.key, e.target.checked)
|
||||
}
|
||||
>
|
||||
{column.title}
|
||||
</Checkbox>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</Modal>
|
||||
<ColumnVisibilitySettings
|
||||
showColumnSelector={showColumnSelector}
|
||||
setShowColumnSelector={setShowColumnSelector}
|
||||
columns={(configuredColumns || allColumns).filter(
|
||||
(column) => isAdminUser || column.key !== COLUMN_KEYS.CHANNEL,
|
||||
)}
|
||||
visibleColumns={visibleColumns}
|
||||
setVisibleColumns={setVisibleColumns}
|
||||
getDefaultColumnVisibility={getDefaultColumnVisibility}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -17,10 +17,14 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { writeClipboardText } from '../../../../helpers/clipboard';
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import { Empty, theme } from 'antd';
|
||||
import { Modal, Button, Typography, Spin } from '@/components/ui';
|
||||
import { IconExternalOpen, IconCopy } from '@/components/ui/icons';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { showError, showSuccess } from '../../../../helpers';
|
||||
import './content-modal.css';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
@@ -33,18 +37,31 @@ const ContentModal = ({
|
||||
isVideo,
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const { token } = theme.useToken();
|
||||
const [videoError, setVideoError] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const videoRef = useRef(null);
|
||||
|
||||
// 复制/打开操作都用上游原始 URL,代理路径可能带鉴权或外部无法访问
|
||||
const shareUrl = sourceUrl || modalContent;
|
||||
|
||||
useEffect(() => {
|
||||
if (isModalOpen && isVideo) {
|
||||
if (!isVideo) return;
|
||||
const video = videoRef.current;
|
||||
if (isModalOpen) {
|
||||
setVideoError(false);
|
||||
setIsLoading(true);
|
||||
// 弹窗关闭只隐藏、不卸载内容:重新打开同一视频时 <video> 不会再次触发加载事件,
|
||||
// 已有可播放数据则不再显示加载指示,避免指示常驻
|
||||
const loaded =
|
||||
video &&
|
||||
video.readyState >= 2 &&
|
||||
video.getAttribute('src') === modalContent;
|
||||
setIsLoading(!loaded);
|
||||
} else if (video && !video.paused) {
|
||||
// 关闭时暂停播放,避免隐藏后仍在后台出声(不改变弹窗的卸载语义)
|
||||
video.pause();
|
||||
}
|
||||
}, [isModalOpen, isVideo]);
|
||||
}, [isModalOpen, isVideo, modalContent]);
|
||||
|
||||
const handleVideoError = () => {
|
||||
setVideoError(true);
|
||||
@@ -56,144 +73,129 @@ const ContentModal = ({
|
||||
};
|
||||
|
||||
const handleCopyUrl = () => {
|
||||
navigator.clipboard.writeText(shareUrl);
|
||||
writeClipboardText(shareUrl)
|
||||
.then(() => showSuccess(t('链接已复制')))
|
||||
.catch(() => showError(t('复制失败,请手动复制')));
|
||||
};
|
||||
|
||||
const handleOpenInNewTab = () => {
|
||||
window.open(shareUrl, '_blank');
|
||||
};
|
||||
|
||||
const close = () => setIsModalOpen(false);
|
||||
|
||||
// 视频预览内部视图:标题栏 + 16:9 播放区(加载 / 播放)+ 空态 / 播放失败态;
|
||||
// 颜色只引用 TokenBridge 注入的 --ui-* 变量(由 Ant token 生成),随浅色 / 深色 / 自定义主题色联动。
|
||||
const renderVideoContent = () => {
|
||||
if (!modalContent) {
|
||||
return (
|
||||
<div className='task-video-state'>
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={t('暂无视频')}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (videoError) {
|
||||
return (
|
||||
<div style={{ textAlign: 'center', padding: '40px' }}>
|
||||
<Text
|
||||
type='tertiary'
|
||||
style={{ display: 'block', marginBottom: '16px' }}
|
||||
>
|
||||
{t('视频无法在当前浏览器中播放,这可能是由于:')}
|
||||
<div className='task-video-state is-error'>
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={
|
||||
<div className='task-video-reasons'>
|
||||
<p>{t('视频无法在当前浏览器中播放,这可能是由于:')}</p>
|
||||
<span>{t('• 视频服务商的跨域限制')}</span>
|
||||
<span>{t('• 需要特定的请求头或认证')}</span>
|
||||
<span>{t('• 防盗链保护机制')}</span>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<Text type='tertiary' className='task-video-url'>
|
||||
{shareUrl}
|
||||
</Text>
|
||||
<Text
|
||||
type='tertiary'
|
||||
style={{ display: 'block', marginBottom: '8px', fontSize: '12px' }}
|
||||
>
|
||||
{t('• 视频服务商的跨域限制')}
|
||||
</Text>
|
||||
<Text
|
||||
type='tertiary'
|
||||
style={{ display: 'block', marginBottom: '8px', fontSize: '12px' }}
|
||||
>
|
||||
{t('• 需要特定的请求头或认证')}
|
||||
</Text>
|
||||
<Text
|
||||
type='tertiary'
|
||||
style={{ display: 'block', marginBottom: '16px', fontSize: '12px' }}
|
||||
>
|
||||
{t('• 防盗链保护机制')}
|
||||
</Text>
|
||||
|
||||
<div style={{ marginTop: '20px' }}>
|
||||
<Button
|
||||
icon={<IconExternalOpen />}
|
||||
onClick={handleOpenInNewTab}
|
||||
style={{ marginRight: '8px' }}
|
||||
>
|
||||
{t('在新标签页中打开')}
|
||||
</Button>
|
||||
<Button icon={<IconCopy />} onClick={handleCopyUrl}>
|
||||
{t('复制链接')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div
|
||||
style={{
|
||||
marginTop: '16px',
|
||||
padding: '8px',
|
||||
backgroundColor: 'var(--ui-color-fill-0)',
|
||||
borderRadius: '4px',
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
type='tertiary'
|
||||
style={{ fontSize: '10px', wordBreak: 'break-all' }}
|
||||
>
|
||||
{shareUrl}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ position: 'relative' }}>
|
||||
<div className='task-video-stage'>
|
||||
{isLoading && (
|
||||
<div
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: '50%',
|
||||
left: '50%',
|
||||
transform: 'translate(-50%, -50%)',
|
||||
zIndex: 10,
|
||||
}}
|
||||
>
|
||||
<div className='task-video-loading'>
|
||||
<Spin size='large' />
|
||||
</div>
|
||||
)}
|
||||
<video
|
||||
ref={videoRef}
|
||||
className='task-video-player'
|
||||
src={modalContent}
|
||||
controls
|
||||
style={{ width: '100%' }}
|
||||
autoPlay
|
||||
crossOrigin='anonymous'
|
||||
onError={handleVideoError}
|
||||
onLoadedData={handleVideoLoaded}
|
||||
onLoadStart={() => setIsLoading(true)}
|
||||
/>
|
||||
{/* 播放成功时也提供复制/新标签页按钮,复制的是上游分享 URL 而非代理路径 */}
|
||||
<div
|
||||
style={{
|
||||
marginTop: '12px',
|
||||
display: 'flex',
|
||||
gap: '8px',
|
||||
justifyContent: 'flex-end',
|
||||
}}
|
||||
>
|
||||
<Button size='small' icon={<IconCopy />} onClick={handleCopyUrl}>
|
||||
{t('复制链接')}
|
||||
</Button>
|
||||
<Button
|
||||
size='small'
|
||||
icon={<IconExternalOpen />}
|
||||
onClick={handleOpenInNewTab}
|
||||
>
|
||||
{t('在新标签页打开')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
if (isVideo) {
|
||||
// 复制 / 新标签页打开统一放在页脚(播放成功与失败两态都可用),复制的是上游分享 URL 而非代理路径
|
||||
const footer = (
|
||||
<div
|
||||
className='task-video-footer'
|
||||
style={{ '--task-video-button-height': `${token.controlHeight}px` }}
|
||||
>
|
||||
{shareUrl && (
|
||||
<>
|
||||
<Button icon={<IconCopy />} onClick={handleCopyUrl}>
|
||||
{t('复制链接')}
|
||||
</Button>
|
||||
<Button icon={<IconExternalOpen />} onClick={handleOpenInNewTab}>
|
||||
{videoError ? t('在新标签页中打开') : t('在新标签页打开')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
<Button type='primary' onClick={close}>
|
||||
{t('关闭')}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
return (
|
||||
<Modal
|
||||
className='task-content-modal task-video-modal'
|
||||
title={t('视频预览')}
|
||||
visible={isModalOpen}
|
||||
onOk={close}
|
||||
onCancel={close}
|
||||
footer={footer}
|
||||
width={800}
|
||||
>
|
||||
{renderVideoContent()}
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal
|
||||
className='task-content-modal'
|
||||
visible={isModalOpen}
|
||||
onOk={() => setIsModalOpen(false)}
|
||||
onCancel={() => setIsModalOpen(false)}
|
||||
onOk={close}
|
||||
onCancel={close}
|
||||
closable={null}
|
||||
bodyStyle={{
|
||||
height: isVideo ? '450px' : '400px',
|
||||
height: '400px',
|
||||
overflowX: 'hidden',
|
||||
overflowY: 'auto',
|
||||
padding: isVideo && videoError ? '0' : '24px',
|
||||
padding: '24px',
|
||||
}}
|
||||
width={800}
|
||||
>
|
||||
{isVideo ? (
|
||||
renderVideoContent()
|
||||
) : (
|
||||
<p style={{ whiteSpace: 'pre-line', overflowWrap: 'anywhere' }}>
|
||||
{modalContent}
|
||||
</p>
|
||||
)}
|
||||
<p style={{ whiteSpace: 'pre-line', overflowWrap: 'anywhere' }}>
|
||||
{modalContent}
|
||||
</p>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 任务日志内容 / 视频预览弹窗(ContentModal)内部样式。
|
||||
* 原型“消耗明细 → 绘图与视频 → 点击预览视频”未定义弹框,按“未定义项”规则:
|
||||
* Ant Design Modal 默认结构(标题栏、右上关闭、页脚按钮、遮罩)+ 全局 token;无装饰、阴影与动画。
|
||||
* 颜色只引用 UiThemeProvider TokenBridge 注入 body 的 --ui-* 变量(由 Ant token 生成),
|
||||
* Portal 内同样可继承,浅色 / 深色 / 自定义主题色自动联动。选择器以 :where() 降低优先级,不用 !important。
|
||||
*/
|
||||
:where(.task-video-modal) .task-video-stage {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--ui-color-border-light);
|
||||
border-radius: var(--ui-border-radius-medium);
|
||||
background: var(--ui-color-fill-0);
|
||||
}
|
||||
|
||||
:where(.task-video-modal) .task-video-player {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
:where(.task-video-modal) .task-video-loading {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* 空态 / 播放失败态:与播放区同为 16:9 占位,内容居中 */
|
||||
:where(.task-video-modal) .task-video-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 16px;
|
||||
width: 100%;
|
||||
min-height: 0;
|
||||
aspect-ratio: 16 / 9;
|
||||
padding: 24px;
|
||||
border: 1px dashed var(--ui-color-border);
|
||||
border-radius: var(--ui-border-radius-medium);
|
||||
background: var(--ui-color-fill-0);
|
||||
}
|
||||
|
||||
:where(.task-video-modal) .task-video-state .ant-empty {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:where(.task-video-modal) .task-video-reasons {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
color: var(--ui-color-text-1);
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
:where(.task-video-modal) .task-video-reasons p {
|
||||
margin: 0 0 4px;
|
||||
color: var(--ui-color-text);
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
:where(.task-video-modal) .task-video-url {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
padding: 8px 12px;
|
||||
border-radius: var(--ui-border-radius-small);
|
||||
background: var(--ui-color-fill-1);
|
||||
font-family: var(--ui-font-family-mono);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
:where(.task-video-modal) .task-video-footer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
:where(.task-video-modal) .task-video-footer .ant-btn {
|
||||
height: var(--task-video-button-height);
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
:where(.task-video-modal) .task-video-state {
|
||||
aspect-ratio: auto;
|
||||
min-height: 220px;
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user