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) setIsProjDescLoading(true)
setIsProjModArrayLoading(true) setIsProjModArrayLoading(true)
} }
if (data.aiSetting.introductionStatus == 'SUCCESS') {
setIsFast(true)
}
if (data.aiSetting.descStatus == 'GENERATING') { if (data.aiSetting.descStatus == 'GENERATING') {
setIsFast(true)
setIsProjDescLoading(true) setIsProjDescLoading(true)
} }
if (data.aiSetting.modsStatus == 'GENERATING' ) { if (data.aiSetting.modsStatus == 'GENERATING') {
setIsFast(true)
setIsProjModArrayLoading(true) setIsProjModArrayLoading(true)
// alert('模块正在生成中') // alert('模块正在生成中')
} }
if(data.aiSetting.descStatus == 'NONE'&& data.aiSetting.settingStatus == 'GENERATING'){ // if(data.aiSetting.descStatus == 'NONE'&& data.aiSetting.settingStatus == 'GENERATING'){
setIsProjDescLoading(true) // setIsProjDescLoading(true)
} // }
if(data.aiSetting.modsStatus == 'NONE'&& data.aiSetting.settingStatus == 'GENERATING'){ // if(data.aiSetting.modsStatus == 'NONE'&& data.aiSetting.settingStatus == 'GENERATING'){
setIsProjModArrayLoading(true) // setIsProjModArrayLoading(true)
} // }
} }
}) })
}, []) }, [])
@ -627,6 +626,9 @@ 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={isProjIntroductionLoading}> <Spin tip="正在处理,请稍后..." size="small" spinning={isProjIntroductionLoading}>
<AiHelperText <AiHelperText
setisFast={() => {
setIsFast(true)
}}
isFast={isFast} isFast={isFast}
title="系统简介" title="系统简介"
text={projIntroduction} text={projIntroduction}
@ -658,6 +660,9 @@ export default function AiHelper(props: PropsType) {
<Spin tip="正在处理,请稍后..." size="small" spinning={isProjDescLoading}> <Spin tip="正在处理,请稍后..." size="small" spinning={isProjDescLoading}>
<AiHelperText title="系统详情" <AiHelperText title="系统详情"
isFast={isFast} isFast={isFast}
setisFast={() => {
setIsFast(true)
}}
text={projDesc} text={projDesc}
projIntroduction={projIntroduction} projIntroduction={projIntroduction}
newText={newProjDesc} newText={newProjDesc}
@ -683,6 +688,9 @@ 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}
setisFast={() => {
setIsFast(true)
}}
isFast={isFast} isFast={isFast}
projIntroduction={projIntroduction} projIntroduction={projIntroduction}
xixi={() => { xixi={() => {

View File

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

View File

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

View File

@ -46,9 +46,10 @@ import green from '../../static/projBox/green.png'
import red from '../../static/projBox/red.png' import red from '../../static/projBox/red.png'
import blue from '../../static/projBox/blue.png' import blue from '../../static/projBox/blue.png'
import black from '../../static/projBox/black.png' import black from '../../static/projBox/black.png'
import { useNavigate } from "react-router-dom";
export default function Correction() { export default function Correction() {
// 标签变量 // 标签变量
const nav = useNavigate();
// const [tagDataIds, setTagDataIds] = useState<any[]>([]) // const [tagDataIds, setTagDataIds] = useState<any[]>([])
const height = window.innerHeight - 180; const height = window.innerHeight - 180;
const [messageApi, contextHolder] = message.useMessage(); const [messageApi, contextHolder] = message.useMessage();
@ -927,7 +928,7 @@ export default function Correction() {
: <> : <>
{correctionArray.map((item: any, index: any) => { {correctionArray.map((item: any, index: any) => {
// setBack(item.tagDataIds.includes(part1)?true:false) // setBack(item.tagDataIds.includes(part1)?true:false)
const downCode = [ const downCode = [
{ {
key: 'downword', key: 'downword',
@ -935,6 +936,13 @@ export default function Correction() {
<div <div
style={{ width: 100, display: 'flex', justifyContent: 'center', alignItems: 'center' }} style={{ width: 100, display: 'flex', justifyContent: 'center', alignItems: 'center' }}
onClick={() => { 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}`) 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' }} style={{ width: 100, display: 'flex', justifyContent: 'center', alignItems: 'center' }}
onClick={() => { 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}`) 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' }} style={{ width: 100, display: 'flex', justifyContent: 'center', alignItems: 'center' }}
onClick={() => { 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}`) window.open(`${Axios.defaults?.baseURL}/route/proj/download/manual/correction/${item.projId}`)
}} }}
> >
Word Word
@ -980,6 +1002,12 @@ export default function Correction() {
style={{ width: 100, display: 'flex', justifyContent: 'center', alignItems: 'center' }} style={{ width: 100, display: 'flex', justifyContent: 'center', alignItems: 'center' }}
onClick={() => { 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}`) window.open(`${Axios.defaults?.baseURL}/route/proj/download/manual/correction/pdf/${item.projId}`)
}} }}
> >
@ -1013,7 +1041,11 @@ export default function Correction() {
</div> </div>
<div className='projBoxTop'> <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} {item.projName}
</div> </div>
<div className='correctionType'> <div className='correctionType'>
@ -1043,7 +1075,7 @@ export default function Correction() {
}} }}
onClick={ onClick={
(e:any) => { (e: any) => {
// 获取点击的这个盒子的背景色 // 获取点击的这个盒子的背景色