heyujie
2022-06-16 3e998850b5c4af147a60ed0b86b47379fc9eb1f2
src/pages/ai/FileUpload/uploader.vue
@@ -41,6 +41,9 @@
        return {}
      }
    },
    sourceType: {
      type: Number,
    },
    options: {
      type: Object,
      default() {
@@ -83,6 +86,16 @@
      }
    },
    filesAdded(files, fileList) {
      if (this.sourceType == 3 && files[0]) {
        if (
          !files[0].name.endsWith(".tar") ||
          !files[0].name.endsWith(".gz") ||
          !files[0].name.endsWith(".tar.gz")
        ) {
          this.shouldStop = true
          return
        }
      }
      this.$emit(kebabCase(FILES_ADDED_EVENT), files, fileList)
      if (files.ignored || fileList.ignored) {
        // is ignored, filter it
@@ -94,6 +107,16 @@
      this.fileList = this.uploader.fileList
    },
    filesSubmitted(files, fileList) {
      if (this.sourceType == 3&& files[0]) {
        if (
          !files[0].name.endsWith(".tar") ||
          !files[0].name.endsWith(".gz") ||
          !files[0].name.endsWith(".tar.gz")
        ) {
          this.shouldStop = true
          return
        }
      }
      this.files = this.uploader.files
      this.fileList = this.uploader.fileList
      if (this.autoStart) {
@@ -101,7 +124,6 @@
      }
    },
    allEvent(...args) {
      console.log(args)
      const name = args[0]
      const EVENTSMAP = {
        [FILE_ADDED_EVENT]: true,
@@ -123,7 +145,6 @@
    }
  },
  created() {
    // console.log('uploader attrs',this.attrs);
    // this.bindUploader();
    this.options.initialPaused = !this.autoStart
    const uploader = new Uploader(this.options)