From cb769fa2ed4513d7bf407b8ff52b9ef32e6d53d4 Mon Sep 17 00:00:00 2001 From: liangzai <2440983361@qq.com> Date: Sat, 21 Sep 2024 22:30:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BB=B6=E9=95=BF=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ui/(console)/projects/video-item.tsx | 40 +++++++++++++++++++++--- src/ui/login/login-form.tsx | 4 ++- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/ui/(console)/projects/video-item.tsx b/src/ui/(console)/projects/video-item.tsx index 881a2af..fd80601 100644 --- a/src/ui/(console)/projects/video-item.tsx +++ b/src/ui/(console)/projects/video-item.tsx @@ -3,9 +3,19 @@ import { IoEllipsisHorizontal } from "react-icons/io5"; import { useTranslations } from "next-intl"; import useFetch from "@/hooks/useFetch"; import { useEffect } from "react"; +import { useToast } from "@/contexts/ToastContext"; export default function VideoItem({ item }) { const t = useTranslations("videoItem"); // 使用翻译 + const { addToast } = useToast(); + const { + fetchData: extendVideo, + loading: extendVideoLoading, + data: extendVideoData, + } = useFetch({ + url: "/api/extend-video/", + method: "POST", + }); const getStatusBadge = (status) => { switch (status) { @@ -23,15 +33,22 @@ export default function VideoItem({ item }) { } }; + const handleExtendVideo = async () => { + if (extendVideoLoading) return; + try { + await extendVideo({ task_id: item.pid, motion_score: null }); // 假设你要传递video的ID + addToast(t("extendSuccess"), "success"); + window.location.reload(); // 请求成功后刷新页面 + } catch (error) { + console.error("Failed to extend video", error); + } + }; + return ( <>
- {/*
- {item.media_type} -
-
{item.slug}
*/}
diff --git a/src/ui/login/login-form.tsx b/src/ui/login/login-form.tsx index 5c01689..114529b 100644 --- a/src/ui/login/login-form.tsx +++ b/src/ui/login/login-form.tsx @@ -247,7 +247,9 @@ export default function LoginForm({ toRegister }: LoginFormProps) { {captchaLoading ? ( ) : captchaTimer > 0 ? ( - `${captchaTimer}s` + + {captchaTimer}s + ) : ( t("getCaptcha") )}