ai窗口状态判断

This commit is contained in:
lyp 2025-01-20 08:50:05 +08:00
parent 5229b5d906
commit c124031c70
4 changed files with 77 additions and 27 deletions

View File

@ -408,23 +408,22 @@ export default function AiHelper(props: PropsType) {
setIsProjDescLoading(true)
setIsProjModArrayLoading(true)
}
if (data.aiSetting.introductionStatus == 'SUCCESS') {
setIsFast(true)
}
if (data.aiSetting.descStatus == 'GENERATING') {
setIsFast(true)
setIsProjDescLoading(true)
}
if (data.aiSetting.modsStatus == 'GENERATING' ) {
if (data.aiSetting.modsStatus == 'GENERATING') {
setIsFast(true)
setIsProjModArrayLoading(true)
// alert('模块正在生成中')
}
if(data.aiSetting.descStatus == 'NONE'&& data.aiSetting.settingStatus == 'GENERATING'){
setIsProjDescLoading(true)
}
if(data.aiSetting.modsStatus == 'NONE'&& data.aiSetting.settingStatus == 'GENERATING'){
setIsProjModArrayLoading(true)
}
// if(data.aiSetting.descStatus == 'NONE'&& data.aiSetting.settingStatus == 'GENERATING'){
// setIsProjDescLoading(true)
// }
// if(data.aiSetting.modsStatus == 'NONE'&& data.aiSetting.settingStatus == 'GENERATING'){
// setIsProjModArrayLoading(true)
// }
}
})
}, [])
@ -627,6 +626,9 @@ export default function AiHelper(props: PropsType) {
<div className='masksmall' style={{ display: activeTab == '简介' ? 'block' : 'none' }}>
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjIntroductionLoading}>
<AiHelperText
setisFast={() => {
setIsFast(true)
}}
isFast={isFast}
title="系统简介"
text={projIntroduction}
@ -658,6 +660,9 @@ export default function AiHelper(props: PropsType) {
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjDescLoading}>
<AiHelperText title="系统详情"
isFast={isFast}
setisFast={() => {
setIsFast(true)
}}
text={projDesc}
projIntroduction={projIntroduction}
newText={newProjDesc}
@ -683,6 +688,9 @@ export default function AiHelper(props: PropsType) {
<div className='masksmall' style={{ display: activeTab == '模块' ? 'block' : 'none' }}>
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjModArrayLoading}>
<AiHelperMod mods={projModArray}
setisFast={() => {
setIsFast(true)
}}
isFast={isFast}
projIntroduction={projIntroduction}
xixi={() => {

View File

@ -39,6 +39,7 @@ type PropsType = {
xixi: any;
projIntroduction: string;
isFast: boolean;
setisFast:any
}
type ProjModType = {
@ -495,6 +496,7 @@ export default function AiHelperMod(props: PropsType) {
,
<span style={{ color: '#FF9D00', cursor: 'pointer' }}
onClick={() => {
props.setisFast()
if (props.isFast) {
return
} else {
@ -551,6 +553,7 @@ export default function AiHelperMod(props: PropsType) {
}}
disabled={status == 'SUCCESS' || status == 'GENERATING' || props.isFast ? true : false}
onClick={() => {
props.setisFast()
if(props.projIntroduction){
props.handleGenerate()
}else{

View File

@ -31,9 +31,11 @@ type PropsType = {
setActiveTab: (key: string) => void;
projIntroduction: string;
isFast: boolean;
setisFast:any
}
export default function AiHelperText(props: PropsType) {
// const [isDisabled, setIsDisabled] = useState(false); //是否禁用一键生成按钮
const height = window.innerHeight - 265;
const pathParams = useParams();
const [status, setStatus] = useState('')
@ -42,8 +44,11 @@ export default function AiHelperText(props: PropsType) {
messageApi,
url: `/api/proj/get/${pathParams.projId}`,
onSuccess({ data }) {
// console.log('其他页面状态判断', data);
console.log('其他页面状态判断嘻嘻嘻', data);
setStatus(data.generate.generateStatus)
// if(data.aiSetting.introductionStatus == 'GENERATING' || data.aiSetting.descStatus == 'GENERATING' || data.aiSetting.descStatus == 'GENERATING') {
// setIsDisabled(true)
// }
}
})
@ -241,6 +246,7 @@ export default function AiHelperText(props: PropsType) {
,
<span style={{ color: '#FF9D00', cursor: 'pointer' }}
onClick={() => {
props.setisFast()
if (props.isFast) {
return
} else {
@ -414,13 +420,14 @@ export default function AiHelperText(props: PropsType) {
}}
></Button>
<Button
disabled={status == 'SUCCESS' || status == 'GENERATING' || props.isFast ? true : false}
disabled={status == 'SUCCESS' || status == 'GENERATING' || props.isFast ? true : false }
// size="large"
type="primary" style={{
width: 109,
marginLeft: 15,
}}
onClick={() => {
props.setisFast()
if (props.title == '系统简介') {
props.xixi()
}

View File

@ -46,9 +46,10 @@ import green from '../../static/projBox/green.png'
import red from '../../static/projBox/red.png'
import blue from '../../static/projBox/blue.png'
import black from '../../static/projBox/black.png'
import { useNavigate } from "react-router-dom";
export default function Correction() {
// 标签变量
const nav = useNavigate();
// const [tagDataIds, setTagDataIds] = useState<any[]>([])
const height = window.innerHeight - 180;
const [messageApi, contextHolder] = message.useMessage();
@ -935,6 +936,13 @@ export default function Correction() {
<div
style={{ width: 100, display: 'flex', justifyContent: 'center', alignItems: 'center' }}
onClick={() => {
// alert(item.correctionType);
// if (item.correctionType == 'ALL') {
// window.open(`${Axios.defaults?.baseURL}/route/proj/download/code/${item.projId}`)
// } else {
// window.open(`${Axios.defaults?.baseURL}/route/proj/download/code/correction/${item.projId}`)
// }
window.open(`${Axios.defaults?.baseURL}/route/proj/download/code/correction/${item.projId}`)
}}
>
@ -949,6 +957,12 @@ export default function Correction() {
style={{ width: 100, display: 'flex', justifyContent: 'center', alignItems: 'center' }}
onClick={() => {
// if (item.correctionType == 'ALL') {
// window.open(`${Axios.defaults?.baseURL}/route/proj/download/code/pdf/${item.projId}`)
// } else {
// window.open(`${Axios.defaults?.baseURL}/route/proj/download/code/correction/pdf/${item.projId}`)
// }
window.open(`${Axios.defaults?.baseURL}/route/proj/download/code/correction/pdf/${item.projId}`)
}}
>
@ -966,7 +980,15 @@ export default function Correction() {
style={{ width: 100, display: 'flex', justifyContent: 'center', alignItems: 'center' }}
onClick={() => {
// if (item.correctionType == 'ALL') {
// window.open(`${Axios.defaults?.baseURL}/route/proj/download/manual/${item.projId}`)
// } else {
// window.open(`${Axios.defaults?.baseURL}/route/proj/download/manual/correction/${item.projId}`)
// }
window.open(`${Axios.defaults?.baseURL}/route/proj/download/manual/correction/${item.projId}`)
}}
>
Word
@ -980,6 +1002,12 @@ export default function Correction() {
style={{ width: 100, display: 'flex', justifyContent: 'center', alignItems: 'center' }}
onClick={() => {
// if (item.correctionType == 'ALL') {
// window.open(`${Axios.defaults?.baseURL}/route/proj/download/manual/pdf/${item.projId}`)
// } else {
// window.open(`${Axios.defaults?.baseURL}/route/proj/download/manual/correction/pdf/${item.projId}`)
// }
window.open(`${Axios.defaults?.baseURL}/route/proj/download/manual/correction/pdf/${item.projId}`)
}}
>
@ -1013,7 +1041,11 @@ export default function Correction() {
</div>
<div className='projBoxTop'>
<div className='projName' title={item.projName}>
<div className='projName' onClick={() => {
nav(`/proj-edit/${item.projId}`);
sessionStorage.setItem('projName', item.projName);
sessionStorage.setItem('projStatus', item.generate.generateStatus == 'SUCCESS' ? '查看' : '编辑');
}} title={item.projName}>
{item.projName}
</div>
<div className='correctionType'>
@ -1043,7 +1075,7 @@ export default function Correction() {
}}
onClick={
(e:any) => {
(e: any) => {
// 获取点击的这个盒子的背景色