Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9983dc5b
authored
Jun 28, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【解决todo】如果有生成中的图片,轮询改成 get 接口去轮询,不基于 page 轮询
parent
906169f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
src/views/ai/image/ImageTask.vue
+17
-10
No files found.
src/views/ai/image/ImageTask.vue
View file @
9983dc5b
...
...
@@ -78,12 +78,13 @@ const getImageList = async (apply: boolean = false) => {
}
pageTotal
.
value
=
total
// 需要 watch 的数据
imageList
.
value
.
map
(
item
=>
{
const
newWatImages
=
{}
imageList
.
value
.
forEach
(
item
=>
{
if
(
item
.
status
===
10
)
{
watchImages
.
value
[
item
.
id
]
=
item
newWatImages
[
item
.
id
]
=
item
}
})
watchImages
.
value
=
newWatImages
}
finally
{
if
(
imageTaskLoadingInstance
.
value
)
{
imageTaskLoadingInstance
.
value
.
close
()
...
...
@@ -98,18 +99,24 @@ const getImageList = async (apply: boolean = false) => {
const
refreshWatchImages
=
async
()
=>
{
const
imageIds
=
Object
.
keys
(
watchImages
.
value
)
if
(
imageIds
.
length
<
1
)
{
console
.
log
(
'refreshWatchImages 不刷新'
,
imageIds
)
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
=>
{
const
index
=
imageList
.
value
.
findIndex
(
oldImage
=>
image
.
id
===
oldImage
.
id
)
if
(
index
!==
-
1
)
{
// 更新 imageList
imageList
.
value
[
index
]
=
image
// 删除 watchImages
delete
watchImages
.
value
[
image
.
id
];
if
(
image
.
status
===
10
)
{
newWatchImages
[
image
.
id
]
=
image
}
else
{
const
index
=
imageList
.
value
.
findIndex
(
oldImage
=>
image
.
id
===
oldImage
.
id
)
if
(
index
!==
-
1
)
{
// 更新 imageList
imageList
.
value
[
index
]
=
image
}
}
})
console
.
log
(
'newWatchImages-done'
,
newWatchImages
)
watchImages
.
value
=
newWatchImages
}
/** 图片 - btn click */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment