selectStyle生成加载样式调整
This commit is contained in:
@@ -116,6 +116,12 @@ const {} = toRefs(data);
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
top: 0;
|
||||
left: 0;
|
||||
.van-loading {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
> .icon{
|
||||
position: absolute;
|
||||
|
||||
@@ -20,6 +20,8 @@ let data = reactive({
|
||||
styleList:computed(()=>generateStore.styleList),
|
||||
})
|
||||
|
||||
let getGenerateTime = null as any
|
||||
|
||||
const selectItem = (item)=>{
|
||||
if((item.id == data.select?.oldId) || !item.id || item.status != 'SUCCEEDED'){
|
||||
return
|
||||
@@ -70,7 +72,6 @@ const getRequestOutfitList = (generateList)=>{
|
||||
rv.forEach((item)=>{
|
||||
if(['RUNNING','PENDING'].includes(item.status))pendingList.push(item.requestId)
|
||||
let index = data.styleList.findIndex((styleItem)=>styleItem.taskId == item.requestId)
|
||||
console.log(index,data.styleList,rv)
|
||||
if(index != -1){
|
||||
data.styleList[index].id = item.id
|
||||
data.styleList[index].path = item.path
|
||||
@@ -79,7 +80,7 @@ const getRequestOutfitList = (generateList)=>{
|
||||
})
|
||||
|
||||
if(pendingList.length > 0){
|
||||
setTimeout(()=>{
|
||||
getGenerateTime = setTimeout(()=>{
|
||||
getRequestOutfitList(pendingList)
|
||||
},3000)
|
||||
}
|
||||
@@ -90,9 +91,17 @@ onMounted(()=>{
|
||||
// generateStore.clearProductData()
|
||||
emit('view-type', 1)
|
||||
// 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(()=>{
|
||||
if(getGenerateTime)clearTimeout(getGenerateTime)
|
||||
generateStore.clearProductData()
|
||||
})
|
||||
defineExpose({})
|
||||
const { styleList, select } = toRefs(data);
|
||||
|
||||
Reference in New Issue
Block a user