ck 复制格式优化,修复错误
This commit is contained in:
@@ -102,6 +102,7 @@ export interface CookieItem {
|
||||
created_at: string | null;
|
||||
cookie: string;
|
||||
cookie_preview: string;
|
||||
account_password: string;
|
||||
}
|
||||
|
||||
// ==================== Proxy ====================
|
||||
|
||||
@@ -83,13 +83,14 @@ export default function CookiePage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleCopyCookie = (cookie: string, username: string) => {
|
||||
if (!cookie) {
|
||||
const handleCopyCookie = (record: CookieItem) => {
|
||||
if (!record.cookie) {
|
||||
message.warning('Cookie 为空');
|
||||
return;
|
||||
}
|
||||
copyToClipboard(cookie).then(() => {
|
||||
message.success(`已复制 ${username} 的 Cookie`);
|
||||
const text = `${record.account_username}----${record.account_password || ''}----${record.cookie}`;
|
||||
copyToClipboard(text).then(() => {
|
||||
message.success(`已复制 ${record.account_username} 的 Cookie`);
|
||||
}).catch(() => {
|
||||
message.error('复制失败');
|
||||
});
|
||||
@@ -102,8 +103,8 @@ export default function CookiePage() {
|
||||
}
|
||||
const selected = cookies.filter((c) => selectedRowKeys.includes(c.id));
|
||||
const text = selected
|
||||
.map((c) => `${c.account_username}: ${c.cookie || '(空)'}`)
|
||||
.join('\n');
|
||||
.map((c) => `${c.account_username}----${c.account_password || ''}----${c.cookie || ''}`)
|
||||
.join('\r\n');
|
||||
copyToClipboard(text).then(() => {
|
||||
message.success(`已复制 ${selected.length} 条 Cookie`);
|
||||
}).catch(() => {
|
||||
@@ -190,7 +191,7 @@ export default function CookiePage() {
|
||||
<Button
|
||||
size="small"
|
||||
icon={<CopyOutlined />}
|
||||
onClick={() => handleCopyCookie(record.cookie, record.account_username)}
|
||||
onClick={() => handleCopyCookie(record)}
|
||||
>
|
||||
复制
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user