完善虎牙确认绑定与角色查询
This commit is contained in:
@@ -159,7 +159,14 @@ export default function HuyaAccountsPage() {
|
||||
dataIndex: 'game_name',
|
||||
width: 160,
|
||||
ellipsis: true,
|
||||
render: (value: string) => value || <Text type="secondary">未查</Text>,
|
||||
render: (value: string, record) => value ? (
|
||||
<Space direction="vertical" size={0}>
|
||||
<Text>{value}</Text>
|
||||
{record.game_channel ? (
|
||||
<Text type="secondary" style={{ fontSize: 12 }}>{record.game_channel}</Text>
|
||||
) : null}
|
||||
</Space>
|
||||
) : <Text type="secondary">未查</Text>,
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
|
||||
@@ -74,6 +74,12 @@ function resultText(result: Record<string, unknown> | null | undefined, key: str
|
||||
return typeof value === 'string' ? value : '';
|
||||
}
|
||||
|
||||
function resultObject(result: Record<string, unknown> | null | undefined, key: string): Record<string, unknown> | null {
|
||||
const value = result?.[key];
|
||||
if (!value || typeof value !== 'object' || Array.isArray(value)) return null;
|
||||
return value as Record<string, unknown>;
|
||||
}
|
||||
|
||||
function resultProfileNick(result: Record<string, unknown> | null | undefined): string {
|
||||
const profile = result?.profile;
|
||||
if (!profile || typeof profile !== 'object' || Array.isArray(profile)) return '';
|
||||
@@ -279,6 +285,34 @@ export default function HuyaTasksPage() {
|
||||
);
|
||||
}
|
||||
if (record.task_type === 'get_bind_qr') {
|
||||
if (value?.can_change_bind === false) {
|
||||
const changeAt = resultText(value, 'change_available_at');
|
||||
return (
|
||||
<Space size={6}>
|
||||
<Tag color="orange">不可更换</Tag>
|
||||
{changeAt ? <Text type="secondary">{changeAt}</Text> : null}
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
return <Text type="secondary">-</Text>;
|
||||
}
|
||||
if (record.task_type === 'confirm_bind') {
|
||||
if (value?.bind_confirmed === true) {
|
||||
const gameRole = resultObject(value, 'game_role');
|
||||
const roleName = typeof gameRole?.role_name === 'string' ? gameRole.role_name : '';
|
||||
return (
|
||||
<Space size={6}>
|
||||
<Tag color="green">已绑定</Tag>
|
||||
{roleName ? <Text>{roleName}</Text> : null}
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
return <Text type="secondary">-</Text>;
|
||||
}
|
||||
if (record.task_type === 'query_game_name') {
|
||||
const roleName = resultText(value, 'role_name');
|
||||
if (roleName) return <Tag color="blue">{roleName}</Tag>;
|
||||
if (value?.is_bound === false) return <Tag>未绑定</Tag>;
|
||||
return <Text type="secondary">-</Text>;
|
||||
}
|
||||
|
||||
@@ -558,18 +592,27 @@ export default function HuyaTasksPage() {
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 12, padding: '8px 0 12px' }}>
|
||||
<Text strong style={{ maxWidth: '100%', textAlign: 'center' }}>{qrAccountName}</Text>
|
||||
{qrImage ? (
|
||||
<img
|
||||
src={qrImage}
|
||||
alt="绑定小程序码"
|
||||
<div
|
||||
style={{
|
||||
width: 260,
|
||||
height: 260,
|
||||
objectFit: 'contain',
|
||||
display: 'block',
|
||||
borderRadius: 8,
|
||||
background: token.colorBgContainer,
|
||||
padding: 14,
|
||||
borderRadius: 10,
|
||||
background: '#fff',
|
||||
lineHeight: 0,
|
||||
}}
|
||||
/>
|
||||
>
|
||||
<img
|
||||
src={qrImage}
|
||||
alt="绑定小程序码"
|
||||
style={{
|
||||
width: 260,
|
||||
height: 260,
|
||||
objectFit: 'contain',
|
||||
display: 'block',
|
||||
borderRadius: 4,
|
||||
background: '#fff',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<Text type="secondary">暂无二维码</Text>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user