From 5f479405fceb19d26184689d2681f3e0d8bc14aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=82=E5=B1=91?= <80164656+boxie123@users.noreply.github.com> Date: Sun, 31 Dec 2023 23:39:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8Dwebui?= =?UTF-8?q?=E4=B8=80=E4=BA=9Bbug=20(#726)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix: 新增/修改配置时报错 * Fix: 不开始录制 * Fix: 更新LiveStreamer表时报错 --- .env.production | 1 + app/dashboard/page.tsx | 19 ++++++++++++++----- app/ui/TemplateFields.tsx | 6 +++--- app/upload-manager/edit/page.tsx | 5 +++-- biliup/app.py | 2 +- biliup/config.py | 3 ++- biliup/database/db.py | 12 +++++++++++- biliup/web/__init__.py | 12 ++++++++---- 8 files changed, 43 insertions(+), 17 deletions(-) diff --git a/.env.production b/.env.production index e69de29..6e2d2cf 100644 --- a/.env.production +++ b/.env.production @@ -0,0 +1 @@ +NEXT_PUBLIC_API_SERVER=http://localhost:19159 \ No newline at end of file diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx index 58feefe..531413f 100644 --- a/app/dashboard/page.tsx +++ b/app/dashboard/page.tsx @@ -14,6 +14,12 @@ const Dashboard: React.FC = () => { const { data: entity, error, isLoading } = useSWR("/v1/configuration", fetcher); const { trigger } = useSWRMutation("/v1/configuration", put); const formRef = useRef(); + const [formKey, setFormKey] = useState(0); // 初始化一个key + + // 触发表单重新挂载 + const remountForm = () => { + setFormKey(prevKey => prevKey + 1); // 更新key的值 + }; const [labelPosition, setLabelPosition] = useState<'top' | 'left' | 'inset'>('inset'); useEffect(() => { @@ -27,6 +33,10 @@ const Dashboard: React.FC = () => { }) return () => unRegister(); }, []); + + useEffect(() => { + remountForm(); + }, [entity]); // const handleSelectChange = (value) => { // let text = value === 'male' ? 'Hi male' : 'Hi female!'; // formRef.current?.setValue('Note', text); @@ -50,7 +60,8 @@ const Dashboard: React.FC = () => { > -
{ await trigger(values) }} @@ -62,11 +73,11 @@ const Dashboard: React.FC = () => { label={{text: "分段大小"} } suffix={'MB'} /> - = ({ formState, formApi, values }) = const {biliUsers} = useBiliUsers(); const list = biliUsers?.map((item) => { return { - value: item.id, label: <> + value: item.value, label: <> {item.name} @@ -64,7 +64,7 @@ const TemplateFields: React.FC = ({ formState, formApi, values }) = field="copyright" label='类型' direction='vertical' - initValue={1} + // initValue={1} >
formApi.setValue('source', '')}> 自制 @@ -97,7 +97,7 @@ const TemplateFields: React.FC = ({ formState, formApi, values }) = style={{width: 560}} />