From 00a2c4597a09c26f17bb6e9f1a2c0a40a729e617 Mon Sep 17 00:00:00 2001 From: lyp Date: Mon, 20 Jan 2025 18:53:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ai/AiHelper.tsx | 25 +++++++++------ src/components/ai/mod/AiHelperMod.tsx | 46 ++++++++++----------------- 2 files changed, 33 insertions(+), 38 deletions(-) diff --git a/src/components/ai/AiHelper.tsx b/src/components/ai/AiHelper.tsx index 8fb6a7b..611d909 100644 --- a/src/components/ai/AiHelper.tsx +++ b/src/components/ai/AiHelper.tsx @@ -188,6 +188,7 @@ export default function AiHelper(props: PropsType) { } ws.current.onmessage = (event) => { // console.log('message', event); + // console.log(event.data); if (event.data == 'PONE') { return; @@ -244,6 +245,7 @@ export default function AiHelper(props: PropsType) { projMods.forEach(projMod => projMod.id = uuid()) setNewProjModArray(projMods); } else if (data.type == 'REFRESH_PROJ_MOD_FIELDS') { + // setIsProjModArrayLoading(true); listMods(); } } @@ -402,7 +404,7 @@ export default function AiHelper(props: PropsType) { url: `/api/proj/get/${props.projId}`, onSuccess({ data }) { // setAiStatus(data.aiSetting.settingStatus) - + setStatus(data.generate.generateStatus) if (data.aiSetting.introductionStatus == 'GENERATING') { setIsFast(true) @@ -709,6 +711,11 @@ export default function AiHelper(props: PropsType) {
{ + setIsProjModArrayLoading(true); + } + } setisFast={() => { setIsFast(true) }} @@ -844,12 +851,12 @@ export default function AiHelper(props: PropsType) { onClick={() => { if (status == 'SUCCESS') { return; - }else if(isFast){ + } else if (isFast) { messageApi.open({ type: 'error', content: 'AI正在生成,无法更换登录页面', }); - }else { + } else { setloginpageId(item.loginpageId) put({ messageApi, @@ -864,7 +871,7 @@ export default function AiHelper(props: PropsType) { type: 'success', content: '已更改' }) - + getLoginPageInfo() @@ -873,12 +880,12 @@ export default function AiHelper(props: PropsType) { }, - + // 请求结束 onFinally() { // setIsProjModArrayLoading(false); - - + + }, }) @@ -933,7 +940,7 @@ export default function AiHelper(props: PropsType) { if (status == 'SUCCESS') { return; - }else if(isFast){ + } else if (isFast) { messageApi.open({ type: 'error', content: 'AI正在生成,无法更换页面样式', @@ -986,7 +993,7 @@ export default function AiHelper(props: PropsType) { { - console.log(page); + // console.log(page); // setPage(page) setpageImgArray([]) getPageImgData(page) diff --git a/src/components/ai/mod/AiHelperMod.tsx b/src/components/ai/mod/AiHelperMod.tsx index 2183a1c..d0d13a4 100644 --- a/src/components/ai/mod/AiHelperMod.tsx +++ b/src/components/ai/mod/AiHelperMod.tsx @@ -39,7 +39,8 @@ type PropsType = { xixi: any; projIntroduction: string; isFast: boolean; - setisFast:any + setisFast:any; + setIsProjModArrayLoading:any; } type ProjModType = { @@ -72,37 +73,24 @@ export default function AiHelperMod(props: PropsType) { // }, [modArray, newModArray]); // const key = `open${Date.now()}`; useEffect(() => { - // console.log('mods', props.mods); + setModArray(props.mods); setNewModArray(props.newMods); - // if (props.newMods.length > 0 ) { - // notification.open({ - // message: '提示', - // description: - // `功能列表已生成完毕,是否前去查看?`, - // btn: ( - //
- // - //
- - // ), - // key, - // onClose: close, - // // duration: null, - // placement: 'bottomRight', // 设置通知框显示在右下角 - // style: { - // width: 300, // 设置通知框的宽度 - // height: 150, // 设置通知框的高度 - // }, - - // }); - // } + get({ + messageApi, + url: `/api/proj/get/${pathParams.projId}`, + onSuccess({ data }) { + // console.log('其他页面状态判断', data); + // setStatus(data.generate.generateStatus) + if(data.aiSetting.modsStatus=='GENERATING'){ + // console.log('嘻嘻'); + props.setIsProjModArrayLoading() + + } + } + }) + }, [props.mods, props.newMods]); // useEffect(() => { // // console.log('mods', props.mods);