DESKTOP-O04BTUJ\muzen преди 2 години
родител
ревизия
40a0cedff1
променени са 1 файла, в които са добавени 6 реда и са изтрити 2 реда
  1. 6 2
      src/components/Upload/index.vue

+ 6 - 2
src/components/Upload/index.vue

@@ -61,7 +61,7 @@ export default {
   data() {
     return {
       // 上传地址
-      newAction: this.action,
+      newAction: baseUrl + this.action,
       // 请求头
       headers: {
         Authorization: "Bearer " + getToken(),
@@ -146,13 +146,18 @@ export default {
     onProgress(e) {
       this.percent = parseInt(e.percent)
       this.newTitle = `已上传${parseInt(e.percent - 1)}%`
+      this.$emit('loading')
+      this.visible = true
     },
+
     // 上传失败
     onError() {
       this.newTitle = `上传失败`
       this.btnType = `danger`
       this.isStatus = 'exception'
+      this.$emit('upload')
     },
+
     // 上传成功
     onSuccess(res) {
       if (this.listType === 'picture-card') {
@@ -163,7 +168,6 @@ export default {
         this.newTitle = '上传成功'
         this.btnType = 'success'
       }
-
       // 传参
       this.form.file = res.data
       this.$emit('upload', this.form)