瀏覽代碼

优化算法上传

zhangliang2 3 年之前
父節點
當前提交
815f66f28e

+ 2 - 1
src/components/upload/upload.vue

@@ -140,7 +140,7 @@ export default {
                             this.attachmentList.push({
                                 // attachmentName: file.file.name,
                                 // attachmentAddress: res.params,
-                                md5: defaultParam.md5,
+                                md5: defaultParam.md5 || "",
                                 // uid: file.file.uid,
                                 fileType: file.file.type,
                                 fileName: res.info.fileName,
@@ -153,6 +153,7 @@ export default {
                         } else {
                             this.$message.error(res.message || "上传失败");
                             this.$emit("didUpload", "fail");
+                            reject("失败");
                         }
                     })
                     .catch((err) => {

+ 11 - 13
src/views/algorithmsLibrary/exportAlgorithms.vue

@@ -115,7 +115,7 @@ export default {
             objectPath: "", // 用于上传文件的传参
             isUploading: false,
             uploadUrl: this.$api.common.uploadProcessBar,
-            timer: "", // 用来接收进度条的定时器
+            timer: null, // 用来接收进度条的定时器
             percentage: 0, // 进度条数据
             customColor: "", // 进度条颜色
         };
@@ -170,10 +170,9 @@ export default {
                     objectPath: this.objectPath,
                 },
             }).then((res) => {
-                // console.log(res);
                 if (res.code == 200 && res.info) {
                     console.log(res.info);
-                    
+
                     if (this.percentage >= res.info * 100) {
                         if (this.percentage < 99) {
                             ++this.percentage;
@@ -190,7 +189,9 @@ export default {
 
                     if (!this.isUploading) {
                         clearInterval(this.timer);
+                        this.timer = null;
                         this.percentage = 0;
+                        this.objectPath = this.$getObjectPathByRandom();
                     }
                 } else {
                     this.$message.error(res.message || "获取进度信息失败");
@@ -200,24 +201,16 @@ export default {
         willUpload() {
             this.isUploading = true;
 
-            // let timer = setTimeout(() => {
-            //     this.isUploading = true;
-            //     this.onProgress();
-            //     clearTimeout(timer);
-            // }, 100);
-
             this.timer = setInterval(() => {
                 this.onProgress();
-                if (!this.isUploading) {
-                    clearInterval(this.timer);
-                    this.percentage = 0;
-                }
             }, 4500);
         },
         didUpload(state) {
             this.isUploading = false;
             clearInterval(this.timer);
+            this.timer = null;
             this.percentage = 0;
+            this.objectPath = this.$getObjectPathByRandom();
         },
     },
 
@@ -245,6 +238,11 @@ export default {
             });
         }
     },
+
+    beforeDestroy() {
+        clearInterval(this.timer);
+        this.timer = null;
+    }
 };
 </script>
 

+ 1 - 0
src/views/modelLibrary/components/modelList.vue

@@ -163,6 +163,7 @@ export default {
 
             li {
                 margin-top: 10px;
+                word-break: break-all;
 
                 span,
                 i {

+ 4 - 4
vue.config.js

@@ -89,8 +89,8 @@ module.exports = {
                 // target: 'http://10.15.12.70/simulation',
                 // target: 'http://10.15.12.70:7001', // 登录
                 // target: 'http://10.15.12.73:7003',  // 王志强
-                target: 'http://10.15.12.70', // windowstest
-                // target: 'http://10.15.12.87:8001',  // 赵艳
+                // target: 'http://10.15.12.70', // windowstest
+                target: 'http://10.15.12.87:8001',  // 赵艳
                 // target: 'http://192.168.30.75',  // gq
                 // target: 'http://47.94.105.148',  // aliyun
                 // target: 'http://10.15.12.74:8001',
@@ -102,9 +102,9 @@ module.exports = {
             },
             '/simulation/resource/server': {
                 // target: 'http://10.15.12.73:7003', // 王志强
-                target: 'http://10.15.12.88:7003', // 王耀栋
+                // target: 'http://10.15.12.88:7003', // 王耀栋
                 // target: 'http://10.15.12.72:7003',  // 王晓峰
-                // target: 'http://10.15.12.87:7003',  // 赵艳
+                target: 'http://10.15.12.87:7003',  // 赵艳
                 // target: 'http://10.15.12.70',  // windowstest
                 // target: 'http://192.168.30.75',  // gq
                 // target: 'http://47.94.105.148',  // aliyun