From 208b887f79a48d840a88bf2e27470631f4e6e65d Mon Sep 17 00:00:00 2001 From: lq1405 <2769838458@qq.com> Date: Sat, 22 Feb 2025 14:58:48 +0800 Subject: [PATCH] =?UTF-8?q?Laitool=20=E8=AE=BE=E7=BD=AE=E4=B8=AD=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=BB=98=E5=9B=BE=E8=AE=BE=E7=BD=AE=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0fluxapi=E6=A8=A1=E5=9E=8B=E5=88=97=E8=A1=A8=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + .../BasicOptions/ImageOptions.tsx | 73 +++++++++++++++++++ .../BasicOptions/SimpleOptions/index.tsx | 9 ++- .../BasicOptions/TrialOptions/index.tsx | 12 +-- .../LaitoolOptions/BasicOptions/index.tsx | 17 +++-- .../DubSetting/DubSettingTTsOptions/index.tsx | 27 +++++-- .../LaitoolOptions/DubSetting/index.tsx | 35 ++------- src/services/enum/optionEnum.ts | 8 ++ 8 files changed, 138 insertions(+), 44 deletions(-) create mode 100644 src/pages/Options/LaitoolOptions/BasicOptions/ImageOptions.tsx diff --git a/package.json b/package.json index c3c41ee..e3f033d 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "@ant-design/icons": "^4.8.1", "@ant-design/pro-components": "^2.7.19", "@umijs/route-utils": "^2.2.2", + "ahooks": "^3.8.4", "antd": "^5.21.3", "antd-style": "^3.6.2", "axios": "^1.7.7", diff --git a/src/pages/Options/LaitoolOptions/BasicOptions/ImageOptions.tsx b/src/pages/Options/LaitoolOptions/BasicOptions/ImageOptions.tsx new file mode 100644 index 0000000..1030877 --- /dev/null +++ b/src/pages/Options/LaitoolOptions/BasicOptions/ImageOptions.tsx @@ -0,0 +1,73 @@ +import React, { useEffect } from 'react'; +import { Form, Card, Row, Col, InputNumber, Button, Input, message } from 'antd'; +import TextArea from 'antd/es/input/TextArea'; +import { useSoftStore } from '@/store/software'; +import { GetOptions, getOptionsStringValue, SaveOptions } from '@/services/services/options/optionsTool'; +import { OptionKeyName } from '@/services/enum/optionEnum'; + +interface ImageOptionsProps { + // Add your props here + visible?: boolean; +} + +const ImageOptions: React.FC = ({ visible }) => { + const [form] = Form.useForm(); + const { setTopSpinning, setTopSpinTip } = useSoftStore(); + const [messageApi, messageHolder] = message.useMessage(); + + useEffect(() => { + if (!visible) return; + setTopSpinning(true); + setTopSpinTip("加载信息中"); + GetOptions("image").then((res) => { + form.setFieldsValue({ + [OptionKeyName.LaitoolFluxApiModelList]: getOptionsStringValue(res, OptionKeyName.LaitoolFluxApiModelList, "{}"), + }); + }).catch((err: any) => { + messageApi.error(err.message); + }).finally(() => { + setTopSpinning(false); + }); + + }, [visible]); + + const onFinish = async (values: any) => { + setTopSpinning(true); + setTopSpinTip("正在保存试用设置"); + try { + await SaveOptions(values); + messageApi.success('保存软件试用设置成功'); + } catch (error: any) { + messageApi.error(error.message); + } finally { + setTopSpinning(false); + } + } + + return ( + + +
+ + + +