fix(douyu): 恢复限兑商品查询展示口径
This commit is contained in:
@@ -1469,10 +1469,13 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind })
|
||||
zIndex: 1050,
|
||||
} : { display: 'none' };
|
||||
|
||||
const runContextAction = (taskType: string) => {
|
||||
const runContextAction = (
|
||||
taskType: string,
|
||||
payload: Record<string, unknown> = {},
|
||||
) => {
|
||||
if (!contextMenu) return;
|
||||
setContextMenu(null);
|
||||
void startTask(taskType, contextMenu.accountIds);
|
||||
void startTask(taskType, contextMenu.accountIds, payload);
|
||||
};
|
||||
|
||||
// ---- 电竞手册绑定面板 ----
|
||||
@@ -1891,6 +1894,14 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind })
|
||||
render: (_, record) => {
|
||||
const latest = latestTaskByAccount.get(record.id);
|
||||
if (!latest) return <Text type="secondary">暂无操作</Text>;
|
||||
const limitedGoodsView = latest.task_type === 'query_account_overview'
|
||||
&& latest.result?.view === 'limited_goods';
|
||||
const latestLabel = limitedGoodsView
|
||||
? '查询限兑商品'
|
||||
: (taskTypes[latest.task_type] || latest.task_type);
|
||||
const latestMessage = limitedGoodsView
|
||||
? limitedGoodsTaskText(latest)
|
||||
: latest.message;
|
||||
return (
|
||||
<Space direction="vertical" size={1} style={{ width: '100%' }}>
|
||||
<Space size={4} wrap>
|
||||
@@ -1898,12 +1909,12 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind })
|
||||
{TASK_STATUS_LABELS[latest.status] || latest.status}
|
||||
</Tag>
|
||||
<Text strong ellipsis style={{ maxWidth: 170 }}>
|
||||
{taskTypes[latest.task_type] || latest.task_type}
|
||||
{latestLabel}
|
||||
</Text>
|
||||
</Space>
|
||||
{latest.message ? (
|
||||
<Text type="secondary" style={{ fontSize: 12 }} ellipsis title={latest.message}>
|
||||
{latest.message}
|
||||
{latestMessage ? (
|
||||
<Text type="secondary" style={{ fontSize: 12 }} ellipsis title={latestMessage}>
|
||||
{latestMessage}
|
||||
</Text>
|
||||
) : null}
|
||||
<Text type="secondary" style={{ fontSize: 12 }}>
|
||||
@@ -2848,18 +2859,23 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind })
|
||||
size="small"
|
||||
title={contextMenu.accountIds.length > 1 ? '批量动作' : '账号动作'}
|
||||
styles={{ body: { padding: 4 } }}
|
||||
style={{ width: 200, boxShadow: '0 4px 12px rgba(0,0,0,0.12)' }}
|
||||
style={{
|
||||
width: 200,
|
||||
maxHeight: 'calc(100vh - 24px)',
|
||||
overflowY: 'auto',
|
||||
boxShadow: '0 4px 12px rgba(0,0,0,0.12)',
|
||||
}}
|
||||
>
|
||||
<Space direction="vertical" style={{ width: '100%' }}>
|
||||
{quickActions.map((item) => (
|
||||
<Button
|
||||
key={item.key} block size="small" type="text"
|
||||
icon={item.icon}
|
||||
onClick={() => runContextAction(item.key)}
|
||||
onClick={() => runContextAction(item.key, item.payload)}
|
||||
disabled={contextMenu.accountIds.some((id) => runningAccountIds.has(id))}
|
||||
style={{ justifyContent: 'flex-start' }}
|
||||
>
|
||||
{taskTypes[item.key] || item.key}
|
||||
{item.label || taskTypes[item.key] || item.key}
|
||||
</Button>
|
||||
))}
|
||||
</Space>
|
||||
|
||||
@@ -37,7 +37,14 @@ export const TASK_STATUS_LABELS: Record<string, string> = {
|
||||
stopped: '已停止',
|
||||
};
|
||||
|
||||
export const ELITE_QUICK_ACTIONS = [
|
||||
export type DouyuQuickAction = {
|
||||
key: string;
|
||||
label?: string;
|
||||
payload?: Record<string, unknown>;
|
||||
icon: ReactNode;
|
||||
};
|
||||
|
||||
export const ELITE_QUICK_ACTIONS: DouyuQuickAction[] = [
|
||||
{ key: 'get_bind_qr', icon: <QrcodeOutlined /> },
|
||||
{ key: 'confirm_bind', icon: <CheckCircleOutlined /> },
|
||||
{ key: 'query_elite_status', icon: <SearchOutlined /> },
|
||||
@@ -45,6 +52,12 @@ export const ELITE_QUICK_ACTIONS = [
|
||||
{ key: 'query_points', icon: <SearchOutlined /> },
|
||||
{ key: 'query_game_name', icon: <SearchOutlined /> },
|
||||
{ key: 'query_change_bind_time', icon: <FieldTimeOutlined /> },
|
||||
{
|
||||
key: 'query_account_overview',
|
||||
label: '查询限兑商品',
|
||||
payload: { view: 'limited_goods' },
|
||||
icon: <SearchOutlined />,
|
||||
},
|
||||
{ key: 'query_gold_balance', icon: <SearchOutlined /> },
|
||||
{ key: 'lock_goods', icon: <ShoppingOutlined /> },
|
||||
{ key: 'exchange_goods', icon: <ShoppingOutlined /> },
|
||||
@@ -52,7 +65,7 @@ export const ELITE_QUICK_ACTIONS = [
|
||||
{ key: 'donate_elite_gift', icon: <GiftOutlined /> },
|
||||
];
|
||||
|
||||
export const ESPORTS_QUICK_ACTIONS = [
|
||||
export const ESPORTS_QUICK_ACTIONS: DouyuQuickAction[] = [
|
||||
{ key: 'prepare_esports_bind', icon: <QrcodeOutlined /> },
|
||||
{ key: 'query_esports_game_name', icon: <SearchOutlined /> },
|
||||
{ key: 'create_esports_qr', icon: <CreditCardOutlined /> },
|
||||
@@ -66,7 +79,7 @@ export const ESPORTS_QUICK_ACTIONS = [
|
||||
{ key: 'donate_esports_firework_gift', icon: <GiftOutlined /> },
|
||||
];
|
||||
|
||||
export const PEACE_QUICK_ACTIONS = [
|
||||
export const PEACE_QUICK_ACTIONS: DouyuQuickAction[] = [
|
||||
{ key: 'get_xpd_bind_qr', icon: <QrcodeOutlined /> },
|
||||
{ key: 'query_xpd_bind_info', icon: <SearchOutlined /> },
|
||||
{ key: 'confirm_xpd_bind', icon: <CheckCircleOutlined /> },
|
||||
@@ -329,15 +342,16 @@ export function limitedGoodsName(item: unknown): string {
|
||||
|
||||
export function limitedGoodsTaskText(task: DouyuTaskItem | null | undefined): string {
|
||||
if (!task) return '';
|
||||
if (task.message?.trim()) return task.message.trim();
|
||||
const count = resultNumber(task.result, 'limited_count');
|
||||
if (count == null) 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} 个`;
|
||||
if (count != null) {
|
||||
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 task.message?.trim() || '';
|
||||
}
|
||||
|
||||
export function savedPositiveInteger(key: string, fallback = 1): number {
|
||||
@@ -350,7 +364,7 @@ export const HANDBOOK_META: Record<HandbookKind, {
|
||||
title: string;
|
||||
description: string;
|
||||
taskTypes: Set<string>;
|
||||
quickActions: Array<{ key: string; icon: ReactNode }>;
|
||||
quickActions: DouyuQuickAction[];
|
||||
}> = {
|
||||
elite: {
|
||||
title: '精英宝典工作台',
|
||||
|
||||
Reference in New Issue
Block a user