From 593995455d8cae40c19f8ad2f1c9b6bbff3b3060 Mon Sep 17 00:00:00 2001 From: lyp Date: Mon, 20 Jan 2025 16:44:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90=E4=B8=AD=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ai/AiHelper.tsx | 51 +++++++++++++++++++++++++++++++--- src/util/AjaxUtils.ts | 2 ++ 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/components/ai/AiHelper.tsx b/src/components/ai/AiHelper.tsx index a886482..8fb6a7b 100644 --- a/src/components/ai/AiHelper.tsx +++ b/src/components/ai/AiHelper.tsx @@ -391,6 +391,7 @@ export default function AiHelper(props: PropsType) { websocket(); }, [globalContext.user.userId, props.projId]); + // const [aiStatus, setAiStatus] = useState(false) useEffect(() => { // getLoginPageInfo() getlistLoginpage(1) @@ -400,7 +401,8 @@ export default function AiHelper(props: PropsType) { messageApi, url: `/api/proj/get/${props.projId}`, onSuccess({ data }) { - // console.log('其他页面状态判断', data); + // setAiStatus(data.aiSetting.settingStatus) + setStatus(data.generate.generateStatus) if (data.aiSetting.introductionStatus == 'GENERATING') { setIsFast(true) @@ -578,6 +580,16 @@ export default function AiHelper(props: PropsType) {
{ + // if(isFast){ + // // alert('无法点击') + // messageApi.open({ + // type: 'error', + // content: 'AI正在生成,无法更换登陆页面', + // }); + // }else{ + // setActiveTab('登录') + // getLoginPageInfo() + // } setActiveTab('登录') getLoginPageInfo() }} @@ -586,6 +598,15 @@ export default function AiHelper(props: PropsType) {
{ + // if(isFast){ + // messageApi.open({ + // type: 'error', + // content: 'AI正在生成,无法更换页面样式', + // }) + // }else{ + // setActiveTab('页面') + // getData() + // } setActiveTab('页面') getData() @@ -822,26 +843,43 @@ export default function AiHelper(props: PropsType) { style={{ marginRight: '10px', marginBottom: '10px', width: 210, height: 120, borderRadius: 15 }} onClick={() => { if (status == 'SUCCESS') { - return; - } else { + }else if(isFast){ + messageApi.open({ + type: 'error', + content: 'AI正在生成,无法更换登录页面', + }); + }else { setloginpageId(item.loginpageId) put({ messageApi, url: `/api/proj/update-loginpage-id/proj-id/${props.projId}/loginpage-id/${item.loginpageId}`, - + // 请求前 + onBefore() { + // setIsProjModArrayLoading(true); + }, onSuccess() { messageApi.open({ type: 'success', content: '已更改' }) + + + getLoginPageInfo() // props.closeModal() // props.closeModal() }, + + // 请求结束 + onFinally() { + // setIsProjModArrayLoading(false); + + + }, }) } @@ -895,6 +933,11 @@ export default function AiHelper(props: PropsType) { if (status == 'SUCCESS') { return; + }else if(isFast){ + messageApi.open({ + type: 'error', + content: 'AI正在生成,无法更换页面样式', + }); } else { setcodeTypePageId(item.codeTypePageId) put({ diff --git a/src/util/AjaxUtils.ts b/src/util/AjaxUtils.ts index ab696be..e242f28 100644 --- a/src/util/AjaxUtils.ts +++ b/src/util/AjaxUtils.ts @@ -150,6 +150,8 @@ export function put(req: Req) { req.onSuccess(res); }).catch(error => { if (error.response) { + // console.log(error.response.data); + const data = error.response.data; req.messageApi.open({ type: 'error',