fix(platform): 放大兑换结果图片

This commit is contained in:
yml
2026-11-20 23:40:42 +08:00
parent 916db44b21
commit aed11961ed
2 changed files with 30 additions and 7 deletions
@@ -6,9 +6,10 @@ import { getExchangeImage } from '../utils/exchangeImage';
interface Props {
task: DouyuTaskItem;
onClick?: (task: DouyuTaskItem, url: string) => void;
variant?: 'compact' | 'detail';
}
export default function ExchangeResultImage({ task, onClick }: Props) {
export default function ExchangeResultImage({ task, onClick, variant = 'compact' }: Props) {
const [url, setUrl] = useState('');
const [failed, setFailed] = useState(false);
const [gen, setGen] = useState(0);
@@ -34,18 +35,40 @@ export default function ExchangeResultImage({ task, onClick }: Props) {
);
}
if (!url) return <Spin size="small" />;
const detail = variant === 'detail';
return (
<div
onClick={() => onClick?.(task, url)}
style={{ cursor: 'pointer', display: 'inline-block', lineHeight: 0 }}
title="点击查看大图并复制"
style={{
cursor: onClick ? 'pointer' : 'default',
display: 'inline-block',
lineHeight: 0,
width: detail ? '100%' : undefined,
textAlign: detail ? 'center' : undefined,
}}
title={onClick ? '点击查看大图并复制' : undefined}
>
<img
src={url}
width={56}
height={82}
alt="兑换结果"
style={{ objectFit: 'cover', borderRadius: 6, border: '1px solid #f0f0f0' }}
style={
detail
? {
width: '100%',
maxWidth: 320,
height: 'auto',
objectFit: 'contain',
borderRadius: 8,
border: '1px solid #f0f0f0',
}
: {
width: 56,
height: 82,
objectFit: 'cover',
borderRadius: 6,
border: '1px solid #f0f0f0',
}
}
/>
</div>
);
@@ -1348,7 +1348,7 @@ export default function PlatformFulfillmentPage() {
<QRCode value={douyuActionQrValue} size={260} />
) : null}
{douyuActionType === 'exchange_goods' && douyuActionTask.status === 'success' ? (
<ExchangeResultImage task={douyuActionTask} />
<ExchangeResultImage task={douyuActionTask} variant="detail" />
) : null}
</>
) : (