This commit is contained in:
2026-07-02 13:03:51 +08:00
8 changed files with 115 additions and 1372 deletions
@@ -55,17 +55,14 @@ const PreResultDisplay: React.FC<PreResultDisplayProps> = ({ preResult }) => {
if (!config) return null;
const value = parsedData[key as keyof PreResultData];
const isYes = value === 'YES';
const isNo = value === 'NO';
const isUnknown = value === 'UNKNOWN';
if (isUnknown) return null;
let displayLabel, displayColor;
// if (isUnknown) {
// displayLabel = config.unknownLabel;
// displayColor = config.unknownColor;
// } else
if (isYes) {
displayLabel = config.label;
displayColor = config.yesColor;
} else {
} else if (isNo) {
displayLabel = config.noLabel;
displayColor = config.noColor;
}
@@ -102,15 +99,14 @@ const PreResultDisplay: React.FC<PreResultDisplayProps> = ({ preResult }) => {
{fieldConfig.map(config => {
const value = parsedData[config.key as keyof PreResultData];
const isYes = value === 'YES';
const isNo = value === 'NO';
const isUnknown = value === 'UNKNOWN';
if (isUnknown) return null;
let displayLabel, displayColor;
if (isUnknown) {
displayLabel = config.unknownLabel;
displayColor = config.unknownColor;
} else if (isYes) {
if (isYes) {
displayLabel = config.label;
displayColor = config.yesColor;
} else {
} else if (isNo) {
displayLabel = config.noLabel;
displayColor = config.noColor;
}
+66 -26
View File
@@ -171,6 +171,27 @@ const GeneratedRecord: React.FC = () => {
const hasGeneratedResourceId = (item: any): boolean => {
return Boolean(item.generatedResourceId);
};
// 检查视频尺寸是否符合480p要求(270×480或480×270
const checkVideoSize = (imagePx: string): boolean => {
if (!imagePx) return true;
const match = imagePx.match(/^(\d+)x(\d+)$/);
if (!match) return true;
const width = parseInt(match[1], 10);
const height = parseInt(match[2], 10);
const aspectRatio = width / height;
const isLandscape = width >= height;
if (isLandscape) {
const isValidWidth = width >= 480 && width <= 2560;
const isValidHeight = height >= 270 && height <= 1440;
const isValidRatio = aspectRatio >= 1.775 && aspectRatio <= 1.784;
return isValidWidth && isValidHeight && isValidRatio;
} else {
const isValidWidth = width >= 270 && width <= 1440;
const isValidHeight = height >= 480 && height <= 2560;
const isValidRatio = aspectRatio >= 0.555 && aspectRatio <= 0.564;
return isValidWidth && isValidHeight && isValidRatio;
}
};
// 多选相关函数
const handleToggleSelect = (itemId: string) => {
setSelectedItems(prev => {
@@ -654,6 +675,7 @@ const GeneratedRecord: React.FC = () => {
if (item.videoUrl && item.videoUrl.trim()) {
const dimensions = await getVideoDimensions(item.videoUrl);
if (dimensions) {
console.log(dimensions);
item.imagePx = dimensions;
}
}
@@ -1091,33 +1113,51 @@ const GeneratedRecord: React.FC = () => {
)}
{isSelectionMode && (
<div
style={{
position: 'absolute',
top: 8,
left: 8,
width: 20,
height: 20,
borderRadius: '50%',
backgroundColor: isSelectedItem ? '#10b981' : 'rgba(255,255,255,0.9)',
border: isSelectedItem ? '2px solid #10b981' : '2px solid #d1d5db',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
cursor: 'pointer',
zIndex: 10,
}}
onClick={(e) => {
e.stopPropagation();
handleToggleSelect(getItemResourceId(item));
}}
>
{isSelectedItem && (
<svg width={12} height={12} viewBox="0 0 12 12" fill="none">
<path d="M10 3L4.5 8.5L2 6" stroke="white" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" />
</svg>
<>
<div
style={{
position: 'absolute',
top: 8,
left: 8,
width: 20,
height: 20,
borderRadius: '50%',
backgroundColor: isSelectedItem ? '#10b981' : 'rgba(255,255,255,0.9)',
border: isSelectedItem ? '2px solid #10b981' : '2px solid #d1d5db',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
cursor: 'pointer',
zIndex: 10,
}}
onClick={(e) => {
e.stopPropagation();
handleToggleSelect(getItemResourceId(item));
}}
>
{isSelectedItem && (
<svg width={12} height={12} viewBox="0 0 12 12" fill="none">
<path d="M10 3L4.5 8.5L2 6" stroke="white" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round" />
</svg>
)}
</div>
{isSelectedItem && filterMedia === 'video' && item.imagePx && !checkVideoSize(item.imagePx) && (
<div style={{
position: 'absolute',
top: 36,
left: 8,
right: 8,
padding: '4px 8px',
backgroundColor: 'rgba(239, 68, 68, 0.9)',
color: '#fff',
fontSize: 10,
borderRadius: 4,
zIndex: 10,
}}>
</div>
)}
</div>
</>
)}
{!isSelectionMode && (