fix bug for waterflow component

This commit is contained in:
RockYang
2024-05-05 10:52:29 +08:00
parent 1232c3cd9c
commit 142cd553a3
5 changed files with 30 additions and 19 deletions

View File

@@ -315,7 +315,7 @@
<el-empty :image-size="100" v-else/>
</div>
<h2>创作记录</h2>
<div class="finish-job-list" v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.5)">
<div class="finish-job-list">
<div v-if="finishedJobs.length > 0">
<ItemList :items="finishedJobs" :width="240" :gap="16">
<template #default="scope">
@@ -632,11 +632,14 @@ const initData = () => {
fetchFinishJobs()
connect()
}).catch(() => {
loading.value = false
});
}
const fetchRunningJobs = () => {
if (!isLogin.value) {
return
}
// 获取运行中的任务
httpGet(`/api/sd/jobs?status=0`).then(res => {
const jobs = res.data
@@ -671,10 +674,11 @@ const handleScrollEnd = () => {
const page = ref(1)
const pageSize = ref(15)
const isOver = ref(false)
const loading = ref(false)
// 获取已完成的任务
const fetchFinishJobs = (page) => {
loading.value = true
if (!isLogin.value) {
return
}
httpGet(`/api/sd/jobs?status=1&page=${page}&page_size=${pageSize.value}`).then(res => {
if (res.data.length < pageSize.value) {
isOver.value = true
@@ -684,9 +688,7 @@ const fetchFinishJobs = (page) => {
} else {
finishedJobs.value = finishedJobs.value.concat(res.data)
}
loading.value = false
}).catch(e => {
loading.value = false
ElMessage.error("获取任务失败:" + e.message)
})
}