feat: 1.统一右侧抽屉关闭按钮布局 2.统一 UI 组件为 Ant Design 移除 radix-ui、floating-ui 组件 3. 修复 ESLint 文件格式错误的问题
This commit is contained in:
+133
-139
@@ -342,158 +342,152 @@ const Subscription = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const columns = useMemo(() => {
|
||||
return [
|
||||
{ title: 'ID', dataIndex: 'id', width: 70 },
|
||||
{
|
||||
title: t('用户'),
|
||||
width: 180,
|
||||
render: (_, r) => {
|
||||
const display = r.display_name || '';
|
||||
const username = r.username || '';
|
||||
return (
|
||||
<div className='flex flex-col'>
|
||||
<span className='font-medium'>
|
||||
{display || username || `User#${r.user_id}`}
|
||||
</span>
|
||||
<span className='text-xs text-gray-400'>
|
||||
#{r.user_id}
|
||||
{username ? ` @${username}` : ''}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: t('套餐'),
|
||||
width: 180,
|
||||
render: (_, r) => (
|
||||
<Space spacing={4} wrap>
|
||||
<Tag color={planTypeColorMap[r.plan_type] || 'grey'} size='small'>
|
||||
{r.plan_name || r.plan_type}
|
||||
</Tag>
|
||||
{r.tier ? (
|
||||
<Tag
|
||||
color={tierColorMap[r.tier] || 'grey'}
|
||||
size='small'
|
||||
type='ghost'
|
||||
>
|
||||
{r.tier}
|
||||
</Tag>
|
||||
) : null}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
dataIndex: 'status',
|
||||
width: 90,
|
||||
render: (s) => (
|
||||
<Tag color={statusColorMap[s] || 'grey'}>{t(s || '未知')}</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('起始时间'),
|
||||
dataIndex: 'start_date',
|
||||
width: 110,
|
||||
render: formatDateOnly,
|
||||
},
|
||||
{
|
||||
title: t('到期时间'),
|
||||
width: 160,
|
||||
render: (_, r) => (
|
||||
const columns = [
|
||||
{ title: 'ID', dataIndex: 'id', width: 70 },
|
||||
{
|
||||
title: t('用户'),
|
||||
width: 180,
|
||||
render: (_, r) => {
|
||||
const display = r.display_name || '';
|
||||
const username = r.username || '';
|
||||
return (
|
||||
<div className='flex flex-col'>
|
||||
<span>{formatDateOnly(r.end_date)}</span>
|
||||
<RemainingTag endDate={r.end_date} status={r.status} t={t} />
|
||||
<span className='font-medium'>
|
||||
{display || username || `User#${r.user_id}`}
|
||||
</span>
|
||||
<span className='text-xs text-gray-400'>
|
||||
#{r.user_id}
|
||||
{username ? ` @${username}` : ''}
|
||||
</span>
|
||||
</div>
|
||||
),
|
||||
);
|
||||
},
|
||||
{
|
||||
title: t('每日额度'),
|
||||
dataIndex: 'daily_quota',
|
||||
width: 110,
|
||||
render: (v) => renderQuota(v, 2),
|
||||
},
|
||||
{
|
||||
title: t('支付金额'),
|
||||
dataIndex: 'price_paid',
|
||||
width: 100,
|
||||
render: (v) => (v != null ? `¥${Number(v).toFixed(2)}` : '-'),
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
width: 300,
|
||||
fixed: 'right',
|
||||
render: (_, r) => (
|
||||
<Space spacing={4} wrap>
|
||||
},
|
||||
{
|
||||
title: t('套餐'),
|
||||
width: 180,
|
||||
render: (_, r) => (
|
||||
<Space spacing={4} wrap>
|
||||
<Tag color={planTypeColorMap[r.plan_type] || 'grey'} size='small'>
|
||||
{r.plan_name || r.plan_type}
|
||||
</Tag>
|
||||
{r.tier ? (
|
||||
<Tag
|
||||
color={tierColorMap[r.tier] || 'grey'}
|
||||
size='small'
|
||||
type='ghost'
|
||||
>
|
||||
{r.tier}
|
||||
</Tag>
|
||||
) : null}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('状态'),
|
||||
dataIndex: 'status',
|
||||
width: 90,
|
||||
render: (s) => (
|
||||
<Tag color={statusColorMap[s] || 'grey'}>{t(s || '未知')}</Tag>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('起始时间'),
|
||||
dataIndex: 'start_date',
|
||||
width: 110,
|
||||
render: formatDateOnly,
|
||||
},
|
||||
{
|
||||
title: t('到期时间'),
|
||||
width: 160,
|
||||
render: (_, r) => (
|
||||
<div className='flex flex-col'>
|
||||
<span>{formatDateOnly(r.end_date)}</span>
|
||||
<RemainingTag endDate={r.end_date} status={r.status} t={t} />
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: t('每日额度'),
|
||||
dataIndex: 'daily_quota',
|
||||
width: 110,
|
||||
render: (v) => renderQuota(v, 2),
|
||||
},
|
||||
{
|
||||
title: t('支付金额'),
|
||||
dataIndex: 'price_paid',
|
||||
width: 100,
|
||||
render: (v) => (v != null ? `¥${Number(v).toFixed(2)}` : '-'),
|
||||
},
|
||||
{
|
||||
title: t('操作'),
|
||||
width: 300,
|
||||
fixed: 'right',
|
||||
render: (_, r) => (
|
||||
<Space spacing={4} wrap>
|
||||
<Button size='small' theme='borderless' onClick={() => openDetail(r)}>
|
||||
{t('详情')}
|
||||
</Button>
|
||||
{admin && r.status !== 'banned' && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
onClick={() => openDetail(r)}
|
||||
type='danger'
|
||||
icon={<Ban size={12} />}
|
||||
onClick={() => openBan(r)}
|
||||
>
|
||||
{t('详情')}
|
||||
{t('封禁')}
|
||||
</Button>
|
||||
{admin && r.status !== 'banned' && (
|
||||
)}
|
||||
{admin && r.status === 'banned' && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='primary'
|
||||
icon={<ShieldCheck size={12} />}
|
||||
onClick={() => openUnban(r)}
|
||||
>
|
||||
{t('解封')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && r.status !== 'canceled' && r.status !== 'banned' && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<CalendarClock size={12} />}
|
||||
onClick={() => openExtend(r)}
|
||||
>
|
||||
{t('延长')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<Pencil size={12} />}
|
||||
onClick={() => openEdit(r)}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && r.status === 'active' && (
|
||||
<Popconfirm
|
||||
title={t('确认手动补发今日额度?')}
|
||||
onConfirm={() => doGrant(r)}
|
||||
>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='danger'
|
||||
icon={<Ban size={12} />}
|
||||
onClick={() => openBan(r)}
|
||||
icon={<Sparkles size={12} />}
|
||||
>
|
||||
{t('封禁')}
|
||||
{t('补发')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && r.status === 'banned' && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
type='primary'
|
||||
icon={<ShieldCheck size={12} />}
|
||||
onClick={() => openUnban(r)}
|
||||
>
|
||||
{t('解封')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && r.status !== 'canceled' && r.status !== 'banned' && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<CalendarClock size={12} />}
|
||||
onClick={() => openExtend(r)}
|
||||
>
|
||||
{t('延长')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && (
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<Pencil size={12} />}
|
||||
onClick={() => openEdit(r)}
|
||||
>
|
||||
{t('编辑')}
|
||||
</Button>
|
||||
)}
|
||||
{admin && r.status === 'active' && (
|
||||
<Popconfirm
|
||||
title={t('确认手动补发今日额度?')}
|
||||
onConfirm={() => doGrant(r)}
|
||||
>
|
||||
<Button
|
||||
size='small'
|
||||
theme='borderless'
|
||||
icon={<Sparkles size={12} />}
|
||||
>
|
||||
{t('补发')}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
)}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
}, [t, admin]);
|
||||
</Popconfirm>
|
||||
)}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className='console-content'>
|
||||
|
||||
Reference in New Issue
Block a user