jiangping
2025-06-27 95d6add8b4c4175c0fb596b1ac03faf27ca53f55
提交一把订单
已修改1个文件
13 ■■■■ 文件已修改
company/src/components/common/uploadProgress.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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)
              }
            }
          })