From abb39d7ce29d965ab5d4565048fa58ee2a7799e6 Mon Sep 17 00:00:00 2001 From: chenshihai Date: Thu, 21 Jul 2022 14:50:42 +0800 Subject: [PATCH] =?UTF-8?q?fix=20#2370=20=E3=80=90=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E3=80=91=E6=8F=90=E4=BA=A4=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E5=90=8E=E9=A1=B5=E9=9D=A2=E6=B2=A1=E6=9C=89=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/repo/debugjob/index.tmpl | 1 + web_src/js/components/images/Images.vue | 40 ++++++++++++++++++++----- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/templates/repo/debugjob/index.tmpl b/templates/repo/debugjob/index.tmpl index 043816e9f..5381602b9 100755 --- a/templates/repo/debugjob/index.tmpl +++ b/templates/repo/debugjob/index.tmpl @@ -427,6 +427,7 @@ {{if .CanDebug}} {{$.i18n.Tr "repo.submit_image"}} {{else}} 私有 公开 - - + + - - + + - - + + @@ -473,6 +473,7 @@ export default { tableDataCustom: [], starCustom:[], loadingCustom:false, + refreshCustomTimer: null, currentPageStar:1, pageSizeStar:10, @@ -485,6 +486,7 @@ export default { methods: { handleClick(tab, event) { this.search = '' + this.stopImageListCustomRefresh(); if(tab.name=="first"){ this.paramsPublic.q = '' this.getImageListPublic() @@ -560,9 +562,31 @@ export default { }); this.loadingCustom = false + this.getImageListCustomRefresh() }) }, + getImageListCustomRefresh() { + this.stopImageListCustomRefresh(); + this.refreshCustomTimer = setInterval(() => { + this.tableDataCustom.forEach(item => { + if (item.status === 0) { + this.$axios.get(`/image/${item.id}`, {}).then((res) => { + const newData = res.data; + this.tableDataCustom.forEach(it => { + if (it.id === newData.id) { + it.status = newData.status; + } + }); + }) + } + }); + }, 5000); + }, + + stopImageListCustomRefresh() { + this.refreshCustomTimer && clearInterval(this.refreshCustomTimer); + }, getImageListStar(){ this.loadingStar = true this.$axios.get('/explore/images/star',{ @@ -715,8 +739,10 @@ export default { else{ this.getImageListPublic() } + }, + beforeDestroy() { + this.stopImageListCustomRefresh(); } - };