diff --git a/src/stores/modules/h_generate.ts b/src/stores/modules/h_generate.ts index cbb76b8..6b614f1 100644 --- a/src/stores/modules/h_generate.ts +++ b/src/stores/modules/h_generate.ts @@ -52,6 +52,12 @@ export const useHGenerateStore = defineStore({ this.customizeInfo.styleUrl = '' this.customizeInfo.isRegenerated = '' this.customizeInfo.isFavorite = false + }, + /** 上传服装 */ + uploadStyle(data: object) { + for (const key in data) { + this.style[key] = data[key] + } }, uploadCustomizeInfo(data: object) { for (const key in data) { diff --git a/src/views/Workshop/selectStyle/index.vue b/src/views/Workshop/selectStyle/index.vue index a3b832d..f3ea353 100644 --- a/src/views/Workshop/selectStyle/index.vue +++ b/src/views/Workshop/selectStyle/index.vue @@ -25,7 +25,7 @@ const loadingTitle = computed(()=>{ let str = '' if(!select.value.status)str = 'Analyzing the Outfit...' if(select.value.status == 'RUNNING')str = 'Generating Results...' - if(select.value.status == 'PENDING')str = 'Almost there...' + if(select.value.status == 'PENDING' || select.value.status == 'ALMOST_DONE')str = 'Almost there...' return str }) @@ -65,11 +65,12 @@ const toProduct = ()=>{ // if(generateStore.style.id){ // generateStore.setIsGenerate(true) // } - if(!isHistoryFlow.value){ - router.push({ path: 'product', query: {...query.value} }) - }else{ - router.push({ path: 'creation', query: {...query.value, active: FlowType.H_OUTFIT} }) - } + router.push({ path: 'product', query: {...query.value} }) + // if(!isHistoryFlow.value){ + // router.push({ path: 'product', query: {...query.value} }) + // }else{ + // router.push({ path: 'creation', query: {...query.value, active: FlowType.H_OUTFIT} }) + // } } const requestOutfit = async ({num})=>{ @@ -103,6 +104,7 @@ const getRequestOutfitList = (generateList)=>{ let value = {requestIDs:generateList.join(',')} getRequestOutfit(value).then((rv:any)=>{ let selectIndex = rv.findIndex((item)=>item.requestId == data.select.taskId) + console.log(selectIndex) if(selectIndex != -1){ data.select.id = rv[selectIndex].id data.select.path = rv[selectIndex].path @@ -118,9 +120,24 @@ const getRequestOutfitList = (generateList)=>{ } }) - if(['SUCCEEDED'].includes(data.select.status))isLoading.value = false + if(['SUCCEEDED'].includes(data.select.status)){ + isLoading.value = false + if(isHistoryFlow.value){ + hGenerateStore.uploadStyle({ + id: data.select.id, + path: data.select.path, + }) + } + } + if(data.styleList.filter((item)=>item?.status == 'FAILED').length > 0){ + showToast({ + message: 'One of the outfits failed to generate. Please try generating again.', + duration: 2000, + }) + isLoading.value = false + } const taskIdList = data.styleList - .filter(item => item?.taskId && item?.status !== 'SUCCEEDED') + .filter(item => item?.taskId && (item?.status !== 'SUCCEEDED' && item?.status !== 'FAILED')) .map(item => item.taskId); if(taskIdList.length > 0){ getGenerateTime = setTimeout(()=>{