Merge branch 'main' into dev

This commit is contained in:
yml2213
2026-10-07 14:52:22 +08:00
8 changed files with 128 additions and 117 deletions
@@ -117,9 +117,14 @@ function formatTime(value: string | number | null | undefined): string {
*/
function goodsState(g: HighValueGoods): { text: string; color: string } {
if (g.missing) return { text: '未查到该商品', color: 'default' };
return g.owned
? { text: '已兑换(价值降低)', color: 'orange' }
: { text: '可兑换', color: 'green' };
if (g.owned) {
const isLimit = g.reason?.includes('已达兑换上限');
return {
text: isLimit ? '已达上限(不可兑)' : '已兑换(价值降低)',
color: 'orange',
};
}
return { text: '可兑换', color: 'green' };
}
const goodsColumns: ColumnsType<HighValueGoods> = [
@@ -130,20 +135,26 @@ const goodsColumns: ColumnsType<HighValueGoods> = [
width: 200,
render: (name: string, g) =>
g.missing ? (
<Tooltip title={g.reason || '限兑列表和官方兑换记录里都没有它'}>
<Tooltip title={g.reason || '商品列表和官方兑换记录里都没有它'}>
<Text type="secondary">{name}</Text>
</Tooltip>
) : (
<Text strong>{name}</Text>
<Tooltip title={g.reason || undefined}>
<Text strong>{name}</Text>
</Tooltip>
),
},
{
title: '可兑换 / 已兑换',
key: 'owned',
width: 130,
width: 150,
render: (_, g) => {
const state = goodsState(g);
return <Tag color={state.color}>{state.text}</Tag>;
return (
<Tooltip title={g.reason || undefined}>
<Tag color={state.color}>{state.text}</Tag>
</Tooltip>
);
},
},
{
@@ -1260,8 +1260,10 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind })
return <Text type="secondary">{text}</Text>;
}
const count = resultNumber(latestLimitedTask.result, 'limited_count');
if (count === 0 || text === '无限制商品') return <Tag color="green">无限制商品</Tag>;
return <Text title={text}>{text}</Text>;
if (count === 0 || text === '无限制商品' || text === '无受限商品(均可兑换)') {
return <Tag color="green">未达上限</Tag>;
}
return <Tag color="orange" title={text}>{text}</Tag>;
},
},
{
@@ -333,12 +333,12 @@ export function limitedGoodsTaskText(task: DouyuTaskItem | null | undefined): st
if (task.message?.trim()) return task.message.trim();
const count = resultNumber(task.result, 'limited_count');
if (count == null) return '';
if (count <= 0) return '无限制商品';
if (count <= 0) return '无受限商品(均可兑换)';
const goods = task.result?.limited_goods;
const names = Array.isArray(goods)
? goods.map(limitedGoodsName).filter(Boolean).slice(0, 5)
: [];
return names.length ? `限兑 ${count} 个: ${names.join(', ')}` : `限兑 ${count} 个`;
return names.length ? `已达上限 ${count} 个: ${names.join(', ')}` : `已达上限 ${count} 个`;
}
export function savedPositiveInteger(key: string, fallback = 1): number {