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) => {
// 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) {
<div className='masksmall' style={{ display: activeTab == '模块' ? 'block' : 'none' }}>
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjModArrayLoading}>
<AiHelperMod mods={projModArray}
setIsProjModArrayLoading={
() => {
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) {
<Pagination
showSizeChanger={false}
defaultCurrent={1} total={pageTotal} defaultPageSize={20} onChange={(page) => {
console.log(page);
// console.log(page);
// setPage(page)
setpageImgArray([])
getPageImgData(page)

View File

@ -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: (
// <div>
// <Button size="small" type="primary" onClick={() => {
// notification.destroy(key)
// props.setActiveTab('模块')
// }}>
// 确定
// </Button>
// </div>
// ),
// key,
// onClose: close,
// // duration: null,
// placement: 'bottomRight', // 设置通知框显示在右下角
// style: {
// width: 300, // 设置通知框的宽度
// height: 150, // 设置通知框的高度
// },
// });
// }
get<any>({
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);