2025-06-29 02:32:09 +08:00
|
|
|
|
import React, { useEffect, useState } from 'react';
|
2024-03-23 21:24:39 +08:00
|
|
|
|
import {
|
|
|
|
|
|
API,
|
|
|
|
|
|
copy,
|
|
|
|
|
|
showError,
|
|
|
|
|
|
showSuccess,
|
|
|
|
|
|
timestamp2string,
|
2025-06-03 23:56:39 +08:00
|
|
|
|
renderGroup,
|
✨ feat: Add lucide-react icons to all table Tag components
- Add semantic icons to ChannelsTable.js for channel status, response time, and quota display
- Add status and quota icons to TokensTable.js for better visual distinction
- Add status and quota icons to RedemptionsTable.js for redemption code management
- Add role, status, and statistics icons to UsersTable.js for user management
- Import appropriate lucide-react icons for each table component
- Enhance UI consistency and user experience across all table interfaces
Icons added include:
- Status indicators: CheckCircle, XCircle, AlertCircle, HelpCircle
- Performance metrics: Zap, Timer, Clock, AlertTriangle, TestTube
- Financial data: Coins, DollarSign
- User roles: User, Shield, Crown
- Activity tracking: Activity, Users, UserPlus
This improves visual clarity and makes table data more intuitive to understand.
2025-06-08 23:13:45 +08:00
|
|
|
|
renderQuota,
|
2025-07-12 03:35:19 +08:00
|
|
|
|
getModelCategories
|
2025-06-04 00:42:06 +08:00
|
|
|
|
} from '../../helpers';
|
|
|
|
|
|
import { ITEMS_PER_PAGE } from '../../constants';
|
2024-03-23 21:24:39 +08:00
|
|
|
|
import {
|
2025-04-04 12:00:38 +08:00
|
|
|
|
Button,
|
2025-05-23 00:24:08 +08:00
|
|
|
|
Card,
|
2025-06-13 14:11:39 +08:00
|
|
|
|
Divider,
|
2024-03-23 21:24:39 +08:00
|
|
|
|
Dropdown,
|
2025-06-08 23:42:39 +08:00
|
|
|
|
Empty,
|
2025-06-08 18:41:04 +08:00
|
|
|
|
Form,
|
2024-03-23 21:24:39 +08:00
|
|
|
|
Modal,
|
2025-04-04 12:00:38 +08:00
|
|
|
|
Space,
|
2024-03-23 21:24:39 +08:00
|
|
|
|
SplitButtonGroup,
|
|
|
|
|
|
Table,
|
2025-06-13 14:11:39 +08:00
|
|
|
|
Tag,
|
2025-07-12 03:35:19 +08:00
|
|
|
|
AvatarGroup,
|
|
|
|
|
|
Avatar,
|
|
|
|
|
|
Tooltip,
|
|
|
|
|
|
Progress,
|
|
|
|
|
|
Switch,
|
|
|
|
|
|
Input,
|
2025-06-13 14:11:39 +08:00
|
|
|
|
Typography
|
2024-03-23 21:24:39 +08:00
|
|
|
|
} from '@douyinfe/semi-ui';
|
2025-06-08 23:42:39 +08:00
|
|
|
|
import {
|
|
|
|
|
|
IllustrationNoResult,
|
|
|
|
|
|
IllustrationNoResultDark
|
|
|
|
|
|
} from '@douyinfe/semi-illustrations';
|
2025-05-23 00:24:08 +08:00
|
|
|
|
import {
|
|
|
|
|
|
IconSearch,
|
|
|
|
|
|
IconTreeTriangleDown,
|
2025-07-12 03:35:19 +08:00
|
|
|
|
IconCopy,
|
|
|
|
|
|
IconEyeOpened,
|
|
|
|
|
|
IconEyeClosed,
|
2025-05-23 00:24:08 +08:00
|
|
|
|
} from '@douyinfe/semi-icons';
|
2025-06-29 02:32:09 +08:00
|
|
|
|
import { Key } from 'lucide-react';
|
2025-06-04 00:42:06 +08:00
|
|
|
|
import EditToken from '../../pages/Token/EditToken';
|
2024-12-13 19:03:14 +08:00
|
|
|
|
import { useTranslation } from 'react-i18next';
|
2025-06-22 18:10:00 +08:00
|
|
|
|
import { useTableCompactMode } from '../../hooks/useTableCompactMode';
|
2025-05-23 00:24:08 +08:00
|
|
|
|
|
2025-06-13 14:11:39 +08:00
|
|
|
|
const { Text } = Typography;
|
|
|
|
|
|
|
2023-04-23 12:43:10 +08:00
|
|
|
|
function renderTimestamp(timestamp) {
|
2024-03-23 21:24:39 +08:00
|
|
|
|
return <>{timestamp2string(timestamp)}</>;
|
2023-04-23 11:31:00 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-12-13 19:03:14 +08:00
|
|
|
|
const TokensTable = () => {
|
|
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
const columns = [
|
|
|
|
|
|
{
|
2024-12-13 19:03:14 +08:00
|
|
|
|
title: t('名称'),
|
2024-03-23 21:24:39 +08:00
|
|
|
|
dataIndex: 'name',
|
2024-03-15 16:05:33 +08:00
|
|
|
|
},
|
2025-07-13 17:45:31 +08:00
|
|
|
|
{
|
2025-07-13 18:10:59 +08:00
|
|
|
|
title: t('余额'),
|
2025-07-13 17:45:31 +08:00
|
|
|
|
key: 'quota',
|
|
|
|
|
|
render: (text, record) => {
|
|
|
|
|
|
if (record.unlimited_quota) {
|
|
|
|
|
|
return <Tag color='white' shape='circle'>{t('无限制')}</Tag>;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const used = parseInt(record.used_quota) || 0;
|
|
|
|
|
|
const remain = parseInt(record.remain_quota) || 0;
|
|
|
|
|
|
const total = used + remain;
|
|
|
|
|
|
const percent = total > 0 ? (remain / total) * 100 : 0;
|
|
|
|
|
|
|
|
|
|
|
|
const getProgressColor = (pct) => {
|
|
|
|
|
|
if (pct === 100) return 'var(--semi-color-success)';
|
|
|
|
|
|
if (pct <= 10) return 'var(--semi-color-danger)';
|
|
|
|
|
|
if (pct <= 30) return 'var(--semi-color-warning)';
|
2025-07-13 18:10:59 +08:00
|
|
|
|
return undefined;
|
2025-07-13 17:45:31 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<Tooltip
|
|
|
|
|
|
content={
|
|
|
|
|
|
<div className='text-xs'>
|
|
|
|
|
|
<div>{t('已用额度')}: {renderQuota(used)}</div>
|
|
|
|
|
|
<div>{t('剩余额度')}: {renderQuota(remain)} ({percent.toFixed(0)}%)</div>
|
|
|
|
|
|
<div>{t('总额度')}: {renderQuota(total)}</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
2025-07-13 18:10:59 +08:00
|
|
|
|
<div className='w-[140px]'>
|
2025-07-13 17:45:31 +08:00
|
|
|
|
<Progress
|
|
|
|
|
|
percent={percent}
|
|
|
|
|
|
stroke={getProgressColor(percent)}
|
2025-07-13 18:10:59 +08:00
|
|
|
|
showInfo
|
2025-07-13 17:45:31 +08:00
|
|
|
|
aria-label='quota usage'
|
2025-07-13 18:10:59 +08:00
|
|
|
|
format={() => `${percent.toFixed(0)}%`}
|
2025-07-13 17:45:31 +08:00
|
|
|
|
size='small'
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2024-03-15 16:05:33 +08:00
|
|
|
|
{
|
2024-12-13 19:03:14 +08:00
|
|
|
|
title: t('状态'),
|
2024-03-15 16:05:33 +08:00
|
|
|
|
dataIndex: 'status',
|
|
|
|
|
|
key: 'status',
|
2025-07-12 03:35:19 +08:00
|
|
|
|
render: (text, record) => {
|
|
|
|
|
|
const enabled = text === 1;
|
|
|
|
|
|
const handleToggle = (checked) => {
|
|
|
|
|
|
if (checked) {
|
|
|
|
|
|
manageToken(record.id, 'enable', record);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
manageToken(record.id, 'disable', record);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let tagColor = 'black';
|
|
|
|
|
|
let tagText = t('未知状态');
|
|
|
|
|
|
if (enabled) {
|
|
|
|
|
|
tagColor = 'green';
|
|
|
|
|
|
tagText = t('已启用');
|
|
|
|
|
|
} else if (text === 2) {
|
|
|
|
|
|
tagColor = 'red';
|
|
|
|
|
|
tagText = t('已禁用');
|
|
|
|
|
|
} else if (text === 3) {
|
|
|
|
|
|
tagColor = 'yellow';
|
|
|
|
|
|
tagText = t('已过期');
|
|
|
|
|
|
} else if (text === 4) {
|
|
|
|
|
|
tagColor = 'grey';
|
|
|
|
|
|
tagText = t('已耗尽');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-04 12:00:38 +08:00
|
|
|
|
return (
|
2025-07-12 03:35:19 +08:00
|
|
|
|
<Tag
|
|
|
|
|
|
color={tagColor}
|
|
|
|
|
|
shape='circle'
|
2025-07-13 18:10:59 +08:00
|
|
|
|
suffixIcon={
|
2025-07-12 03:35:19 +08:00
|
|
|
|
<Switch
|
|
|
|
|
|
size='small'
|
|
|
|
|
|
checked={enabled}
|
|
|
|
|
|
onChange={handleToggle}
|
|
|
|
|
|
aria-label='token status switch'
|
|
|
|
|
|
/>
|
|
|
|
|
|
}
|
|
|
|
|
|
>
|
|
|
|
|
|
{tagText}
|
|
|
|
|
|
</Tag>
|
2025-04-04 12:00:38 +08:00
|
|
|
|
);
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
2024-03-15 16:05:33 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2025-07-12 03:35:19 +08:00
|
|
|
|
title: t('分组'),
|
|
|
|
|
|
dataIndex: 'group',
|
|
|
|
|
|
key: 'group',
|
|
|
|
|
|
render: (text) => {
|
|
|
|
|
|
if (text === 'auto') {
|
|
|
|
|
|
return (
|
|
|
|
|
|
<Tooltip
|
|
|
|
|
|
content={t('当前分组为 auto,会自动选择最优分组,当一个组不可用时自动降级到下一个组(熔断机制)')}
|
|
|
|
|
|
position='top'
|
|
|
|
|
|
>
|
2025-07-13 18:10:59 +08:00
|
|
|
|
<Tag color='white' shape='circle'> {t('智能熔断')} </Tag>
|
2025-07-12 03:35:19 +08:00
|
|
|
|
</Tooltip>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
return renderGroup(text);
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: t('密钥'),
|
|
|
|
|
|
key: 'token_key',
|
|
|
|
|
|
render: (text, record) => {
|
|
|
|
|
|
const fullKey = 'sk-' + record.key;
|
2025-07-13 01:02:55 +08:00
|
|
|
|
const maskedKey = 'sk-' + record.key.slice(0, 4) + '**********' + record.key.slice(-4);
|
2025-07-12 03:35:19 +08:00
|
|
|
|
const revealed = !!showKeys[record.id];
|
|
|
|
|
|
|
✨ feat: Add lucide-react icons to all table Tag components
- Add semantic icons to ChannelsTable.js for channel status, response time, and quota display
- Add status and quota icons to TokensTable.js for better visual distinction
- Add status and quota icons to RedemptionsTable.js for redemption code management
- Add role, status, and statistics icons to UsersTable.js for user management
- Import appropriate lucide-react icons for each table component
- Enhance UI consistency and user experience across all table interfaces
Icons added include:
- Status indicators: CheckCircle, XCircle, AlertCircle, HelpCircle
- Performance metrics: Zap, Timer, Clock, AlertTriangle, TestTube
- Financial data: Coins, DollarSign
- User roles: User, Shield, Crown
- Activity tracking: Activity, Users, UserPlus
This improves visual clarity and makes table data more intuitive to understand.
2025-06-08 23:13:45 +08:00
|
|
|
|
return (
|
2025-07-12 03:35:19 +08:00
|
|
|
|
<div className='w-[200px]'>
|
|
|
|
|
|
<Input
|
|
|
|
|
|
readOnly
|
|
|
|
|
|
value={revealed ? fullKey : maskedKey}
|
|
|
|
|
|
size='small'
|
|
|
|
|
|
suffix={
|
|
|
|
|
|
<div className='flex items-center'>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
theme='borderless'
|
|
|
|
|
|
size='small'
|
|
|
|
|
|
type='tertiary'
|
|
|
|
|
|
icon={revealed ? <IconEyeClosed /> : <IconEyeOpened />}
|
|
|
|
|
|
aria-label='toggle token visibility'
|
|
|
|
|
|
onClick={(e) => {
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
setShowKeys(prev => ({ ...prev, [record.id]: !revealed }));
|
|
|
|
|
|
}}
|
|
|
|
|
|
/>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
theme='borderless'
|
|
|
|
|
|
size='small'
|
|
|
|
|
|
type='tertiary'
|
|
|
|
|
|
icon={<IconCopy />}
|
|
|
|
|
|
aria-label='copy token key'
|
|
|
|
|
|
onClick={async (e) => {
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
await copyText(fullKey);
|
|
|
|
|
|
}}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
}
|
|
|
|
|
|
/>
|
✨ feat: Add lucide-react icons to all table Tag components
- Add semantic icons to ChannelsTable.js for channel status, response time, and quota display
- Add status and quota icons to TokensTable.js for better visual distinction
- Add status and quota icons to RedemptionsTable.js for redemption code management
- Add role, status, and statistics icons to UsersTable.js for user management
- Import appropriate lucide-react icons for each table component
- Enhance UI consistency and user experience across all table interfaces
Icons added include:
- Status indicators: CheckCircle, XCircle, AlertCircle, HelpCircle
- Performance metrics: Zap, Timer, Clock, AlertTriangle, TestTube
- Financial data: Coins, DollarSign
- User roles: User, Shield, Crown
- Activity tracking: Activity, Users, UserPlus
This improves visual clarity and makes table data more intuitive to understand.
2025-06-08 23:13:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
);
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
2024-03-15 16:05:33 +08:00
|
|
|
|
},
|
2025-07-12 03:35:19 +08:00
|
|
|
|
{
|
|
|
|
|
|
title: t('可用模型'),
|
|
|
|
|
|
dataIndex: 'model_limits',
|
|
|
|
|
|
render: (text, record) => {
|
|
|
|
|
|
if (record.model_limits_enabled && text) {
|
|
|
|
|
|
const models = text.split(',').filter(Boolean);
|
|
|
|
|
|
const categories = getModelCategories(t);
|
|
|
|
|
|
|
|
|
|
|
|
const vendorAvatars = [];
|
2025-07-13 17:24:55 +08:00
|
|
|
|
const matchedModels = new Set();
|
2025-07-12 03:35:19 +08:00
|
|
|
|
Object.entries(categories).forEach(([key, category]) => {
|
|
|
|
|
|
if (key === 'all') return;
|
|
|
|
|
|
if (!category.icon || !category.filter) return;
|
|
|
|
|
|
const vendorModels = models.filter((m) => category.filter({ model_name: m }));
|
|
|
|
|
|
if (vendorModels.length > 0) {
|
|
|
|
|
|
vendorAvatars.push(
|
|
|
|
|
|
<Tooltip key={key} content={vendorModels.join(', ')} position='top' showArrow>
|
|
|
|
|
|
<Avatar size='extra-extra-small' alt={category.label} color='transparent'>
|
|
|
|
|
|
{category.icon}
|
|
|
|
|
|
</Avatar>
|
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|
);
|
2025-07-13 17:24:55 +08:00
|
|
|
|
vendorModels.forEach((m) => matchedModels.add(m));
|
2025-07-12 03:35:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2025-07-13 17:24:55 +08:00
|
|
|
|
const unmatchedModels = models.filter((m) => !matchedModels.has(m));
|
|
|
|
|
|
if (unmatchedModels.length > 0) {
|
2025-07-12 03:35:19 +08:00
|
|
|
|
vendorAvatars.push(
|
2025-07-13 17:24:55 +08:00
|
|
|
|
<Tooltip key='unknown' content={unmatchedModels.join(', ')} position='top' showArrow>
|
|
|
|
|
|
<Avatar size='extra-extra-small' alt='unknown'>
|
|
|
|
|
|
{t('其他')}
|
2025-07-12 03:35:19 +08:00
|
|
|
|
</Avatar>
|
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
<AvatarGroup size='extra-extra-small'>
|
|
|
|
|
|
{vendorAvatars}
|
|
|
|
|
|
</AvatarGroup>
|
|
|
|
|
|
);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return (
|
|
|
|
|
|
<Tag color='white' shape='circle'>
|
|
|
|
|
|
{t('无限制')}
|
|
|
|
|
|
</Tag>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: t('IP限制'),
|
|
|
|
|
|
dataIndex: 'allow_ips',
|
|
|
|
|
|
render: (text) => {
|
|
|
|
|
|
if (!text || text.trim() === '') {
|
|
|
|
|
|
return (
|
|
|
|
|
|
<Tag color='white' shape='circle'>
|
|
|
|
|
|
{t('无限制')}
|
|
|
|
|
|
</Tag>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const ips = text
|
|
|
|
|
|
.split('\n')
|
|
|
|
|
|
.map((ip) => ip.trim())
|
|
|
|
|
|
.filter(Boolean);
|
|
|
|
|
|
|
|
|
|
|
|
const displayIps = ips.slice(0, 1);
|
|
|
|
|
|
const extraCount = ips.length - displayIps.length;
|
|
|
|
|
|
|
|
|
|
|
|
const ipTags = displayIps.map((ip, idx) => (
|
|
|
|
|
|
<Tag key={idx} shape='circle'>
|
|
|
|
|
|
{ip}
|
|
|
|
|
|
</Tag>
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
|
|
if (extraCount > 0) {
|
|
|
|
|
|
ipTags.push(
|
|
|
|
|
|
<Tooltip
|
|
|
|
|
|
key='extra'
|
2025-07-12 03:48:55 +08:00
|
|
|
|
content={ips.slice(1).join(', ')}
|
2025-07-12 03:35:19 +08:00
|
|
|
|
position='top'
|
|
|
|
|
|
showArrow
|
|
|
|
|
|
>
|
|
|
|
|
|
<Tag shape='circle'>
|
|
|
|
|
|
{'+' + extraCount}
|
|
|
|
|
|
</Tag>
|
|
|
|
|
|
</Tooltip>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return <Space wrap>{ipTags}</Space>;
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2024-03-15 16:05:33 +08:00
|
|
|
|
{
|
2024-12-13 19:03:14 +08:00
|
|
|
|
title: t('创建时间'),
|
2024-03-15 16:05:33 +08:00
|
|
|
|
dataIndex: 'created_time',
|
|
|
|
|
|
render: (text, record, index) => {
|
2024-03-23 21:24:39 +08:00
|
|
|
|
return <div>{renderTimestamp(text)}</div>;
|
|
|
|
|
|
},
|
2024-03-15 16:05:33 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
2024-12-13 19:03:14 +08:00
|
|
|
|
title: t('过期时间'),
|
2024-03-15 16:05:33 +08:00
|
|
|
|
dataIndex: 'expired_time',
|
|
|
|
|
|
render: (text, record, index) => {
|
|
|
|
|
|
return (
|
|
|
|
|
|
<div>
|
2024-12-13 19:03:14 +08:00
|
|
|
|
{record.expired_time === -1 ? t('永不过期') : renderTimestamp(text)}
|
2024-03-15 16:05:33 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
);
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
2024-03-15 16:05:33 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '',
|
|
|
|
|
|
dataIndex: 'operate',
|
2025-06-07 02:45:07 +08:00
|
|
|
|
fixed: 'right',
|
2024-10-12 19:36:55 +08:00
|
|
|
|
render: (text, record, index) => {
|
|
|
|
|
|
let chats = localStorage.getItem('chats');
|
2025-04-04 12:00:38 +08:00
|
|
|
|
let chatsArray = [];
|
2024-10-12 19:36:55 +08:00
|
|
|
|
let shouldUseCustom = true;
|
2025-03-09 18:31:16 +08:00
|
|
|
|
|
2024-10-12 19:36:55 +08:00
|
|
|
|
if (shouldUseCustom) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
chats = JSON.parse(chats);
|
|
|
|
|
|
if (Array.isArray(chats)) {
|
|
|
|
|
|
for (let i = 0; i < chats.length; i++) {
|
2025-04-04 12:00:38 +08:00
|
|
|
|
let chat = {};
|
2024-10-12 19:36:55 +08:00
|
|
|
|
chat.node = 'item';
|
|
|
|
|
|
for (let key in chats[i]) {
|
|
|
|
|
|
if (chats[i].hasOwnProperty(key)) {
|
|
|
|
|
|
chat.key = i;
|
|
|
|
|
|
chat.name = key;
|
|
|
|
|
|
chat.onClick = () => {
|
|
|
|
|
|
onOpenLink(key, chats[i][key], record);
|
2025-04-04 12:00:38 +08:00
|
|
|
|
};
|
2024-10-12 19:36:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
chatsArray.push(chat);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.log(e);
|
2024-12-13 19:03:14 +08:00
|
|
|
|
showError(t('聊天链接配置错误,请联系管理员'));
|
2024-10-12 19:36:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-05-26 00:07:14 +08:00
|
|
|
|
|
2024-10-12 19:36:55 +08:00
|
|
|
|
return (
|
2025-05-23 00:24:08 +08:00
|
|
|
|
<Space wrap>
|
2024-10-12 19:36:55 +08:00
|
|
|
|
<SplitButtonGroup
|
2025-06-29 02:32:09 +08:00
|
|
|
|
className="overflow-hidden"
|
2024-12-13 19:03:14 +08:00
|
|
|
|
aria-label={t('项目操作按钮组')}
|
2024-03-15 16:05:33 +08:00
|
|
|
|
>
|
2024-03-23 21:24:39 +08:00
|
|
|
|
<Button
|
2024-10-12 19:36:55 +08:00
|
|
|
|
theme='light'
|
2025-05-23 00:24:08 +08:00
|
|
|
|
size="small"
|
2024-10-12 19:36:55 +08:00
|
|
|
|
style={{ color: 'rgba(var(--semi-teal-7), 1)' }}
|
|
|
|
|
|
onClick={() => {
|
|
|
|
|
|
if (chatsArray.length === 0) {
|
2024-12-13 19:03:14 +08:00
|
|
|
|
showError(t('请联系管理员配置聊天链接'));
|
2024-10-12 19:36:55 +08:00
|
|
|
|
} else {
|
2025-04-04 12:00:38 +08:00
|
|
|
|
onOpenLink(
|
|
|
|
|
|
'default',
|
|
|
|
|
|
chats[0][Object.keys(chats[0])[0]],
|
|
|
|
|
|
record,
|
|
|
|
|
|
);
|
2024-10-12 19:36:55 +08:00
|
|
|
|
}
|
2024-03-23 21:24:39 +08:00
|
|
|
|
}}
|
2024-10-12 19:36:55 +08:00
|
|
|
|
>
|
2024-12-13 19:03:14 +08:00
|
|
|
|
{t('聊天')}
|
2024-10-12 19:36:55 +08:00
|
|
|
|
</Button>
|
|
|
|
|
|
<Dropdown
|
|
|
|
|
|
trigger='click'
|
|
|
|
|
|
position='bottomRight'
|
|
|
|
|
|
menu={chatsArray}
|
|
|
|
|
|
>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
style={{
|
2025-05-23 00:24:08 +08:00
|
|
|
|
padding: '4px 4px',
|
2024-10-12 19:36:55 +08:00
|
|
|
|
color: 'rgba(var(--semi-teal-7), 1)',
|
|
|
|
|
|
}}
|
|
|
|
|
|
type='primary'
|
|
|
|
|
|
icon={<IconTreeTriangleDown />}
|
2025-05-23 00:24:08 +08:00
|
|
|
|
size="small"
|
2024-10-12 19:36:55 +08:00
|
|
|
|
></Button>
|
|
|
|
|
|
</Dropdown>
|
|
|
|
|
|
</SplitButtonGroup>
|
2025-05-26 00:07:14 +08:00
|
|
|
|
|
2025-05-23 00:24:08 +08:00
|
|
|
|
<Button
|
|
|
|
|
|
theme='light'
|
2025-07-12 03:35:19 +08:00
|
|
|
|
type='tertiary'
|
2025-05-23 00:24:08 +08:00
|
|
|
|
size="small"
|
2025-07-12 03:35:19 +08:00
|
|
|
|
onClick={() => {
|
|
|
|
|
|
setEditingToken(record);
|
|
|
|
|
|
setShowEdit(true);
|
2024-03-23 21:24:39 +08:00
|
|
|
|
}}
|
|
|
|
|
|
>
|
2025-07-12 03:35:19 +08:00
|
|
|
|
{t('编辑')}
|
2025-05-23 00:24:08 +08:00
|
|
|
|
</Button>
|
2025-05-26 00:07:14 +08:00
|
|
|
|
|
2024-03-23 21:24:39 +08:00
|
|
|
|
<Button
|
|
|
|
|
|
theme='light'
|
2025-07-12 03:35:19 +08:00
|
|
|
|
type='danger'
|
2025-05-23 00:24:08 +08:00
|
|
|
|
size="small"
|
2024-10-12 19:36:55 +08:00
|
|
|
|
onClick={() => {
|
2025-07-12 03:35:19 +08:00
|
|
|
|
Modal.confirm({
|
|
|
|
|
|
title: t('确定是否要删除此令牌?'),
|
|
|
|
|
|
content: t('此修改将不可逆'),
|
|
|
|
|
|
onOk: () => {
|
2025-07-13 17:45:31 +08:00
|
|
|
|
(async () => {
|
|
|
|
|
|
await manageToken(record.id, 'delete', record);
|
|
|
|
|
|
await refresh();
|
|
|
|
|
|
})();
|
2025-07-12 03:35:19 +08:00
|
|
|
|
},
|
|
|
|
|
|
});
|
2024-03-23 21:24:39 +08:00
|
|
|
|
}}
|
|
|
|
|
|
>
|
2025-07-12 03:35:19 +08:00
|
|
|
|
{t('删除')}
|
2024-03-23 21:24:39 +08:00
|
|
|
|
</Button>
|
2025-05-23 00:24:08 +08:00
|
|
|
|
</Space>
|
2024-10-12 19:36:55 +08:00
|
|
|
|
);
|
|
|
|
|
|
},
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
2024-03-15 16:05:33 +08:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
const [pageSize, setPageSize] = useState(ITEMS_PER_PAGE);
|
|
|
|
|
|
const [showEdit, setShowEdit] = useState(false);
|
|
|
|
|
|
const [tokens, setTokens] = useState([]);
|
|
|
|
|
|
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
|
|
|
|
const [tokenCount, setTokenCount] = useState(pageSize);
|
|
|
|
|
|
const [loading, setLoading] = useState(true);
|
|
|
|
|
|
const [activePage, setActivePage] = useState(1);
|
|
|
|
|
|
const [searching, setSearching] = useState(false);
|
|
|
|
|
|
const [editingToken, setEditingToken] = useState({
|
2024-03-23 21:24:39 +08:00
|
|
|
|
id: undefined,
|
2024-03-15 16:05:33 +08:00
|
|
|
|
});
|
2025-06-22 18:10:00 +08:00
|
|
|
|
const [compactMode, setCompactMode] = useTableCompactMode('tokens');
|
2025-07-12 03:35:19 +08:00
|
|
|
|
const [showKeys, setShowKeys] = useState({});
|
2024-03-15 16:05:33 +08:00
|
|
|
|
|
2025-06-08 18:41:04 +08:00
|
|
|
|
// Form 初始值
|
|
|
|
|
|
const formInitValues = {
|
|
|
|
|
|
searchKeyword: '',
|
|
|
|
|
|
searchToken: '',
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Form API 引用
|
|
|
|
|
|
const [formApi, setFormApi] = useState(null);
|
|
|
|
|
|
|
|
|
|
|
|
// 获取表单值的辅助函数
|
|
|
|
|
|
const getFormValues = () => {
|
|
|
|
|
|
const formValues = formApi ? formApi.getValues() : {};
|
|
|
|
|
|
return {
|
|
|
|
|
|
searchKeyword: formValues.searchKeyword || '',
|
|
|
|
|
|
searchToken: formValues.searchToken || '',
|
|
|
|
|
|
};
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
const closeEdit = () => {
|
|
|
|
|
|
setShowEdit(false);
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
setEditingToken({
|
2024-03-23 21:24:39 +08:00
|
|
|
|
id: undefined,
|
2024-03-15 16:05:33 +08:00
|
|
|
|
});
|
|
|
|
|
|
}, 500);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
🚀 feat(pagination): unify backend-driven pagination & improve channel tag aggregation
SUMMARY
• Migrated Token, Task, Midjourney, Channel, Redemption tables to true server-side pagination.
• Added total / page / page_size metadata in API responses; switched all affected React tables to consume new structure.
• Implemented counting helpers:
– model/token.go CountUserTokens
– model/task.go TaskCountAllTasks / TaskCountAllUserTask
– model/midjourney.go CountAllTasks / CountAllUserTask
– model/channel.go CountAllChannels / CountAllTags
• Refactored controllers (token, task, midjourney, channel) for 1-based paging & aggregated returns.
• Redesigned `ChannelsTable.js`:
– `loadChannels`, `syncPageData`, `enrichChannels` for tag-mode grouping without recursion.
– Fixed runtime white-screen (maximum call-stack) by removing child duplication.
– Pagination, search, tag-mode, idSort all hot-reload correctly.
• Removed unused `log` import in controller/midjourney.go.
BREAKING CHANGES
Front-end consumers must now expect data.items / total / page / page_size from list endpoints (`/api/channel`, `/api/task`, `/api/mj`, `/api/token`, etc.).
2025-06-12 17:25:25 +08:00
|
|
|
|
// 将后端返回的数据写入状态
|
|
|
|
|
|
const syncPageData = (payload) => {
|
|
|
|
|
|
setTokens(payload.items || []);
|
|
|
|
|
|
setTokenCount(payload.total || 0);
|
|
|
|
|
|
setActivePage(payload.page || 1);
|
|
|
|
|
|
setPageSize(payload.page_size || pageSize);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
🚀 feat(pagination): unify backend-driven pagination & improve channel tag aggregation
SUMMARY
• Migrated Token, Task, Midjourney, Channel, Redemption tables to true server-side pagination.
• Added total / page / page_size metadata in API responses; switched all affected React tables to consume new structure.
• Implemented counting helpers:
– model/token.go CountUserTokens
– model/task.go TaskCountAllTasks / TaskCountAllUserTask
– model/midjourney.go CountAllTasks / CountAllUserTask
– model/channel.go CountAllChannels / CountAllTags
• Refactored controllers (token, task, midjourney, channel) for 1-based paging & aggregated returns.
• Redesigned `ChannelsTable.js`:
– `loadChannels`, `syncPageData`, `enrichChannels` for tag-mode grouping without recursion.
– Fixed runtime white-screen (maximum call-stack) by removing child duplication.
– Pagination, search, tag-mode, idSort all hot-reload correctly.
• Removed unused `log` import in controller/midjourney.go.
BREAKING CHANGES
Front-end consumers must now expect data.items / total / page / page_size from list endpoints (`/api/channel`, `/api/task`, `/api/mj`, `/api/token`, etc.).
2025-06-12 17:25:25 +08:00
|
|
|
|
const loadTokens = async (page = 1, size = pageSize) => {
|
2024-03-15 16:05:33 +08:00
|
|
|
|
setLoading(true);
|
🚀 feat(pagination): unify backend-driven pagination & improve channel tag aggregation
SUMMARY
• Migrated Token, Task, Midjourney, Channel, Redemption tables to true server-side pagination.
• Added total / page / page_size metadata in API responses; switched all affected React tables to consume new structure.
• Implemented counting helpers:
– model/token.go CountUserTokens
– model/task.go TaskCountAllTasks / TaskCountAllUserTask
– model/midjourney.go CountAllTasks / CountAllUserTask
– model/channel.go CountAllChannels / CountAllTags
• Refactored controllers (token, task, midjourney, channel) for 1-based paging & aggregated returns.
• Redesigned `ChannelsTable.js`:
– `loadChannels`, `syncPageData`, `enrichChannels` for tag-mode grouping without recursion.
– Fixed runtime white-screen (maximum call-stack) by removing child duplication.
– Pagination, search, tag-mode, idSort all hot-reload correctly.
• Removed unused `log` import in controller/midjourney.go.
BREAKING CHANGES
Front-end consumers must now expect data.items / total / page / page_size from list endpoints (`/api/channel`, `/api/task`, `/api/mj`, `/api/token`, etc.).
2025-06-12 17:25:25 +08:00
|
|
|
|
const res = await API.get(`/api/token/?p=${page}&size=${size}`);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
const { success, message, data } = res.data;
|
|
|
|
|
|
if (success) {
|
🚀 feat(pagination): unify backend-driven pagination & improve channel tag aggregation
SUMMARY
• Migrated Token, Task, Midjourney, Channel, Redemption tables to true server-side pagination.
• Added total / page / page_size metadata in API responses; switched all affected React tables to consume new structure.
• Implemented counting helpers:
– model/token.go CountUserTokens
– model/task.go TaskCountAllTasks / TaskCountAllUserTask
– model/midjourney.go CountAllTasks / CountAllUserTask
– model/channel.go CountAllChannels / CountAllTags
• Refactored controllers (token, task, midjourney, channel) for 1-based paging & aggregated returns.
• Redesigned `ChannelsTable.js`:
– `loadChannels`, `syncPageData`, `enrichChannels` for tag-mode grouping without recursion.
– Fixed runtime white-screen (maximum call-stack) by removing child duplication.
– Pagination, search, tag-mode, idSort all hot-reload correctly.
• Removed unused `log` import in controller/midjourney.go.
BREAKING CHANGES
Front-end consumers must now expect data.items / total / page / page_size from list endpoints (`/api/channel`, `/api/task`, `/api/mj`, `/api/token`, etc.).
2025-06-12 17:25:25 +08:00
|
|
|
|
syncPageData(data);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
showError(message);
|
|
|
|
|
|
}
|
|
|
|
|
|
setLoading(false);
|
|
|
|
|
|
};
|
2023-10-31 22:41:34 +08:00
|
|
|
|
|
2025-07-13 17:45:31 +08:00
|
|
|
|
const refresh = async (page = activePage) => {
|
|
|
|
|
|
await loadTokens(page);
|
2025-06-22 16:35:30 +08:00
|
|
|
|
setSelectedKeys([]);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const copyText = async (text) => {
|
|
|
|
|
|
if (await copy(text)) {
|
2024-12-13 19:03:14 +08:00
|
|
|
|
showSuccess(t('已复制到剪贴板!'));
|
2024-03-15 16:05:33 +08:00
|
|
|
|
} else {
|
2024-03-25 16:49:53 +08:00
|
|
|
|
Modal.error({
|
2024-12-13 19:03:14 +08:00
|
|
|
|
title: t('无法复制到剪贴板,请手动复制'),
|
2024-03-25 16:49:53 +08:00
|
|
|
|
content: text,
|
|
|
|
|
|
size: 'large',
|
|
|
|
|
|
});
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2024-10-12 19:36:55 +08:00
|
|
|
|
const onOpenLink = async (type, url, record) => {
|
2024-03-15 16:05:33 +08:00
|
|
|
|
let status = localStorage.getItem('status');
|
|
|
|
|
|
let serverAddress = '';
|
|
|
|
|
|
if (status) {
|
|
|
|
|
|
status = JSON.parse(status);
|
|
|
|
|
|
serverAddress = status.server_address;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (serverAddress === '') {
|
|
|
|
|
|
serverAddress = window.location.origin;
|
|
|
|
|
|
}
|
2025-07-06 20:56:09 +08:00
|
|
|
|
if (url.includes('{cherryConfig}') === true) {
|
|
|
|
|
|
let cherryConfig = {
|
|
|
|
|
|
id: 'new-api',
|
|
|
|
|
|
baseUrl: serverAddress,
|
|
|
|
|
|
apiKey: 'sk-' + record.key,
|
|
|
|
|
|
}
|
|
|
|
|
|
// 替换 {cherryConfig} 为base64编码的JSON字符串
|
|
|
|
|
|
let encodedConfig = encodeURIComponent(
|
|
|
|
|
|
btoa(JSON.stringify(cherryConfig))
|
|
|
|
|
|
);
|
|
|
|
|
|
url = url.replaceAll('{cherryConfig}', encodedConfig);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
let encodedServerAddress = encodeURIComponent(serverAddress);
|
|
|
|
|
|
url = url.replaceAll('{address}', encodedServerAddress);
|
|
|
|
|
|
url = url.replaceAll('{key}', 'sk-' + record.key);
|
|
|
|
|
|
}
|
2023-10-31 22:41:34 +08:00
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
window.open(url, '_blank');
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-06-07 00:53:29 +08:00
|
|
|
|
useEffect(() => {
|
🚀 feat(pagination): unify backend-driven pagination & improve channel tag aggregation
SUMMARY
• Migrated Token, Task, Midjourney, Channel, Redemption tables to true server-side pagination.
• Added total / page / page_size metadata in API responses; switched all affected React tables to consume new structure.
• Implemented counting helpers:
– model/token.go CountUserTokens
– model/task.go TaskCountAllTasks / TaskCountAllUserTask
– model/midjourney.go CountAllTasks / CountAllUserTask
– model/channel.go CountAllChannels / CountAllTags
• Refactored controllers (token, task, midjourney, channel) for 1-based paging & aggregated returns.
• Redesigned `ChannelsTable.js`:
– `loadChannels`, `syncPageData`, `enrichChannels` for tag-mode grouping without recursion.
– Fixed runtime white-screen (maximum call-stack) by removing child duplication.
– Pagination, search, tag-mode, idSort all hot-reload correctly.
• Removed unused `log` import in controller/midjourney.go.
BREAKING CHANGES
Front-end consumers must now expect data.items / total / page / page_size from list endpoints (`/api/channel`, `/api/task`, `/api/mj`, `/api/token`, etc.).
2025-06-12 17:25:25 +08:00
|
|
|
|
loadTokens(1)
|
2024-03-15 16:05:33 +08:00
|
|
|
|
.then()
|
|
|
|
|
|
.catch((reason) => {
|
|
|
|
|
|
showError(reason);
|
|
|
|
|
|
});
|
|
|
|
|
|
}, [pageSize]);
|
|
|
|
|
|
|
2024-03-23 21:24:39 +08:00
|
|
|
|
const removeRecord = (key) => {
|
2024-03-15 16:05:33 +08:00
|
|
|
|
let newDataSource = [...tokens];
|
|
|
|
|
|
if (key != null) {
|
2024-03-23 21:24:39 +08:00
|
|
|
|
let idx = newDataSource.findIndex((data) => data.key === key);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
|
|
|
|
|
|
if (idx > -1) {
|
|
|
|
|
|
newDataSource.splice(idx, 1);
|
🚀 feat(pagination): unify backend-driven pagination & improve channel tag aggregation
SUMMARY
• Migrated Token, Task, Midjourney, Channel, Redemption tables to true server-side pagination.
• Added total / page / page_size metadata in API responses; switched all affected React tables to consume new structure.
• Implemented counting helpers:
– model/token.go CountUserTokens
– model/task.go TaskCountAllTasks / TaskCountAllUserTask
– model/midjourney.go CountAllTasks / CountAllUserTask
– model/channel.go CountAllChannels / CountAllTags
• Refactored controllers (token, task, midjourney, channel) for 1-based paging & aggregated returns.
• Redesigned `ChannelsTable.js`:
– `loadChannels`, `syncPageData`, `enrichChannels` for tag-mode grouping without recursion.
– Fixed runtime white-screen (maximum call-stack) by removing child duplication.
– Pagination, search, tag-mode, idSort all hot-reload correctly.
• Removed unused `log` import in controller/midjourney.go.
BREAKING CHANGES
Front-end consumers must now expect data.items / total / page / page_size from list endpoints (`/api/channel`, `/api/task`, `/api/mj`, `/api/token`, etc.).
2025-06-12 17:25:25 +08:00
|
|
|
|
setTokens(newDataSource);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
}
|
2023-04-23 11:31:00 +08:00
|
|
|
|
}
|
2024-03-15 16:05:33 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const manageToken = async (id, action, record) => {
|
|
|
|
|
|
setLoading(true);
|
|
|
|
|
|
let data = { id };
|
|
|
|
|
|
let res;
|
|
|
|
|
|
switch (action) {
|
|
|
|
|
|
case 'delete':
|
|
|
|
|
|
res = await API.delete(`/api/token/${id}/`);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'enable':
|
|
|
|
|
|
data.status = 1;
|
|
|
|
|
|
res = await API.put('/api/token/?status_only=true', data);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 'disable':
|
|
|
|
|
|
data.status = 2;
|
|
|
|
|
|
res = await API.put('/api/token/?status_only=true', data);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
const { success, message } = res.data;
|
|
|
|
|
|
if (success) {
|
|
|
|
|
|
showSuccess('操作成功完成!');
|
|
|
|
|
|
let token = res.data.data;
|
|
|
|
|
|
let newTokens = [...tokens];
|
|
|
|
|
|
if (action === 'delete') {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
record.status = token.status;
|
|
|
|
|
|
}
|
🚀 feat(pagination): unify backend-driven pagination & improve channel tag aggregation
SUMMARY
• Migrated Token, Task, Midjourney, Channel, Redemption tables to true server-side pagination.
• Added total / page / page_size metadata in API responses; switched all affected React tables to consume new structure.
• Implemented counting helpers:
– model/token.go CountUserTokens
– model/task.go TaskCountAllTasks / TaskCountAllUserTask
– model/midjourney.go CountAllTasks / CountAllUserTask
– model/channel.go CountAllChannels / CountAllTags
• Refactored controllers (token, task, midjourney, channel) for 1-based paging & aggregated returns.
• Redesigned `ChannelsTable.js`:
– `loadChannels`, `syncPageData`, `enrichChannels` for tag-mode grouping without recursion.
– Fixed runtime white-screen (maximum call-stack) by removing child duplication.
– Pagination, search, tag-mode, idSort all hot-reload correctly.
• Removed unused `log` import in controller/midjourney.go.
BREAKING CHANGES
Front-end consumers must now expect data.items / total / page / page_size from list endpoints (`/api/channel`, `/api/task`, `/api/mj`, `/api/token`, etc.).
2025-06-12 17:25:25 +08:00
|
|
|
|
setTokens(newTokens);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
showError(message);
|
|
|
|
|
|
}
|
|
|
|
|
|
setLoading(false);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const searchTokens = async () => {
|
2025-06-08 18:41:04 +08:00
|
|
|
|
const { searchKeyword, searchToken } = getFormValues();
|
2024-03-15 16:05:33 +08:00
|
|
|
|
if (searchKeyword === '' && searchToken === '') {
|
🚀 feat(pagination): unify backend-driven pagination & improve channel tag aggregation
SUMMARY
• Migrated Token, Task, Midjourney, Channel, Redemption tables to true server-side pagination.
• Added total / page / page_size metadata in API responses; switched all affected React tables to consume new structure.
• Implemented counting helpers:
– model/token.go CountUserTokens
– model/task.go TaskCountAllTasks / TaskCountAllUserTask
– model/midjourney.go CountAllTasks / CountAllUserTask
– model/channel.go CountAllChannels / CountAllTags
• Refactored controllers (token, task, midjourney, channel) for 1-based paging & aggregated returns.
• Redesigned `ChannelsTable.js`:
– `loadChannels`, `syncPageData`, `enrichChannels` for tag-mode grouping without recursion.
– Fixed runtime white-screen (maximum call-stack) by removing child duplication.
– Pagination, search, tag-mode, idSort all hot-reload correctly.
• Removed unused `log` import in controller/midjourney.go.
BREAKING CHANGES
Front-end consumers must now expect data.items / total / page / page_size from list endpoints (`/api/channel`, `/api/task`, `/api/mj`, `/api/token`, etc.).
2025-06-12 17:25:25 +08:00
|
|
|
|
await loadTokens(1);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
setSearching(true);
|
2024-03-23 21:24:39 +08:00
|
|
|
|
const res = await API.get(
|
|
|
|
|
|
`/api/token/search?keyword=${searchKeyword}&token=${searchToken}`,
|
|
|
|
|
|
);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
const { success, message, data } = res.data;
|
|
|
|
|
|
if (success) {
|
🚀 feat(pagination): unify backend-driven pagination & improve channel tag aggregation
SUMMARY
• Migrated Token, Task, Midjourney, Channel, Redemption tables to true server-side pagination.
• Added total / page / page_size metadata in API responses; switched all affected React tables to consume new structure.
• Implemented counting helpers:
– model/token.go CountUserTokens
– model/task.go TaskCountAllTasks / TaskCountAllUserTask
– model/midjourney.go CountAllTasks / CountAllUserTask
– model/channel.go CountAllChannels / CountAllTags
• Refactored controllers (token, task, midjourney, channel) for 1-based paging & aggregated returns.
• Redesigned `ChannelsTable.js`:
– `loadChannels`, `syncPageData`, `enrichChannels` for tag-mode grouping without recursion.
– Fixed runtime white-screen (maximum call-stack) by removing child duplication.
– Pagination, search, tag-mode, idSort all hot-reload correctly.
• Removed unused `log` import in controller/midjourney.go.
BREAKING CHANGES
Front-end consumers must now expect data.items / total / page / page_size from list endpoints (`/api/channel`, `/api/task`, `/api/mj`, `/api/token`, etc.).
2025-06-12 17:25:25 +08:00
|
|
|
|
setTokens(data);
|
|
|
|
|
|
setTokenCount(data.length);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
setActivePage(1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
showError(message);
|
|
|
|
|
|
}
|
|
|
|
|
|
setSearching(false);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const sortToken = (key) => {
|
|
|
|
|
|
if (tokens.length === 0) return;
|
|
|
|
|
|
setLoading(true);
|
|
|
|
|
|
let sortedTokens = [...tokens];
|
|
|
|
|
|
sortedTokens.sort((a, b) => {
|
|
|
|
|
|
return ('' + a[key]).localeCompare(b[key]);
|
|
|
|
|
|
});
|
|
|
|
|
|
if (sortedTokens[0].id === tokens[0].id) {
|
|
|
|
|
|
sortedTokens.reverse();
|
|
|
|
|
|
}
|
|
|
|
|
|
setTokens(sortedTokens);
|
|
|
|
|
|
setLoading(false);
|
|
|
|
|
|
};
|
2023-10-31 22:41:34 +08:00
|
|
|
|
|
2024-03-23 21:24:39 +08:00
|
|
|
|
const handlePageChange = (page) => {
|
🚀 feat(pagination): unify backend-driven pagination & improve channel tag aggregation
SUMMARY
• Migrated Token, Task, Midjourney, Channel, Redemption tables to true server-side pagination.
• Added total / page / page_size metadata in API responses; switched all affected React tables to consume new structure.
• Implemented counting helpers:
– model/token.go CountUserTokens
– model/task.go TaskCountAllTasks / TaskCountAllUserTask
– model/midjourney.go CountAllTasks / CountAllUserTask
– model/channel.go CountAllChannels / CountAllTags
• Refactored controllers (token, task, midjourney, channel) for 1-based paging & aggregated returns.
• Redesigned `ChannelsTable.js`:
– `loadChannels`, `syncPageData`, `enrichChannels` for tag-mode grouping without recursion.
– Fixed runtime white-screen (maximum call-stack) by removing child duplication.
– Pagination, search, tag-mode, idSort all hot-reload correctly.
• Removed unused `log` import in controller/midjourney.go.
BREAKING CHANGES
Front-end consumers must now expect data.items / total / page / page_size from list endpoints (`/api/channel`, `/api/task`, `/api/mj`, `/api/token`, etc.).
2025-06-12 17:25:25 +08:00
|
|
|
|
loadTokens(page, pageSize).then();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handlePageSizeChange = async (size) => {
|
|
|
|
|
|
setPageSize(size);
|
|
|
|
|
|
await loadTokens(1, size);
|
2024-03-15 16:05:33 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const rowSelection = {
|
2025-05-23 00:24:08 +08:00
|
|
|
|
onSelect: (record, selected) => { },
|
|
|
|
|
|
onSelectAll: (selected, selectedRows) => { },
|
2024-03-15 16:05:33 +08:00
|
|
|
|
onChange: (selectedRowKeys, selectedRows) => {
|
|
|
|
|
|
setSelectedKeys(selectedRows);
|
2024-03-23 21:24:39 +08:00
|
|
|
|
},
|
2024-03-15 16:05:33 +08:00
|
|
|
|
};
|
2023-10-31 22:41:34 +08:00
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
const handleRow = (record, index) => {
|
|
|
|
|
|
if (record.status !== 1) {
|
|
|
|
|
|
return {
|
|
|
|
|
|
style: {
|
2024-03-23 21:24:39 +08:00
|
|
|
|
background: 'var(--semi-color-disabled-border)',
|
|
|
|
|
|
},
|
2024-03-15 16:05:33 +08:00
|
|
|
|
};
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return {};
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-06-22 16:35:30 +08:00
|
|
|
|
const batchDeleteTokens = async () => {
|
|
|
|
|
|
if (selectedKeys.length === 0) {
|
|
|
|
|
|
showError(t('请先选择要删除的令牌!'));
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
setLoading(true);
|
|
|
|
|
|
try {
|
|
|
|
|
|
const ids = selectedKeys.map((token) => token.id);
|
|
|
|
|
|
const res = await API.post('/api/token/batch', { ids });
|
|
|
|
|
|
if (res?.data?.success) {
|
|
|
|
|
|
const count = res.data.data || 0;
|
|
|
|
|
|
showSuccess(t('已删除 {{count}} 个令牌!', { count }));
|
|
|
|
|
|
await refresh();
|
2025-07-13 17:45:31 +08:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
if (tokens.length === 0 && activePage > 1) {
|
|
|
|
|
|
refresh(activePage - 1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 100);
|
2025-06-22 16:35:30 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
showError(res?.data?.message || t('删除失败'));
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
showError(error.message);
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
setLoading(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-05-23 00:24:08 +08:00
|
|
|
|
const renderHeader = () => (
|
|
|
|
|
|
<div className="flex flex-col w-full">
|
2025-06-13 14:11:39 +08:00
|
|
|
|
<div className="mb-2">
|
2025-06-22 18:10:00 +08:00
|
|
|
|
<div className="flex flex-col md:flex-row justify-between items-start md:items-center gap-2 w-full">
|
|
|
|
|
|
<div className="flex items-center text-blue-500">
|
|
|
|
|
|
<Key size={16} className="mr-2" />
|
|
|
|
|
|
<Text>{t('令牌用于API访问认证,可以设置额度限制和模型权限。')}</Text>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
theme="light"
|
|
|
|
|
|
type="secondary"
|
2025-06-29 02:32:09 +08:00
|
|
|
|
className="w-full md:w-auto"
|
2025-06-22 18:10:00 +08:00
|
|
|
|
onClick={() => setCompactMode(!compactMode)}
|
2025-07-13 01:02:55 +08:00
|
|
|
|
size="small"
|
2025-06-22 18:10:00 +08:00
|
|
|
|
>
|
|
|
|
|
|
{compactMode ? t('自适应列表') : t('紧凑列表')}
|
|
|
|
|
|
</Button>
|
2025-06-13 14:11:39 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<Divider margin="12px" />
|
|
|
|
|
|
|
2025-05-23 00:24:08 +08:00
|
|
|
|
<div className="flex flex-col md:flex-row justify-between items-center gap-4 w-full">
|
2025-06-22 16:35:30 +08:00
|
|
|
|
<div className="flex flex-wrap gap-2 w-full md:w-auto order-2 md:order-1">
|
2025-05-23 00:24:08 +08:00
|
|
|
|
<Button
|
|
|
|
|
|
theme="light"
|
|
|
|
|
|
type="primary"
|
2025-06-29 02:32:09 +08:00
|
|
|
|
className="flex-1 md:flex-initial"
|
2025-05-23 00:24:08 +08:00
|
|
|
|
onClick={() => {
|
|
|
|
|
|
setEditingToken({
|
|
|
|
|
|
id: undefined,
|
|
|
|
|
|
});
|
|
|
|
|
|
setShowEdit(true);
|
|
|
|
|
|
}}
|
2025-07-13 01:02:55 +08:00
|
|
|
|
size="small"
|
2025-05-23 00:24:08 +08:00
|
|
|
|
>
|
|
|
|
|
|
{t('添加令牌')}
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
theme="light"
|
|
|
|
|
|
type="warning"
|
2025-06-29 02:32:09 +08:00
|
|
|
|
className="flex-1 md:flex-initial"
|
2025-06-22 16:49:44 +08:00
|
|
|
|
onClick={() => {
|
2025-05-23 00:24:08 +08:00
|
|
|
|
if (selectedKeys.length === 0) {
|
|
|
|
|
|
showError(t('请至少选择一个令牌!'));
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-06-22 16:49:44 +08:00
|
|
|
|
Modal.info({
|
|
|
|
|
|
title: t('复制令牌'),
|
|
|
|
|
|
icon: null,
|
|
|
|
|
|
content: t('请选择你的复制方式'),
|
|
|
|
|
|
footer: (
|
|
|
|
|
|
<Space>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
theme="solid"
|
|
|
|
|
|
onClick={async () => {
|
|
|
|
|
|
let content = '';
|
|
|
|
|
|
for (let i = 0; i < selectedKeys.length; i++) {
|
|
|
|
|
|
content +=
|
|
|
|
|
|
selectedKeys[i].name + ' sk-' + selectedKeys[i].key + '\n';
|
|
|
|
|
|
}
|
|
|
|
|
|
await copyText(content);
|
|
|
|
|
|
Modal.destroyAll();
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
{t('名称+密钥')}
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
theme="light"
|
|
|
|
|
|
onClick={async () => {
|
|
|
|
|
|
let content = '';
|
|
|
|
|
|
for (let i = 0; i < selectedKeys.length; i++) {
|
|
|
|
|
|
content += 'sk-' + selectedKeys[i].key + '\n';
|
|
|
|
|
|
}
|
|
|
|
|
|
await copyText(content);
|
|
|
|
|
|
Modal.destroyAll();
|
|
|
|
|
|
}}
|
|
|
|
|
|
>
|
|
|
|
|
|
{t('仅密钥')}
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</Space>
|
|
|
|
|
|
),
|
|
|
|
|
|
});
|
2025-05-23 00:24:08 +08:00
|
|
|
|
}}
|
2025-07-13 01:02:55 +08:00
|
|
|
|
size="small"
|
2025-05-23 00:24:08 +08:00
|
|
|
|
>
|
2025-06-22 16:49:44 +08:00
|
|
|
|
{t('复制所选令牌')}
|
2025-05-23 00:24:08 +08:00
|
|
|
|
</Button>
|
2025-06-22 16:35:30 +08:00
|
|
|
|
<Button
|
|
|
|
|
|
theme="light"
|
|
|
|
|
|
type="danger"
|
2025-06-29 02:32:09 +08:00
|
|
|
|
className="w-full md:w-auto"
|
2025-06-22 16:35:30 +08:00
|
|
|
|
onClick={() => {
|
|
|
|
|
|
if (selectedKeys.length === 0) {
|
|
|
|
|
|
showError(t('请至少选择一个令牌!'));
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
|
title: t('批量删除令牌'),
|
|
|
|
|
|
content: (
|
|
|
|
|
|
<div>
|
|
|
|
|
|
{t('确定要删除所选的 {{count}} 个令牌吗?', { count: selectedKeys.length })}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
),
|
|
|
|
|
|
onOk: () => batchDeleteTokens(),
|
|
|
|
|
|
});
|
|
|
|
|
|
}}
|
2025-07-13 01:02:55 +08:00
|
|
|
|
size="small"
|
2025-06-22 16:35:30 +08:00
|
|
|
|
>
|
|
|
|
|
|
{t('删除所选令牌')}
|
|
|
|
|
|
</Button>
|
2025-05-23 00:24:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-06-08 18:41:04 +08:00
|
|
|
|
<Form
|
|
|
|
|
|
initValues={formInitValues}
|
|
|
|
|
|
getFormApi={(api) => setFormApi(api)}
|
|
|
|
|
|
onSubmit={searchTokens}
|
|
|
|
|
|
allowEmpty={true}
|
|
|
|
|
|
autoComplete="off"
|
|
|
|
|
|
layout="horizontal"
|
|
|
|
|
|
trigger="change"
|
|
|
|
|
|
stopValidateWithError={false}
|
|
|
|
|
|
className="w-full md:w-auto order-1 md:order-2"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div className="flex flex-col md:flex-row items-center gap-4 w-full md:w-auto">
|
|
|
|
|
|
<div className="relative w-full md:w-56">
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field="searchKeyword"
|
|
|
|
|
|
prefix={<IconSearch />}
|
|
|
|
|
|
placeholder={t('搜索关键字')}
|
|
|
|
|
|
showClear
|
|
|
|
|
|
pure
|
2025-07-13 01:02:55 +08:00
|
|
|
|
size="small"
|
2025-06-08 18:41:04 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="relative w-full md:w-56">
|
|
|
|
|
|
<Form.Input
|
|
|
|
|
|
field="searchToken"
|
|
|
|
|
|
prefix={<IconSearch />}
|
|
|
|
|
|
placeholder={t('密钥')}
|
|
|
|
|
|
showClear
|
|
|
|
|
|
pure
|
2025-07-13 01:02:55 +08:00
|
|
|
|
size="small"
|
2025-06-08 18:41:04 +08:00
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div className="flex gap-2 w-full md:w-auto">
|
|
|
|
|
|
<Button
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
htmlType="submit"
|
2025-06-12 17:48:20 +08:00
|
|
|
|
loading={loading || searching}
|
2025-06-29 02:32:09 +08:00
|
|
|
|
className="flex-1 md:flex-initial md:w-auto"
|
2025-07-13 01:02:55 +08:00
|
|
|
|
size="small"
|
2025-06-08 18:41:04 +08:00
|
|
|
|
>
|
|
|
|
|
|
{t('查询')}
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
<Button
|
|
|
|
|
|
theme="light"
|
|
|
|
|
|
onClick={() => {
|
|
|
|
|
|
if (formApi) {
|
|
|
|
|
|
formApi.reset();
|
|
|
|
|
|
// 重置后立即查询,使用setTimeout确保表单重置完成
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
searchTokens();
|
|
|
|
|
|
}, 100);
|
|
|
|
|
|
}
|
|
|
|
|
|
}}
|
2025-06-29 02:32:09 +08:00
|
|
|
|
className="flex-1 md:flex-initial md:w-auto"
|
2025-07-13 01:02:55 +08:00
|
|
|
|
size="small"
|
2025-06-08 18:41:04 +08:00
|
|
|
|
>
|
|
|
|
|
|
{t('重置')}
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
</div>
|
2025-05-23 00:24:08 +08:00
|
|
|
|
</div>
|
2025-06-08 18:41:04 +08:00
|
|
|
|
</Form>
|
2025-05-23 00:24:08 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
);
|
|
|
|
|
|
|
2024-03-15 16:05:33 +08:00
|
|
|
|
return (
|
|
|
|
|
|
<>
|
2024-03-23 21:24:39 +08:00
|
|
|
|
<EditToken
|
|
|
|
|
|
refresh={refresh}
|
|
|
|
|
|
editingToken={editingToken}
|
|
|
|
|
|
visiable={showEdit}
|
|
|
|
|
|
handleClose={closeEdit}
|
|
|
|
|
|
></EditToken>
|
2025-05-23 00:24:08 +08:00
|
|
|
|
|
|
|
|
|
|
<Card
|
2025-06-07 02:45:07 +08:00
|
|
|
|
className="!rounded-2xl"
|
2025-05-23 00:24:08 +08:00
|
|
|
|
title={renderHeader()}
|
2025-06-07 00:53:29 +08:00
|
|
|
|
shadows='always'
|
|
|
|
|
|
bordered={false}
|
2024-03-23 21:24:39 +08:00
|
|
|
|
>
|
2025-06-07 02:51:38 +08:00
|
|
|
|
<Table
|
2025-06-22 18:10:00 +08:00
|
|
|
|
columns={compactMode ? columns.map(col => {
|
|
|
|
|
|
if (col.dataIndex === 'operate') {
|
|
|
|
|
|
const { fixed, ...rest } = col;
|
|
|
|
|
|
return rest;
|
|
|
|
|
|
}
|
|
|
|
|
|
return col;
|
|
|
|
|
|
}) : columns}
|
🚀 feat(pagination): unify backend-driven pagination & improve channel tag aggregation
SUMMARY
• Migrated Token, Task, Midjourney, Channel, Redemption tables to true server-side pagination.
• Added total / page / page_size metadata in API responses; switched all affected React tables to consume new structure.
• Implemented counting helpers:
– model/token.go CountUserTokens
– model/task.go TaskCountAllTasks / TaskCountAllUserTask
– model/midjourney.go CountAllTasks / CountAllUserTask
– model/channel.go CountAllChannels / CountAllTags
• Refactored controllers (token, task, midjourney, channel) for 1-based paging & aggregated returns.
• Redesigned `ChannelsTable.js`:
– `loadChannels`, `syncPageData`, `enrichChannels` for tag-mode grouping without recursion.
– Fixed runtime white-screen (maximum call-stack) by removing child duplication.
– Pagination, search, tag-mode, idSort all hot-reload correctly.
• Removed unused `log` import in controller/midjourney.go.
BREAKING CHANGES
Front-end consumers must now expect data.items / total / page / page_size from list endpoints (`/api/channel`, `/api/task`, `/api/mj`, `/api/token`, etc.).
2025-06-12 17:25:25 +08:00
|
|
|
|
dataSource={tokens}
|
2025-06-22 18:10:00 +08:00
|
|
|
|
scroll={compactMode ? undefined : { x: 'max-content' }}
|
2025-06-07 02:51:38 +08:00
|
|
|
|
pagination={{
|
|
|
|
|
|
currentPage: activePage,
|
|
|
|
|
|
pageSize: pageSize,
|
|
|
|
|
|
total: tokenCount,
|
|
|
|
|
|
showSizeChanger: true,
|
|
|
|
|
|
pageSizeOptions: [10, 20, 50, 100],
|
|
|
|
|
|
formatPageText: (page) =>
|
|
|
|
|
|
t('第 {{start}} - {{end}} 条,共 {{total}} 条', {
|
|
|
|
|
|
start: page.currentStart,
|
|
|
|
|
|
end: page.currentEnd,
|
🚀 feat(pagination): unify backend-driven pagination & improve channel tag aggregation
SUMMARY
• Migrated Token, Task, Midjourney, Channel, Redemption tables to true server-side pagination.
• Added total / page / page_size metadata in API responses; switched all affected React tables to consume new structure.
• Implemented counting helpers:
– model/token.go CountUserTokens
– model/task.go TaskCountAllTasks / TaskCountAllUserTask
– model/midjourney.go CountAllTasks / CountAllUserTask
– model/channel.go CountAllChannels / CountAllTags
• Refactored controllers (token, task, midjourney, channel) for 1-based paging & aggregated returns.
• Redesigned `ChannelsTable.js`:
– `loadChannels`, `syncPageData`, `enrichChannels` for tag-mode grouping without recursion.
– Fixed runtime white-screen (maximum call-stack) by removing child duplication.
– Pagination, search, tag-mode, idSort all hot-reload correctly.
• Removed unused `log` import in controller/midjourney.go.
BREAKING CHANGES
Front-end consumers must now expect data.items / total / page / page_size from list endpoints (`/api/channel`, `/api/task`, `/api/mj`, `/api/token`, etc.).
2025-06-12 17:25:25 +08:00
|
|
|
|
total: tokenCount,
|
2025-06-07 02:51:38 +08:00
|
|
|
|
}),
|
🚀 feat(pagination): unify backend-driven pagination & improve channel tag aggregation
SUMMARY
• Migrated Token, Task, Midjourney, Channel, Redemption tables to true server-side pagination.
• Added total / page / page_size metadata in API responses; switched all affected React tables to consume new structure.
• Implemented counting helpers:
– model/token.go CountUserTokens
– model/task.go TaskCountAllTasks / TaskCountAllUserTask
– model/midjourney.go CountAllTasks / CountAllUserTask
– model/channel.go CountAllChannels / CountAllTags
• Refactored controllers (token, task, midjourney, channel) for 1-based paging & aggregated returns.
• Redesigned `ChannelsTable.js`:
– `loadChannels`, `syncPageData`, `enrichChannels` for tag-mode grouping without recursion.
– Fixed runtime white-screen (maximum call-stack) by removing child duplication.
– Pagination, search, tag-mode, idSort all hot-reload correctly.
• Removed unused `log` import in controller/midjourney.go.
BREAKING CHANGES
Front-end consumers must now expect data.items / total / page / page_size from list endpoints (`/api/channel`, `/api/task`, `/api/mj`, `/api/token`, etc.).
2025-06-12 17:25:25 +08:00
|
|
|
|
onPageSizeChange: handlePageSizeChange,
|
2025-06-07 02:51:38 +08:00
|
|
|
|
onPageChange: handlePageChange,
|
|
|
|
|
|
}}
|
|
|
|
|
|
loading={loading}
|
|
|
|
|
|
rowSelection={rowSelection}
|
|
|
|
|
|
onRow={handleRow}
|
2025-06-08 23:42:39 +08:00
|
|
|
|
empty={
|
|
|
|
|
|
<Empty
|
|
|
|
|
|
image={<IllustrationNoResult style={{ width: 150, height: 150 }} />}
|
|
|
|
|
|
darkModeImage={<IllustrationNoResultDark style={{ width: 150, height: 150 }} />}
|
|
|
|
|
|
description={t('搜索无结果')}
|
|
|
|
|
|
style={{ padding: 30 }}
|
|
|
|
|
|
/>
|
|
|
|
|
|
}
|
2025-06-07 02:51:38 +08:00
|
|
|
|
className="rounded-xl overflow-hidden"
|
|
|
|
|
|
size="middle"
|
|
|
|
|
|
></Table>
|
2025-05-23 00:24:08 +08:00
|
|
|
|
</Card>
|
2024-03-15 16:05:33 +08:00
|
|
|
|
</>
|
|
|
|
|
|
);
|
2023-04-23 11:31:00 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default TokensTable;
|