This commit is contained in:
lyp 2025-01-20 18:53:41 +08:00
parent 593995455d
commit 00a2c4597a
2 changed files with 33 additions and 38 deletions

View File

@ -188,6 +188,7 @@ export default function AiHelper(props: PropsType) {
} }
ws.current.onmessage = (event) => { ws.current.onmessage = (event) => {
// console.log('message', event); // console.log('message', event);
// console.log(event.data);
if (event.data == 'PONE') { if (event.data == 'PONE') {
return; return;
@ -244,6 +245,7 @@ export default function AiHelper(props: PropsType) {
projMods.forEach(projMod => projMod.id = uuid()) projMods.forEach(projMod => projMod.id = uuid())
setNewProjModArray(projMods); setNewProjModArray(projMods);
} else if (data.type == 'REFRESH_PROJ_MOD_FIELDS') { } else if (data.type == 'REFRESH_PROJ_MOD_FIELDS') {
// setIsProjModArrayLoading(true);
listMods(); listMods();
} }
} }
@ -402,7 +404,7 @@ export default function AiHelper(props: PropsType) {
url: `/api/proj/get/${props.projId}`, url: `/api/proj/get/${props.projId}`,
onSuccess({ data }) { onSuccess({ data }) {
// setAiStatus(data.aiSetting.settingStatus) // setAiStatus(data.aiSetting.settingStatus)
setStatus(data.generate.generateStatus) setStatus(data.generate.generateStatus)
if (data.aiSetting.introductionStatus == 'GENERATING') { if (data.aiSetting.introductionStatus == 'GENERATING') {
setIsFast(true) setIsFast(true)
@ -709,6 +711,11 @@ export default function AiHelper(props: PropsType) {
<div className='masksmall' style={{ display: activeTab == '模块' ? 'block' : 'none' }}> <div className='masksmall' style={{ display: activeTab == '模块' ? 'block' : 'none' }}>
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjModArrayLoading}> <Spin tip="正在处理,请稍后..." size="small" spinning={isProjModArrayLoading}>
<AiHelperMod mods={projModArray} <AiHelperMod mods={projModArray}
setIsProjModArrayLoading={
() => {
setIsProjModArrayLoading(true);
}
}
setisFast={() => { setisFast={() => {
setIsFast(true) setIsFast(true)
}} }}
@ -844,12 +851,12 @@ export default function AiHelper(props: PropsType) {
onClick={() => { onClick={() => {
if (status == 'SUCCESS') { if (status == 'SUCCESS') {
return; return;
}else if(isFast){ } else if (isFast) {
messageApi.open({ messageApi.open({
type: 'error', type: 'error',
content: 'AI正在生成,无法更换登录页面', content: 'AI正在生成,无法更换登录页面',
}); });
}else { } else {
setloginpageId(item.loginpageId) setloginpageId(item.loginpageId)
put({ put({
messageApi, messageApi,
@ -864,7 +871,7 @@ export default function AiHelper(props: PropsType) {
type: 'success', type: 'success',
content: '已更改' content: '已更改'
}) })
getLoginPageInfo() getLoginPageInfo()
@ -873,12 +880,12 @@ export default function AiHelper(props: PropsType) {
}, },
// 请求结束 // 请求结束
onFinally() { onFinally() {
// setIsProjModArrayLoading(false); // setIsProjModArrayLoading(false);
}, },
}) })
@ -933,7 +940,7 @@ export default function AiHelper(props: PropsType) {
if (status == 'SUCCESS') { if (status == 'SUCCESS') {
return; return;
}else if(isFast){ } else if (isFast) {
messageApi.open({ messageApi.open({
type: 'error', type: 'error',
content: 'AI正在生成,无法更换页面样式', content: 'AI正在生成,无法更换页面样式',
@ -986,7 +993,7 @@ export default function AiHelper(props: PropsType) {
<Pagination <Pagination
showSizeChanger={false} showSizeChanger={false}
defaultCurrent={1} total={pageTotal} defaultPageSize={20} onChange={(page) => { defaultCurrent={1} total={pageTotal} defaultPageSize={20} onChange={(page) => {
console.log(page); // console.log(page);
// setPage(page) // setPage(page)
setpageImgArray([]) setpageImgArray([])
getPageImgData(page) getPageImgData(page)

View File

@ -39,7 +39,8 @@ type PropsType = {
xixi: any; xixi: any;
projIntroduction: string; projIntroduction: string;
isFast: boolean; isFast: boolean;
setisFast:any setisFast:any;
setIsProjModArrayLoading:any;
} }
type ProjModType = { type ProjModType = {
@ -72,37 +73,24 @@ export default function AiHelperMod(props: PropsType) {
// }, [modArray, newModArray]); // }, [modArray, newModArray]);
// const key = `open${Date.now()}`; // const key = `open${Date.now()}`;
useEffect(() => { useEffect(() => {
// console.log('mods', props.mods);
setModArray(props.mods); setModArray(props.mods);
setNewModArray(props.newMods); setNewModArray(props.newMods);
// if (props.newMods.length > 0 ) { get<any>({
// notification.open({ messageApi,
// message: '提示', url: `/api/proj/get/${pathParams.projId}`,
// description: onSuccess({ data }) {
// `功能列表已生成完毕,是否前去查看?`, // console.log('其他页面状态判断', data);
// btn: ( // setStatus(data.generate.generateStatus)
// <div> if(data.aiSetting.modsStatus=='GENERATING'){
// <Button size="small" type="primary" onClick={() => { // console.log('嘻嘻');
// notification.destroy(key) props.setIsProjModArrayLoading()
// props.setActiveTab('模块')
// }}> }
// 确定 }
// </Button> })
// </div>
// ),
// key,
// onClose: close,
// // duration: null,
// placement: 'bottomRight', // 设置通知框显示在右下角
// style: {
// width: 300, // 设置通知框的宽度
// height: 150, // 设置通知框的高度
// },
// });
// }
}, [props.mods, props.newMods]); }, [props.mods, props.newMods]);
// useEffect(() => { // useEffect(() => {
// // console.log('mods', props.mods); // // console.log('mods', props.mods);