Browse Source

Merge branch 'feature_20260506_增加照片上传进度UI效果' into uat(dev)

zhujindu 2 ngày trước cách đây
mục cha
commit
d91c4f5d5c
1 tập tin đã thay đổi với 14 bổ sung11 xóa
  1. 14 11
      src/components/uploadVNormalTaskPhoto.vue

+ 14 - 11
src/components/uploadVNormalTaskPhoto.vue

@@ -387,8 +387,7 @@ export default {
     },
     // 正常流程
     normalFlow(res) {
-      this.runD2(100);
-      this.$nextTick(() => {
+      this.runD2(100, false, () => {
         clearTimeout(this.d2timer);
         this.uploadImgFlag = false;
         this.$toast('上传成功!');
@@ -471,9 +470,9 @@ export default {
       if (this.d2running) return;
       this.d2running = true;
       this.d2count = 0;
-      this.runD2(1200);
+      this.runD2(1200, true);
     },
-    runD2(delay) {
+    runD2(delay, isFirst, callback) {
       //   this.NAMES = Array.from(
       //     { length: this.uploadImgTotal },
       //     (_, i) => `IMG_${String(2001 + i).padStart(4, '0')}.jpg`,
@@ -481,6 +480,7 @@ export default {
       if (this.d2count >= this.uploadImgTotal) {
         document.getElementById('d2sub').textContent = '完成';
         document.getElementById('d2name').textContent = '全部上传成功 ✅';
+        callback && callback();
         return;
       }
       if (this.uploadImgTotal >= 2) {
@@ -496,18 +496,21 @@ export default {
           const offset = 251.2 * (1 - this.d2count / this.uploadImgTotal);
           document.getElementById('d2ring').style.strokeDashoffset = offset;
           document.getElementById('d2sub').textContent = `${this.d2count}/${this.uploadImgTotal}`;
-          if (this.d2count >= Math.floor(this.uploadImgTotal * 0.8)) {
+          if (this.d2count >= Math.floor(this.uploadImgTotal * 0.8) && isFirst) {
             clearTimeout(this.d2timer);
             return;
           }
-          this.runD2(delay);
+          this.runD2(delay, isFirst, callback);
         }, delay);
       } else {
-        document.getElementById(`dot0`).className = 'ring-dot active';
-        document.getElementById('d2name').textContent = '正在上传。。。';
-        document.getElementById('d2pct').textContent = '50%';
-        document.getElementById('d2ring').style.strokeDashoffset = 50;
-        document.getElementById('d2sub').textContent = `0/${this.uploadImgTotal}`;
+        this.$nextTick(() => {
+          document.getElementById(`dot0`).className = 'ring-dot active';
+          document.getElementById('d2name').textContent = '正在上传。。。';
+          this.d2count++;
+          document.getElementById('d2pct').textContent = '50%';
+          document.getElementById('d2ring').style.strokeDashoffset = 50;
+          document.getElementById('d2sub').textContent = `0/${this.uploadImgTotal}`;
+        });
       }
     },
   },