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',