This commit is contained in:
@@ -234,9 +234,12 @@ export default function WorksGallery({ sourceId, sourceType, emptyHint }: WorksG
|
||||
<WorkStatsGrid work={work} />
|
||||
<div style={{ padding: '10px 16px 0' }}>
|
||||
<Flex vertical gap={8} style={{ minWidth: 0 }}>
|
||||
<Typography.Paragraph strong ellipsis={{ rows: 2 }} style={{ marginBottom: 0 }}>
|
||||
{work.title || '无标题'}
|
||||
</Typography.Paragraph>
|
||||
{/* 无标题作品不渲染标题行,避免占位文案增加卡片噪音。 */}
|
||||
{work.title ? (
|
||||
<Typography.Paragraph strong ellipsis={{ rows: 2 }} style={{ marginBottom: 0 }}>
|
||||
{work.title}
|
||||
</Typography.Paragraph>
|
||||
) : null}
|
||||
{work.body ? (
|
||||
<Typography.Paragraph type="secondary" ellipsis={{ rows: 2 }} style={{ fontSize: 12, marginBottom: 0 }}>
|
||||
{work.body}
|
||||
@@ -277,7 +280,9 @@ export default function WorksGallery({ sourceId, sourceType, emptyHint }: WorksG
|
||||
{detailWork ? (
|
||||
<Flex vertical gap={12}>
|
||||
<Typography.Text type="secondary" style={{ fontSize: 12 }}>ID:{detailWork.work_key || detailWork.id}</Typography.Text>
|
||||
<Typography.Paragraph strong style={{ marginBottom: 0 }}>{detailWork.title || '无标题'}</Typography.Paragraph>
|
||||
{detailWork.title ? (
|
||||
<Typography.Paragraph strong style={{ marginBottom: 0 }}>{detailWork.title}</Typography.Paragraph>
|
||||
) : null}
|
||||
<Typography.Paragraph style={{ whiteSpace: 'pre-wrap', marginBottom: 0 }}>
|
||||
{detailWork.body || '暂无正文'}
|
||||
</Typography.Paragraph>
|
||||
|
||||
@@ -30,6 +30,13 @@ test('观看/点赞/评论/分享四项指标全宽 GRID 贴封面下方', () =>
|
||||
assert.match(body, /borderBottom/);
|
||||
});
|
||||
|
||||
test('无标题作品在卡片和详情中均不显示占位标题', () => {
|
||||
const text = sourceText();
|
||||
assert.match(text, /\{work\.title \? \(/);
|
||||
assert.match(text, /\{detailWork\.title \? \(/);
|
||||
assert.doesNotMatch(text, /work\.title \|\| '无标题'|detailWork\.title \|\| '无标题'/);
|
||||
});
|
||||
|
||||
test('卡片展示作品描述(body 省略两行)', () => {
|
||||
const card = /work\.body \? \(/.exec(sourceText());
|
||||
assert.ok(card, '卡片应有 body 描述分支');
|
||||
|
||||
Reference in New Issue
Block a user