比例选择样式修改

This commit is contained in:
sjy
2026-06-30 19:30:11 +08:00
parent b6e44565e7
commit 86e5bafad2
5 changed files with 58 additions and 29 deletions
@@ -124,11 +124,12 @@ const StorageCard: React.FC<{ data: ResourceCapacityData | null }> = ({ data })
return ( return (
<div <div
style={{ style={{
marginTop: 12, // marginTop: 12,
padding: '10px 12px', padding: '0 12px',
paddingTop: 6,
borderRadius: 10, borderRadius: 10,
background: 'linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%)', background: 'linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%)',
border: `1px solid ${isOver ? 'rgba(239, 68, 68, 0.25)' : 'rgba(99, 102, 241, 0.15)'}`, // border: `1px solid ${isOver ? 'rgba(239, 68, 68, 0.25)' : 'rgba(99, 102, 241, 0.15)'}`,
boxShadow: '0 2px 12px rgba(0, 0, 0, 0.04)', boxShadow: '0 2px 12px rgba(0, 0, 0, 0.04)',
}} }}
> >
@@ -144,7 +145,7 @@ const StorageCard: React.FC<{ data: ResourceCapacityData | null }> = ({ data })
> >
<span style={{ display: 'flex', alignItems: 'center', gap: 4 }}> <span style={{ display: 'flex', alignItems: 'center', gap: 4 }}>
<DatabaseOutlined style={{ fontSize: 12, color: isOver ? '#ef4444' : '#6366f1' }} /> <DatabaseOutlined style={{ fontSize: 12, color: isOver ? '#ef4444' : '#6366f1' }} />
{rawPercent.toFixed(1)}%
</span> </span>
{data.enabled ? ( {data.enabled ? (
<span style={{ fontWeight: 500, color: isOver ? '#ef4444' : '#1e293b' }}> <span style={{ fontWeight: 500, color: isOver ? '#ef4444' : '#1e293b' }}>
@@ -188,12 +189,12 @@ const StorageCard: React.FC<{ data: ResourceCapacityData | null }> = ({ data })
color: isOver ? '#ef4444' : '#94a3b8', color: isOver ? '#ef4444' : '#94a3b8',
}} }}
> >
<span> {/* <span>
{isOver {isOver
? `存储超额 · 超用 ${Math.abs(available).toFixed(2)} ${unit}` ? `存储超额 · 超用 ${Math.abs(available).toFixed(2)} ${unit}`
: `剩余 ${available.toFixed(2)} ${unit}`} : `剩余 ${available.toFixed(2)} ${unit}`}
</span> </span> */}
<span>{rawPercent.toFixed(1)}%</span> {/* <span>{rawPercent.toFixed(1)}%</span> */}
</div> </div>
</> </>
)} )}
@@ -801,14 +802,16 @@ const AppLayout: React.FC = () => {
<PlusOutlined style={{ fontSize: 16 }} /> <PlusOutlined style={{ fontSize: 16 }} />
<span></span> <span></span>
</div> </div>
{/* 资源存储容量展示(来自 getUser.resourceCapacity */}
<StorageCard data={resourceCapacity} />
<div style={{ padding: '16px 16px', flexShrink: 0 }}> <div style={{ padding: '16px 16px', flexShrink: 0 ,paddingTop: 0}}>
<Dropdown menu={{ items: userMenuItems, onClick: handleUserMenuClick }} placement="topRight" arrow> <Dropdown menu={{ items: userMenuItems, onClick: handleUserMenuClick }} placement="topRight" arrow>
<div style={{ <div style={{
display: 'flex', alignItems: 'center', display: 'flex', alignItems: 'center',
justifyContent: 'flex-start', justifyContent: 'flex-start',
gap: 12, gap: 12,
padding: '10px 14px', // padding: '10px 14px',
borderRadius: 14, cursor: 'pointer', borderRadius: 14, cursor: 'pointer',
transition: 'all 0.25s ease', transition: 'all 0.25s ease',
background: 'linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%)', background: 'linear-gradient(135deg, rgba(248, 250, 252, 0.9) 0%, rgba(241, 245, 249, 0.9) 100%)',
@@ -829,6 +832,7 @@ const AppLayout: React.FC = () => {
flexShrink: 0, flexShrink: 0,
boxShadow: '0 4px 12px rgba(99, 102, 241, 0.3)', boxShadow: '0 4px 12px rgba(99, 102, 241, 0.3)',
}} /> }} />
<div style={{ flex: 1, minWidth: 0 }}> <div style={{ flex: 1, minWidth: 0 }}>
<div style={{ color: '#1e293b', fontSize: 16, fontWeight: 600, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', letterSpacing: -0.01 }}> <div style={{ color: '#1e293b', fontSize: 16, fontWeight: 600, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', letterSpacing: -0.01 }}>
{user?.username} {user?.username}
@@ -847,8 +851,7 @@ const AppLayout: React.FC = () => {
</div> </div>
</Dropdown> </Dropdown>
{/* 资源存储容量展示(来自 getUser.resourceCapacity */}
<StorageCard data={resourceCapacity} />
</div> </div>
</div> </div>
+25 -4
View File
@@ -445,6 +445,7 @@ const AIChatPage: React.FC = () => {
}) })
.catch(() => { }); .catch(() => { });
}, []); }, []);
// 轮询逻辑 - 当有任务在生成时,每5秒查询一次状态 // 轮询逻辑 - 当有任务在生成时,每5秒查询一次状态
useEffect(() => { useEffect(() => {
@@ -1853,8 +1854,18 @@ const AIChatPage: React.FC = () => {
}} }}
> >
<div style={{ <div style={{
width: item.value === 'auto' ? 14 : 18, width: (() => {
height: item.value === 'auto' ? 14 : 18, const [w, h] = item.value === 'auto' ? [1, 1] : item.value.split(':').map(Number);
const maxSize = 18;
if (w >= h) return maxSize;
return Math.round(maxSize * (w / h));
})(),
height: (() => {
const [w, h] = item.value === 'auto' ? [1, 1] : item.value.split(':').map(Number);
const maxSize = 18;
if (h >= w) return maxSize;
return Math.round(maxSize * (h / w));
})(),
border: `2px solid ${selectedRatio === item.value ? '#6366f1' : '#9ca3af'}`, border: `2px solid ${selectedRatio === item.value ? '#6366f1' : '#9ca3af'}`,
borderRadius: 2, borderRadius: 2,
marginBottom: 2, marginBottom: 2,
@@ -2132,8 +2143,18 @@ const AIChatPage: React.FC = () => {
}} }}
> >
<div style={{ <div style={{
width: 18, width: (() => {
height: 18, const [w, h] = ratio.split(':').map(Number);
const maxSize = 18;
if (w >= h) return maxSize;
return Math.round(maxSize * (w / h));
})(),
height: (() => {
const [w, h] = ratio.split(':').map(Number);
const maxSize = 18;
if (h >= w) return maxSize;
return Math.round(maxSize * (h / w));
})(),
border: `2px solid ${videoAspectRatio === ratio ? '#6366f1' : '#9ca3af'}`, border: `2px solid ${videoAspectRatio === ratio ? '#6366f1' : '#9ca3af'}`,
borderRadius: 2, borderRadius: 2,
marginBottom: 2, marginBottom: 2,
+13 -9
View File
@@ -494,7 +494,6 @@ const GeneratePage: React.FC = () => {
if (autoPollStartedRef.current || recordItems.length === 0) return; if (autoPollStartedRef.current || recordItems.length === 0) return;
autoPollStartedRef.current = true; autoPollStartedRef.current = true;
console.log('aaaa', recordItems);
recordItems.forEach((r) => { recordItems.forEach((r) => {
if (r.projectId === projectId && r.status === "generating") { if (r.projectId === projectId && r.status === "generating") {
@@ -600,7 +599,6 @@ const GeneratePage: React.FC = () => {
} }
} catch (error: any) { } catch (error: any) {
if (error.name !== 'AbortError') { if (error.name !== 'AbortError') {
console.error('Optimizing polling error:', error);
} }
} }
}, 3000); }, 3000);
@@ -746,7 +744,6 @@ const GeneratePage: React.FC = () => {
key: "optimize", key: "optimize",
}); });
} catch (error: any) { } catch (error: any) {
console.error("优化提示词失败:", error);
const errorMsg = const errorMsg =
error?.response?.data?.message || error?.response?.data?.message ||
error?.message || error?.message ||
@@ -897,7 +894,6 @@ const GeneratePage: React.FC = () => {
} catch (error: any) { } catch (error: any) {
// 忽略AbortError(正常取消行为) // 忽略AbortError(正常取消行为)
if (error.name !== 'AbortError') { if (error.name !== 'AbortError') {
console.error('Global polling error:', error);
} }
} }
}, 5000); // 轮询间隔:5秒 }, 5000); // 轮询间隔:5秒
@@ -1002,11 +998,9 @@ const GeneratePage: React.FC = () => {
aspectRatio: record.aspectRatio || "16:9", aspectRatio: record.aspectRatio || "16:9",
resolution: record.resolution || "720p", resolution: record.resolution || "720p",
}); });
console.log('重新提交视频生成结果:',result);
if (result.status === "failed") { if (result.status === "failed") {
setRecordStates((p) => ({ ...p, [recordId]: "failed" })); setRecordStates((p) => ({ ...p, [recordId]: "failed" }));
console.log('12312');
message.error({ message.error({
content: `${projectName}」提交失败`, content: `${projectName}」提交失败`,
@@ -1023,7 +1017,6 @@ const GeneratePage: React.FC = () => {
} }
} catch (error: any) { } catch (error: any) {
setRecordStates((p) => ({ ...p, [recordId]: "failed" })); setRecordStates((p) => ({ ...p, [recordId]: "failed" }));
console.log('1231', error);
// 尝试从错误对象中提取detail字段 // 尝试从错误对象中提取detail字段
let errorMessage = "提交失败"; let errorMessage = "提交失败";
@@ -2198,8 +2191,18 @@ const GeneratePage: React.FC = () => {
> >
<div <div
style={{ style={{
width: item.value === "auto" ? 16 : 20, width: (() => {
height: item.value === "auto" ? 16 : 20, const [w, h] = item.value === "auto" ? [1, 1] : item.value.split(":").map(Number);
const maxSize = 20;
if (w >= h) return maxSize;
return Math.round(maxSize * (w / h));
})(),
height: (() => {
const [w, h] = item.value === "auto" ? [1, 1] : item.value.split(":").map(Number);
const maxSize = 20;
if (h >= w) return maxSize;
return Math.round(maxSize * (h / w));
})(),
border: `2px solid ${selectedRatio === item.value ? "#6366f1" : "#9ca3af"}`, border: `2px solid ${selectedRatio === item.value ? "#6366f1" : "#9ca3af"}`,
borderRadius: item.value === "auto" ? 3 : 3, borderRadius: item.value === "auto" ? 3 : 3,
marginBottom: 3, marginBottom: 3,
@@ -2208,6 +2211,7 @@ const GeneratePage: React.FC = () => {
justifyContent: "center", justifyContent: "center",
}} }}
> >
{item.value === "auto" && ( {item.value === "auto" && (
<span <span
style={{ style={{
+2 -2
View File
@@ -749,7 +749,7 @@ const HomePage: React.FC = () => {
{/* ========== 素材案例区域 ========== */} {/* ========== 素材案例区域 ========== */}
{/* <div className="animate-fadeInUp" style={{ <div className="animate-fadeInUp" style={{
padding: '24px 28px', padding: '24px 28px',
borderRadius: 16, borderRadius: 16,
background: '#fff', background: '#fff',
@@ -834,7 +834,7 @@ const HomePage: React.FC = () => {
</div> </div>
))} ))}
</div> </div>
</div> */} </div>
</div> </div>
); );
}; };
@@ -404,7 +404,7 @@ const GenerateConver: React.FC = () => {
}).catch((error: any) => { }).catch((error: any) => {
}); });
} }
}).catch((error: any) => { }).catch((error: any) => {
}); });
@@ -431,7 +431,7 @@ const GenerateConver: React.FC = () => {
position: 'relative', position: 'relative',
// padding: '20px 32px', // padding: '20px 32px',
boxSizing: 'border-box', boxSizing: 'border-box',
}} }}
> >
@@ -442,7 +442,8 @@ const GenerateConver: React.FC = () => {
{/* 顶部标题栏 */} {/* 顶部标题栏 */}
<div className="animate-fadeInUp" style={{ <div className="animate-fadeInUp" style={{
display: 'flex', justifyContent: 'space-between', alignItems: 'center', display: 'flex', justifyContent: 'space-between', alignItems: 'center',
marginBottom: 24, padding: '16px 24px', borderRadius: 16, padding: '16px 24px', borderRadius: 16,
paddingBottom: 0,
background: 'rgba(255,255,255,0.6)', background: 'rgba(255,255,255,0.6)',
backdropFilter: 'blur(10px)', backdropFilter: 'blur(10px)',
border: '1px solid rgba(99, 102, 241, 0.08)', border: '1px solid rgba(99, 102, 241, 0.08)',