From f7a3d41075e00498f7033475108c0bcd86cda733 Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期二, 01 七月 2025 14:03:13 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/2.0.1' into 2.0.1 --- company/src/components/common/uploadProgress.vue | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/company/src/components/common/uploadProgress.vue b/company/src/components/common/uploadProgress.vue index 1583d49..bfddd5a 100644 --- a/company/src/components/common/uploadProgress.vue +++ b/company/src/components/common/uploadProgress.vue @@ -50,6 +50,7 @@ return { loading:null, uuid: null, + timer: null, message:'寮�濮嬩笂浼�', uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload', uploadProgressUrl: process.env.VUE_APP_API_PREFIX + '/public' @@ -101,9 +102,15 @@ } }) .catch(e => { + if(this.timer){ + clearInterval(this.timer) + } this.$message.error(e) }) .finally(() => { + if(this.timer){ + clearInterval(this.timer) + } that.loading.close() this.$refs.file.value = null }) @@ -112,7 +119,7 @@ }, startProgress () { var that = this - var timer = setInterval(function () { + this.timer = setInterval(function () { axios.get(that.uploadProgressUrl + '/' + that.uuid) .then(res => { if (res != null && res.data && res.data.data) { @@ -125,13 +132,13 @@ // document.getElementById('progressBar').value = 100 // document.getElementById('status').textContent = '宸插畬鎴�' + 100 + '%' that.loading.setText( '宸插畬鎴� 銆� ' + 100 + ' 銆�%') - clearInterval(timer) + clearInterval(that.timer) } else if (res.data.data.status === 3){ const percentCompleted = Math.round(res.data.data.rate || 0) // document.getElementById('progressBar').value = percentCompleted // document.getElementById('status').textContent = '涓婁紶澶辫触' + percentCompleted + '%' that.loading.setText('涓婁紶澶辫触 銆� ' + percentCompleted + ' 銆�%') - clearInterval(timer) + clearInterval(that.timer) } } }) -- Gitblit v1.9.3