【解决todo】如果有生成中的图片,轮询改成 get 接口去轮询,不基于 page 轮询
parent
906169f9be
commit
9983dc5bb9
|
@ -78,12 +78,13 @@ const getImageList = async (apply: boolean = false) => {
|
||||||
}
|
}
|
||||||
pageTotal.value = total
|
pageTotal.value = total
|
||||||
// 需要 watch 的数据
|
// 需要 watch 的数据
|
||||||
imageList.value.map(item => {
|
const newWatImages = {}
|
||||||
|
imageList.value.forEach(item => {
|
||||||
if (item.status === 10) {
|
if (item.status === 10) {
|
||||||
watchImages.value[item.id] = item
|
newWatImages[item.id] = item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
watchImages.value = newWatImages
|
||||||
} finally {
|
} finally {
|
||||||
if (imageTaskLoadingInstance.value) {
|
if (imageTaskLoadingInstance.value) {
|
||||||
imageTaskLoadingInstance.value.close()
|
imageTaskLoadingInstance.value.close()
|
||||||
|
@ -98,18 +99,24 @@ const getImageList = async (apply: boolean = false) => {
|
||||||
const refreshWatchImages = async () => {
|
const refreshWatchImages = async () => {
|
||||||
const imageIds = Object.keys(watchImages.value)
|
const imageIds = Object.keys(watchImages.value)
|
||||||
if (imageIds.length < 1) {
|
if (imageIds.length < 1) {
|
||||||
|
console.log('refreshWatchImages 不刷新', imageIds)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const res = await ImageApi.getImageMyIds({ids: imageIds.join(',')}) as ImageRespVO[]
|
const res = await ImageApi.getImageMyIds({ids: imageIds.join(',')}) as ImageVO[]
|
||||||
|
const newWatchImages = {}
|
||||||
res.forEach(image => {
|
res.forEach(image => {
|
||||||
const index = imageList.value.findIndex(oldImage => image.id === oldImage.id)
|
if (image.status === 10) {
|
||||||
if (index !== -1) {
|
newWatchImages[image.id] = image
|
||||||
// 更新 imageList
|
} else {
|
||||||
imageList.value[index] = image
|
const index = imageList.value.findIndex(oldImage => image.id === oldImage.id)
|
||||||
// 删除 watchImages
|
if (index !== -1) {
|
||||||
delete watchImages.value[image.id];
|
// 更新 imageList
|
||||||
|
imageList.value[index] = image
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
console.log('newWatchImages-done', newWatchImages)
|
||||||
|
watchImages.value = newWatchImages
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 图片 - btn click */
|
/** 图片 - btn click */
|
||||||
|
|
Loading…
Reference in New Issue