|
@@ -171,8 +171,6 @@ export default {
|
|
|
},
|
|
|
}).then((res) => {
|
|
|
if (res.code == 200 && res.info) {
|
|
|
- // console.log(res.info);
|
|
|
-
|
|
|
if (this.percentage >= res.info * 100) {
|
|
|
if (+res.info === 0) {
|
|
|
this.step++;
|
|
@@ -213,23 +211,40 @@ export default {
|
|
|
willUpload() {
|
|
|
this.isUploading = true;
|
|
|
|
|
|
- // this.timer = setInterval(() => {
|
|
|
- // this.onProgress();
|
|
|
- // }, 4500);
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ if (this.percentage >= 99) {
|
|
|
+ this.percentage = 99;
|
|
|
+ clearInterval(this.timer);
|
|
|
+ this.timer = null;
|
|
|
+ } else {
|
|
|
+ this.percentage++;
|
|
|
+ }
|
|
|
+ console.log(this.percentage);
|
|
|
+ }, 4500);
|
|
|
},
|
|
|
// 上传完成
|
|
|
didUpload(state) {
|
|
|
+ if (this.timer) {
|
|
|
+ clearInterval(this.timer);
|
|
|
+ this.timer = null;
|
|
|
+ }
|
|
|
+
|
|
|
this.isUploading = false;
|
|
|
- // clearInterval(this.timer);
|
|
|
- // this.timer = null;
|
|
|
this.percentage = 0;
|
|
|
// this.step = 0;
|
|
|
this.objectPath = this.$getObjectPathByRandom();
|
|
|
},
|
|
|
// 进度变化
|
|
|
percentageChange(val) {
|
|
|
- if (val > 100) val = 100;
|
|
|
- this.percentage = val;
|
|
|
+ if (this.timer) {
|
|
|
+ clearInterval(this.timer);
|
|
|
+ this.timer = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.percentage < val) {
|
|
|
+ if (val > 99) val = 99;
|
|
|
+ this.percentage = val;
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
|