diff --git a/frontend/src/app/shorts/page.tsx b/frontend/src/app/shorts/page.tsx
index 2a9811f..4094c74 100644
--- a/frontend/src/app/shorts/page.tsx
+++ b/frontend/src/app/shorts/page.tsx
@@ -17,6 +17,7 @@ import {
} from "lucide-react";
import { DouyinLiveBadge } from "@/components/DouyinLiveBadge";
+import { EnableSwitch } from "@/components/EnableSwitch";
import { Shell } from "@/components/Shell";
import { useConfirm } from "@/components/ConfirmDialog";
import { useToast } from "@/components/Toast";
@@ -150,6 +151,7 @@ export default function ShortsPage() {
const [form, setForm] = useState({ ...emptyForm });
const [editId, setEditId] = useState("");
const [busy, setBusy] = useState(false);
+ const [togglingId, setTogglingId] = useState("");
const [msg, setMsg] = useState("");
const [error, setError] = useState("");
const [jobFilter, setJobFilter] = useState("");
@@ -549,6 +551,16 @@ export default function ShortsPage() {
async function toggleChannelEnabled(ch: Channel) {
const turningOn = ch.enabled === false;
+ if (!turningOn) {
+ const ok = await confirm({
+ title: `停用「${ch.name}」?`,
+ message: "关闭后将立即清除该频道全部任务与成片,并停止取样/录制/上传。可随时再开。",
+ confirmLabel: "停用并清任务",
+ destructive: true,
+ });
+ if (!ok) return;
+ }
+ setTogglingId(ch.id);
try {
const r = await fetchJson(`/api/shorts/channels/${ch.id}`, {
method: "PATCH",
@@ -557,7 +569,7 @@ export default function ShortsPage() {
const cleared = r.cleared as { jobs?: number; clips?: number } | undefined;
if (!turningOn && cleared) {
toast.push(
- `已停用「${ch.name}」· 清除任务 ${cleared.jobs ?? 0} · 成片 ${cleared.clips ?? 0}`,
+ `已停用 · 清除任务 ${cleared.jobs ?? 0} · 成片 ${cleared.clips ?? 0}`,
"ok",
);
} else {
@@ -566,6 +578,8 @@ export default function ShortsPage() {
await load();
} catch (e) {
toast.push((e as Error).message, "err");
+ } finally {
+ setTogglingId("");
}
}
@@ -1203,8 +1217,14 @@ export default function ShortsPage() {
return (
@@ -1218,18 +1238,13 @@ export default function ShortsPage() {
/>
{full ? (
-
+
void toggleChannelEnabled(full)}
+ />
) : null}
diff --git a/frontend/src/app/tiktok/page.tsx b/frontend/src/app/tiktok/page.tsx
index c8dbf53..32ca5d0 100644
--- a/frontend/src/app/tiktok/page.tsx
+++ b/frontend/src/app/tiktok/page.tsx
@@ -16,6 +16,7 @@ import {
import { Shell } from "@/components/Shell";
import { useConfirm } from "@/components/ConfirmDialog";
import { useToast } from "@/components/Toast";
+import { EnableSwitch } from "@/components/EnableSwitch";
import { PageLoader } from "@/components/ui";
import {
TikTokUpcomingUploadRow,
@@ -130,6 +131,7 @@ export default function TikTokPage() {
const rightPanelRef = useRef
(null);
const [loading, setLoading] = useState(true);
+ const [togglingId, setTogglingId] = useState("");
const [status, setStatus] = useState(null);
const [channels, setChannels] = useState([]);
const [socksProfiles, setSocksProfiles] = useState([]);
@@ -421,6 +423,16 @@ export default function TikTokPage() {
const toggleChannelEnabled = async (ch: Channel) => {
const turningOn = ch.enabled === false;
+ if (!turningOn) {
+ const ok = await confirm({
+ title: `停用「${ch.name}」?`,
+ message: "关闭后将立即清除该账号全部任务与成片,并停止取样/录制/上传。可随时再开。",
+ confirmLabel: "停用并清任务",
+ destructive: true,
+ });
+ if (!ok) return;
+ }
+ setTogglingId(ch.id);
try {
const r = await fetchJson(`/api/tiktok/channels/${ch.id}`, {
method: "PATCH",
@@ -429,7 +441,7 @@ export default function TikTokPage() {
const cleared = r.cleared as { jobs?: number; clips?: number } | undefined;
if (!turningOn && cleared) {
toast.push(
- `已停用「${ch.name}」· 清除任务 ${cleared.jobs ?? 0} · 成片 ${cleared.clips ?? 0}`,
+ `已停用 · 清除任务 ${cleared.jobs ?? 0} · 成片 ${cleared.clips ?? 0}`,
"ok",
);
} else {
@@ -438,6 +450,8 @@ export default function TikTokPage() {
void load();
} catch (e: any) {
toast.push(e?.message || "切换失败", "err");
+ } finally {
+ setTogglingId("");
}
};
@@ -1156,9 +1170,20 @@ export default function TikTokPage() {
-
- {full?.authorized ? "Cookie 就绪" : "未配置"}
-
+
+ {full ? (
+ void toggleChannelEnabled(full)}
+ />
+ ) : null}
+
+ {full?.authorized ? "Cookie 就绪" : "未配置"}
+
+
{(full?.follower_count || full?.video_count || full?.heart_count) ? (
@@ -1220,15 +1245,6 @@ export default function TikTokPage() {
刷新资料
) : null}
- {full && (
-
- )}
{full && (