fix: 协作单礼包名分行显示,保留类目前缀
This commit is contained in:
@@ -1573,6 +1573,37 @@ export default function HuyaCollabPage() {
|
|||||||
return short.length > 10 ? `${short.slice(0, 10)}…` : short;
|
return short.length > 10 ? `${short.slice(0, 10)}…` : short;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格里选中礼包后的显示:
|
||||||
|
* 第一行保留活动 / 类目前缀(如「[限量返场]」),第二行完整显示礼包名。
|
||||||
|
* 之前整串单行塞进 160px,前缀就把真正的礼包名挤成省略号了。
|
||||||
|
*/
|
||||||
|
const renderGiftSelectedLabel = (name: string) => {
|
||||||
|
const gift = giftOptions.find((item) => item.name === name);
|
||||||
|
if (!gift) {
|
||||||
|
return (
|
||||||
|
<span style={{ whiteSpace: 'normal', wordBreak: 'break-word', lineHeight: '18px' }}>
|
||||||
|
{name}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<span style={{ display: 'flex', flexDirection: 'column', minWidth: 0, lineHeight: 1.3 }}>
|
||||||
|
{gift.category_name && (
|
||||||
|
<Text type="secondary" style={{ fontSize: 11, lineHeight: '14px' }}>
|
||||||
|
[{gift.category_name}]
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
<Text strong style={{
|
||||||
|
display: 'block', fontSize: 13, lineHeight: '18px',
|
||||||
|
whiteSpace: 'normal', wordBreak: 'break-word',
|
||||||
|
}}>
|
||||||
|
{gift.name}
|
||||||
|
</Text>
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const renderFrequentGiftChips = (
|
const renderFrequentGiftChips = (
|
||||||
current: string | undefined,
|
current: string | undefined,
|
||||||
pick: (name: string) => void,
|
pick: (name: string) => void,
|
||||||
@@ -1756,7 +1787,7 @@ export default function HuyaCollabPage() {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '礼包 / 备注', width: 160,
|
title: '礼包 / 备注', width: 190,
|
||||||
...sortProps('gift_name'),
|
...sortProps('gift_name'),
|
||||||
render: (_, row) => (
|
render: (_, row) => (
|
||||||
<Space direction="vertical" size={0} style={{ width: '100%' }}>
|
<Space direction="vertical" size={0} style={{ width: '100%' }}>
|
||||||
@@ -1772,6 +1803,9 @@ export default function HuyaCollabPage() {
|
|||||||
disabled={!canEdit}
|
disabled={!canEdit}
|
||||||
placeholder="+ 点选礼包"
|
placeholder="+ 点选礼包"
|
||||||
popupMatchSelectWidth={false}
|
popupMatchSelectWidth={false}
|
||||||
|
// 前缀单独一行、礼包名完整换行,别让单行省略号把名字吃掉
|
||||||
|
labelRender={() => renderGiftSelectedLabel(row.gift_name)}
|
||||||
|
styles={{ content: { whiteSpace: 'normal', textOverflow: 'clip', lineHeight: 1.3 } }}
|
||||||
notFoundContent={giftOptions.length === 0 ? '礼包缓存为空:先在「新建」里贴 CK 拉一次' : '没有匹配的礼包'}
|
notFoundContent={giftOptions.length === 0 ? '礼包缓存为空:先在「新建」里贴 CK 拉一次' : '没有匹配的礼包'}
|
||||||
onChange={(next: string) => void patchOrder(row, { gift_name: next })}
|
onChange={(next: string) => void patchOrder(row, { gift_name: next })}
|
||||||
/>
|
/>
|
||||||
@@ -2154,7 +2188,7 @@ export default function HuyaCollabPage() {
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={rows}
|
dataSource={rows}
|
||||||
scroll={{ x: 2200, y: 'calc(100vh - 460px)' }}
|
scroll={{ x: 2240, y: 'calc(100vh - 460px)' }}
|
||||||
sortDirections={['ascend', 'descend']}
|
sortDirections={['ascend', 'descend']}
|
||||||
onChange={(_pagination, _filters, sorter, extra) => {
|
onChange={(_pagination, _filters, sorter, extra) => {
|
||||||
if (extra.action !== 'sort') return;
|
if (extra.action !== 'sort') return;
|
||||||
|
|||||||
Reference in New Issue
Block a user