import {Button, Divider, Empty, Space} from "antd"; import TextArea from "antd/es/input/TextArea"; import {useEffect, useState} from "react"; import {CheckOutlined, EditOutlined, ReloadOutlined} from "@ant-design/icons"; import { get } from "../../../util/AjaxUtils.ts"; import { useParams } from "react-router-dom"; import { message } from "antd"; type PropsType = { title: string; maxLength: number; text: string; newText: string; handleGenerate: () => void; handleSave: (newText: string) => void; } export default function AiHelperText(props: PropsType) { const pathParams = useParams(); const [status, setStatus] = useState('') useEffect(() => { get({ messageApi, url: `/api/proj/get/${pathParams.projId}`, onSuccess({ data }) { console.log('其他页面状态判断', data); setStatus(data.generate.generateStatus) } }) }, []) const [messageApi] = message.useMessage(); const [text, setText] = useState(''); const [newText, setNewText] = useState(''); const [isTextEdit, setIsTextEdit] = useState(false); const [isNewTextEdit, setIsNewTextEdit] = useState(false); useEffect(() => { setText(props.text); setNewText(props.newText); }, [props.text, props.newText]) const renderTextBtn = () => { if (!newText) { if (!isTextEdit) { return ( { text ? ( ) : <> } ) } return ( ) } if (!isNewTextEdit) { return ( ) } return ( ) } const renderTextDom = () => { if(!text) { return } if(!isTextEdit) { return
{text}
} return (