From 3e998850b5c4af147a60ed0b86b47379fc9eb1f2 Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期四, 16 六月 2022 15:42:33 +0800
Subject: [PATCH] bei bei ke

---
 src/pages/ai/FileUpload/uploader.vue |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/pages/ai/FileUpload/uploader.vue b/src/pages/ai/FileUpload/uploader.vue
index 14735e4..69705de 100644
--- a/src/pages/ai/FileUpload/uploader.vue
+++ b/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)

--
Gitblit v1.8.0