修复了模型卡片不等高的问题

This commit is contained in:
Monster
2025-08-05 18:51:11 +08:00
parent 315b7f073b
commit 3aa0ff6a1e
2 changed files with 17 additions and 7 deletions

View File

@@ -9,9 +9,9 @@ const StyledLabel = styled('div')<StyledLabelProps>(
// 获取颜色值
const getColor = (colorProp: string) => {
// 如果是主题预设颜色
if (['success', 'warning', 'error', 'info'].includes(colorProp)) {
if (['success', 'warning', 'error', 'info', 'disabled'].includes(colorProp)) {
return theme.palette[
colorProp as 'success' | 'warning' | 'error' | 'info'
colorProp as 'success' | 'warning' | 'error' | 'info' | 'disabled'
].main;
}
// 如果是 default使用灰色
@@ -26,10 +26,10 @@ const StyledLabel = styled('div')<StyledLabelProps>(
// 获取背景颜色(淡化版本)
const getBackgroundColor = (colorProp: string) => {
if (['success', 'warning', 'error', 'info'].includes(colorProp)) {
if (['success', 'warning', 'error', 'info', 'disabled'].includes(colorProp)) {
// 使用主题的 light 版本,如果没有则使用 alpha 透明度
const palette =
theme.palette[colorProp as 'success' | 'warning' | 'error' | 'info'];
theme.palette[colorProp as 'success' | 'warning' | 'error' | 'info' | 'disabled'];
return alpha(palette.main, 0.15);
}
// 如果是 default使用淡灰色背景

View File

@@ -194,9 +194,7 @@ const ModelItem = ({
sx={{ mt: 2 }}
>
<Stack direction='row' alignItems='center'>
{data.is_active && (
<StyledLabel color='success'>使</StyledLabel>
)}
<StyledLabel color={data.is_active ? 'success' : 'disabled'}>{data.is_active ? '正在使用' : '未激活'}</StyledLabel>
</Stack>
<Stack direction='row' sx={{ button: { minWidth: 0 } }} gap={2}>
{!data.is_active && (
@@ -204,6 +202,9 @@ const ModelItem = ({
disableRipple
sx={{
color: 'success.main',
'&:hover': {
fontWeight: 700
},
}}
onClick={onActiveModel}
>
@@ -216,6 +217,9 @@ const ModelItem = ({
disableRipple
sx={{
color: 'info.main',
'&:hover': {
fontWeight: 700
},
}}
onClick={() => onEdit(data)}
>
@@ -228,6 +232,9 @@ const ModelItem = ({
disableRipple
sx={{
color: 'error.main',
'&:hover': {
fontWeight: 700
},
}}
onClick={onInactiveModel}
>
@@ -240,6 +247,9 @@ const ModelItem = ({
disableRipple
sx={{
color: 'error.main',
'&:hover': {
fontWeight: 700
},
}}
onClick={onRemoveModel}
>