修复 antd 弃用警告

This commit is contained in:
yml2213
2026-07-24 12:48:02 +08:00
parent a13dde57dd
commit 6840728da6
17 changed files with 225 additions and 138 deletions
+46 -39
View File
@@ -1,7 +1,8 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import {
Button, Card, Col, DatePicker, Dropdown, Form, Input, InputNumber, message, Modal, QRCode, Radio, Row, Select, Space, Table, Tag, Tooltip, Typography, theme,
Button, Card, Col, DatePicker, Dropdown, Form, Input, InputNumber, Modal, QRCode, Radio, Row, Select, Space, Table, Tag, Tooltip, Typography, theme,
} from 'antd';
import { message } from '../utils/antdMessage';
import type { MenuProps, TableProps } from 'antd';
import type { Dayjs } from 'dayjs';
import type { MouseEvent as ReactMouseEvent } from 'react';
@@ -1164,7 +1165,7 @@ export default function HuyaTasksPage() {
title: '虎牙 CK',
width: 250,
render: (_: unknown, record) => (
<Space direction="vertical" size={1} style={{ width: '100%' }}>
<Space orientation="vertical" size={1} style={{ width: '100%' }}>
<Space size={6} wrap>
<Text strong>{accountDisplayName(record)}</Text>
{record.tag ? <Tag color={tagColorMap[record.tag]}>{record.tag}</Tag> : null}
@@ -1191,7 +1192,7 @@ export default function HuyaTasksPage() {
width: 170,
ellipsis: true,
render: (value: string, record) => value ? (
<Space direction="vertical" size={0}>
<Space orientation="vertical" size={0}>
<Text>{value}</Text>
{record.game_channel ? <Text type="secondary" style={{ fontSize: 12 }}>{record.game_channel}</Text> : null}
</Space>
@@ -1214,7 +1215,7 @@ export default function HuyaTasksPage() {
const product = taskProductText(task);
if (!task || !product) return <Text type="secondary">-</Text>;
return (
<Space direction="vertical" size={1}>
<Space orientation="vertical" size={1}>
<Text ellipsis style={{ maxWidth: 170 }}>{product}</Text>
<Tag color={STATUS_COLORS[task.status] || 'default'} style={{ width: 'fit-content' }}>
{taskTypes[task.task_type] || task.task_type}
@@ -1250,7 +1251,7 @@ export default function HuyaTasksPage() {
const latest = latestTaskByAccount.get(record.id);
if (!latest) return <Text type="secondary"></Text>;
return (
<Space direction="vertical" size={2} style={{ width: '100%' }}>
<Space orientation="vertical" size={2} style={{ width: '100%' }}>
<Text ellipsis style={{ maxWidth: 238 }}>
{taskTypes[latest.task_type] || latest.task_type}{latest.message || '-'}
</Text>
@@ -1294,7 +1295,7 @@ export default function HuyaTasksPage() {
title: '虎牙 CK',
width: 230,
render: (_: unknown, record) => (
<Space direction="vertical" size={1}>
<Space orientation="vertical" size={1}>
<Space size={6} wrap>
<Text strong>{accountDisplayName(record)}</Text>
{record.tag ? <Tag color={tagColorMap[record.tag]}>{record.tag}</Tag> : null}
@@ -1315,7 +1316,7 @@ export default function HuyaTasksPage() {
dataIndex: 'game_name',
ellipsis: true,
render: (value: string, record) => value ? (
<Space direction="vertical" size={0}>
<Space orientation="vertical" size={0}>
<Text>{value}</Text>
{record.game_channel ? <Text type="secondary" style={{ fontSize: 12 }}>{record.game_channel}</Text> : null}
</Space>
@@ -1482,7 +1483,7 @@ export default function HuyaTasksPage() {
{accountContextMenu.accountIds.length > 1 ? '右键批量动作' : '右键账号动作'}
</Text>
</div>
<Space direction="vertical" size={2} style={{ width: '100%' }}>
<Space orientation="vertical" size={2} style={{ width: '100%' }}>
{QUICK_ACTIONS.map((item) => (
<Button
key={item.key}
@@ -1626,17 +1627,19 @@ export default function HuyaTasksPage() {
</div>
<div style={{ minHeight: 0, overflowY: 'auto', overflowX: 'hidden' }}>
<Space direction="vertical" size={12} style={{ width: '100%' }}>
<Space orientation="vertical" size={12} style={{ width: '100%' }}>
<Card size="small" title="批量动作" extra={<Tag color={selectedIds.length ? 'blue' : 'default'}>{selectedAccountText}</Tag>}>
<Space direction="vertical" size={10} style={{ width: '100%' }}>
<InputNumber
min={1}
max={10}
value={concurrency}
onChange={(value) => setConcurrency(value || 1)}
addonBefore="并发"
style={{ width: '100%' }}
/>
<Space orientation="vertical" size={10} style={{ width: '100%' }}>
<Space.Compact style={{ width: '100%' }}>
<Button disabled></Button>
<InputNumber
min={1}
max={10}
value={concurrency}
onChange={(value) => setConcurrency(value || 1)}
style={{ width: '100%' }}
/>
</Space.Compact>
<Select
value={selectedTaskType}
onChange={setSelectedTaskType}
@@ -1685,7 +1688,7 @@ export default function HuyaTasksPage() {
</Button>
)}
>
<Space direction="vertical" size={10} style={{ width: '100%' }}>
<Space orientation="vertical" size={10} style={{ width: '100%' }}>
{goodsCategories.length > 0 ? (
<Select
value={selectedGoodsCategory}
@@ -1707,12 +1710,14 @@ export default function HuyaTasksPage() {
style={{ width: '100%' }}
filterOption={(input, option) => String(option?.label || '').toLowerCase().includes(input.toLowerCase())}
/>
<Input
addonBefore="PID"
value={selectedExchangeGoodsId}
onChange={(event) => setSelectedExchangeGoodsId(event.target.value.trim())}
placeholder="商品 PID"
/>
<Space.Compact style={{ width: '100%' }}>
<Button disabled>PID</Button>
<Input
value={selectedExchangeGoodsId}
onChange={(event) => setSelectedExchangeGoodsId(event.target.value.trim())}
placeholder="商品 PID"
/>
</Space.Compact>
<DatePicker
showTime
allowClear
@@ -1747,7 +1752,7 @@ export default function HuyaTasksPage() {
</Button>
)}
>
<Space direction="vertical" size={10} style={{ width: '100%' }}>
<Space orientation="vertical" size={10} style={{ width: '100%' }}>
<Select
showSearch
allowClear
@@ -1758,14 +1763,16 @@ export default function HuyaTasksPage() {
style={{ width: '100%' }}
filterOption={(input, option) => String(option?.label || '').toLowerCase().includes(input.toLowerCase())}
/>
<InputNumber
min={1}
max={999}
value={rechargeCount}
onChange={(value) => setRechargeCount(value || 1)}
addonAfter="份"
style={{ width: '100%' }}
/>
<Space.Compact style={{ width: '100%' }}>
<InputNumber
min={1}
max={999}
value={rechargeCount}
onChange={(value) => setRechargeCount(value || 1)}
style={{ width: '100%' }}
/>
<Button disabled></Button>
</Space.Compact>
<Radio.Group value={rechargePayChannel} onChange={(event) => setRechargePayChannel(event.target.value)}>
<Radio value="Weixin"></Radio>
<Radio value="Zfb"></Radio>
@@ -1862,7 +1869,7 @@ export default function HuyaTasksPage() {
]}
width={860}
>
<Space direction="vertical" size={10} style={{ width: '100%' }}>
<Space orientation="vertical" size={10} style={{ width: '100%' }}>
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap', alignItems: 'center' }}>
<Input.Search
allowClear
@@ -1919,7 +1926,7 @@ export default function HuyaTasksPage() {
footer={null}
width={760}
>
<Space direction="vertical" size={10} style={{ width: '100%' }}>
<Space orientation="vertical" size={10} style={{ width: '100%' }}>
<Text type="secondary">
{exchangeRecordsAccountName}{exchangeRecordsResult?.sid ? ` / SID ${String(exchangeRecordsResult.sid)}` : ''}
</Text>
@@ -1944,7 +1951,7 @@ export default function HuyaTasksPage() {
>
{qrTask && (
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 12, padding: '8px 0 12px' }}>
<Space direction="vertical" size={4} style={{ width: '100%', textAlign: 'center' }}>
<Space orientation="vertical" size={4} style={{ width: '100%', textAlign: 'center' }}>
<Text strong>{qrAccountName}</Text>
<Tag
color={qrBindReady ? 'gold' : qrBindPhase === 'role_timeout' || qrQueryFinished ? 'orange' : 'processing'}
@@ -1979,7 +1986,7 @@ export default function HuyaTasksPage() {
<Text type="secondary"></Text>
)}
{qrRoleLine ? (
<Space direction="vertical" size={2} style={{ width: '100%', textAlign: 'center' }}>
<Space orientation="vertical" size={2} style={{ width: '100%', textAlign: 'center' }}>
{qrGameTitle ? <Text type="secondary">{qrGameTitle}</Text> : null}
<Text strong>{qrRoleLine}</Text>
</Space>
@@ -2017,7 +2024,7 @@ export default function HuyaTasksPage() {
>
{payTask && (
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 12, padding: '8px 0 12px' }}>
<Space direction="vertical" size={2} style={{ width: '100%', textAlign: 'center' }}>
<Space orientation="vertical" size={2} style={{ width: '100%', textAlign: 'center' }}>
<Text strong>{payProductName || '充值商品'}</Text>
<Text type="secondary">
{payChannelLabel || '支付'}{payAmountText ? ` / ${payAmountText}` : ''}{payAccountName ? ` / ${payAccountName}` : ''}