selectStyle生成加载样式调整

This commit is contained in:
X1627315083
2025-10-30 15:52:11 +08:00
parent 8cf7b6cb9a
commit bb67628e47
2 changed files with 18 additions and 3 deletions

View File

@@ -116,6 +116,12 @@ const {} = toRefs(data);
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
top: 0; top: 0;
left: 0; left: 0;
.van-loading {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
} }
> .icon{ > .icon{
position: absolute; position: absolute;

View File

@@ -20,6 +20,8 @@ let data = reactive({
styleList:computed(()=>generateStore.styleList), styleList:computed(()=>generateStore.styleList),
}) })
let getGenerateTime = null as any
const selectItem = (item)=>{ const selectItem = (item)=>{
if((item.id == data.select?.oldId) || !item.id || item.status != 'SUCCEEDED'){ if((item.id == data.select?.oldId) || !item.id || item.status != 'SUCCEEDED'){
return return
@@ -70,7 +72,6 @@ const getRequestOutfitList = (generateList)=>{
rv.forEach((item)=>{ rv.forEach((item)=>{
if(['RUNNING','PENDING'].includes(item.status))pendingList.push(item.requestId) if(['RUNNING','PENDING'].includes(item.status))pendingList.push(item.requestId)
let index = data.styleList.findIndex((styleItem)=>styleItem.taskId == item.requestId) let index = data.styleList.findIndex((styleItem)=>styleItem.taskId == item.requestId)
console.log(index,data.styleList,rv)
if(index != -1){ if(index != -1){
data.styleList[index].id = item.id data.styleList[index].id = item.id
data.styleList[index].path = item.path data.styleList[index].path = item.path
@@ -79,7 +80,7 @@ const getRequestOutfitList = (generateList)=>{
}) })
if(pendingList.length > 0){ if(pendingList.length > 0){
setTimeout(()=>{ getGenerateTime = setTimeout(()=>{
getRequestOutfitList(pendingList) getRequestOutfitList(pendingList)
},3000) },3000)
} }
@@ -90,9 +91,17 @@ onMounted(()=>{
// generateStore.clearProductData() // generateStore.clearProductData()
emit('view-type', 1) emit('view-type', 1)
// if(!data.styleList[0]?.id)getRequestOutfitList(0) // if(!data.styleList[0]?.id)getRequestOutfitList(0)
if(!data.styleList[0]?.id)requestOutfit({num:4,index:0}) if(getGenerateTime)clearTimeout(getGenerateTime)
if(!data.styleList[0]?.taskId){
requestOutfit({num:4,index:0})
}else if(data.styleList.filter((item)=>item?.status != 'SUCCEEDED').length > 0){
let generateList = data.styleList.map((item)=>item.taskId)
getRequestOutfitList(generateList)
}
}) })
onUnmounted(()=>{ onUnmounted(()=>{
if(getGenerateTime)clearTimeout(getGenerateTime)
generateStore.clearProductData()
}) })
defineExpose({}) defineExpose({})
const { styleList, select } = toRefs(data); const { styleList, select } = toRefs(data);