生成中无法更换页面样式

This commit is contained in:
lyp 2025-01-20 16:44:48 +08:00
parent 28426205c4
commit 593995455d
2 changed files with 49 additions and 4 deletions

View File

@ -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) {
</div>
<div className={activeTab == '登录' ? 'tabActive' : "aiTabBtn"}
onClick={() => {
// if(isFast){
// // alert('无法点击')
// messageApi.open({
// type: 'error',
// content: 'AI正在生成,无法更换登陆页面',
// });
// }else{
// setActiveTab('登录')
// getLoginPageInfo()
// }
setActiveTab('登录')
getLoginPageInfo()
}}
@ -586,6 +598,15 @@ export default function AiHelper(props: PropsType) {
</div>
<div className={activeTab == '页面' ? 'tabActive' : "aiTabBtn"}
onClick={() => {
// if(isFast){
// messageApi.open({
// type: 'error',
// content: 'AI正在生成,无法更换页面样式',
// })
// }else{
// setActiveTab('页面')
// getData()
// }
setActiveTab('页面')
getData()
@ -822,20 +843,30 @@ export default function AiHelper(props: PropsType) {
style={{ marginRight: '10px', marginBottom: '10px', width: 210, height: 120, borderRadius: 15 }}
onClick={() => {
if (status == 'SUCCESS') {
return;
}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()
@ -843,6 +874,13 @@ export default function AiHelper(props: PropsType) {
},
// 请求结束
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({

View File

@ -150,6 +150,8 @@ export function put<T>(req: Req<T>) {
req.onSuccess(res);
}).catch(error => {
if (error.response) {
// console.log(error.response.data);
const data = error.response.data;
req.messageApi.open({
type: 'error',