feat(weibo): 增加外部 CK 单行复制

This commit is contained in:
yml2213
2026-11-08 14:13:01 +08:00
parent 5b42577b0b
commit 66b4f72994
8 changed files with 126 additions and 1 deletions
@@ -86,6 +86,7 @@ export default function WeiboAccountsPage() {
const { can } = usePermissions();
const canImport = can('weibo:import');
const canManage = can('weibo:manage');
const canExportCk = can('weibo:account:ck_export');
const canBind = can('weibo:bind');
const canRecharge = can('weibo:recharge');
const canExchange = can('weibo:exchange');
@@ -100,6 +101,7 @@ export default function WeiboAccountsPage() {
const [enabledFilter, setEnabledFilter] = useState('');
const [loading, setLoading] = useState(false);
const [refreshingId, setRefreshingId] = useState<number | null>(null);
const [copyingId, setCopyingId] = useState<number | null>(null);
const [mutatingId, setMutatingId] = useState<number | null>(null);
const [selectedIds, setSelectedIds] = useState<number[]>([]);
const [batchBusy, setBatchBusy] = useState(false);
@@ -216,6 +218,19 @@ export default function WeiboAccountsPage() {
}
};
const handleCopyCk = async (account: WeiboAccountItem) => {
setCopyingId(account.id);
try {
const result = await weiboApi.copyAccountCk(account.id);
await copyTextToClipboard(result.ck_text);
message.success(`${account.nickname || account.uid} 的 CK 已复制`);
} catch (error) {
message.error(getErrorMessage(error));
} finally {
setCopyingId(null);
}
};
const openQr = (account: WeiboAccountItem) => {
if (!account.is_enabled) {
message.warning('账号已停用,请先启用');
@@ -699,6 +714,16 @@ export default function WeiboAccountsPage() {
>
功能
</Button>
{canExportCk && (
<Button
size="small"
icon={<CopyOutlined />}
loading={copyingId === account.id}
onClick={() => void handleCopyCk(account)}
>
复制CK
</Button>
)}
{canManage && (
<Button
size="small"