kuaifan 5 anos atrás
pai
commit
48b29bb007

+ 10 - 1
resources/assets/js/main/components/ImgUpload.vue

@@ -318,7 +318,11 @@
         data () {
             return {
                 actionUrl: $A.aUrl('imgupload'),
-                params: {'token': $A.token(), 'width': this.width, 'height': this.height},
+                params: {
+                    token: $A.getToken(),
+                    width: this.width,
+                    height: this.height
+                },
                 multiple: this.num > 1,
                 visible: false,
                 browseVisible: false,
@@ -463,6 +467,11 @@
                         content: this.$L('最多只能上传 % 张图片。', this.maxNum)
                     });
                 }
+                this.params = {
+                    token: $A.getToken(),
+                    width: this.width,
+                    height: this.height
+                };
                 return check;
             },
             handleClick() {

+ 17 - 2
resources/assets/js/main/components/project/task/files.vue

@@ -33,7 +33,8 @@
                     :max-size="10240"
                     :on-success="handleSuccess"
                     :on-format-error="handleFormatError"
-                    :on-exceeded-size="handleMaxSize">
+                    :on-exceeded-size="handleMaxSize"
+                    :before-upload="handleBeforeUpload">
                     <Button :loading="loadIng > 0" type="primary" icon="ios-cloud-upload-outline" @click="">{{$L('上传文件')}}</Button>
                 </Upload>
             </Row>
@@ -101,7 +102,11 @@
 
                 uploadFormat: ['jpg', 'jpeg', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt'],
                 actionUrl: $A.aUrl('project/files/upload'),
-                params: {'token': $A.token(), taskid:this.taskid, projectid:this.projectid},
+                params: {
+                    token: $A.getToken(),
+                    taskid: this.taskid,
+                    projectid: this.projectid
+                },
                 uploadList: [],
             }
         },
@@ -521,6 +526,16 @@
                     content: this.$L('文件 % 太大,不能超过2M。', file.name)
                 });
             },
+
+            handleBeforeUpload () {
+                //上传前判断
+                this.params = {
+                    token: $A.getToken(),
+                    taskid: this.taskid,
+                    projectid: this.projectid
+                };
+                return true;
+            },
         }
     }
 </script>