Browse Source

解决不能上传exe文件的问题

sunjh 5 years ago
parent
commit
45bfbaf5b7

+ 9 - 19
src/components/project/Project.vue

@@ -782,27 +782,17 @@ export default {
       notify('error', '删除失败:'+error)
     },
     beforeApkUpload (file) {
-      const isAPK = file.type === 'application/vnd.android.package-archive'
-      const isDMG = file.type === 'application/octet-stream'
-
-      if (!isAPK && !isDMG) {
-        this.$message.error('上传安装包只能是 APK 或 DMG 格式!')
-      }
-      return isAPK || isDMG
+      return true;
+      //const fileTypeList = ['dmg', 'exe', 'apk']
+      //return checkFileType(file, fileTypeList, this.beforeFileUploadError)
     },
     beforeFileUpload (file) {
-      console.log(file)
-      const isPDF = file.type === 'application/pdf'
-      const isDOC = file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
-      const isEXCEL = file.type === 'application/vnd.ms-excel'
-      const isXLS = file.type === 'application/x-xls'
-      const isTXT = file.type === 'text/plain'
-      const isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
-      //console.log(file)
-      if (!(isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX)) {
-        this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
-      }
-      return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
+      return true;
+      //const fileTypeList = ['pdf', 'xls', 'xlsx', 'doc', 'docx', 'txt']
+      //return checkFileType(file, fileTypeList, this.beforeFileUploadError)
+    },
+    beforeFileUploadError () {
+      this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
     },
     analyseDemand () {
       this.$router.push({name: 'AnalyseDemand'})

+ 6 - 4
src/components/project/ProjectCreate.vue

@@ -414,15 +414,17 @@ export default {
       this.project.budget = ''
     },
     beforeApkUpload (file) {
-      const fileType = ['exe', 'apk', 'dmg']
-      return checkFileType(file, fileType, this.beforeApkUploadError)
+      return true;
+      //const fileType = ['exe', 'apk', 'dmg']
+      //return checkFileType(file, fileType, this.beforeApkUploadError)
     },
     beforeApkUploadError () {
       this.$message.error('上传文件只能是exe,dmg,apk格式!')
     },
     beforeFileUpload (file) {
-      const fileTypeList = ['pdf', 'xls', 'xlsx', 'doc', 'docx', 'txt']
-      return checkFileType(file, fileTypeList, this.beforeFileUploadError)
+      return true;
+      //const fileTypeList = ['pdf', 'xls', 'xlsx', 'doc', 'docx', 'txt']
+      //return checkFileType(file, fileTypeList, this.beforeFileUploadError)
     },
     beforeFileUploadError () {
       this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')

+ 2 - 0
src/components/report/ProjectReport.vue

@@ -197,6 +197,7 @@ export default {
       //return this.$confirm(`确定移除 ${file.name}?`)
     },
     beforeFileUpload (file) {
+      /*
       console.log(file)
       const isPDF = file.type === 'application/pdf'
       const isDOC = file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
@@ -209,6 +210,7 @@ export default {
         this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
       }
       return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
+      */
     },
     back () {
       this.$router.push({

+ 3 - 0
src/components/report/TaskReport.vue

@@ -194,6 +194,8 @@ export default {
       //return this.$confirm(`确定移除 ${file.name}?`)
     },
     beforeFileUpload (file) {
+      return true;
+      /*
       console.log(file)
       const isPDF = file.type === 'application/pdf'
       const isDOC = file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
@@ -206,6 +208,7 @@ export default {
         this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
       }
       return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
+      */
     },
     back () {
       this.$router.push({

+ 2 - 0
src/components/report/TaskReportCreate.vue

@@ -176,6 +176,7 @@ export default {
       //return this.$confirm(`确定移除 ${file.name}?`)
     },
     beforeFileUpload (file) {
+      /*
       console.log(file)
       const isPDF = file.type === 'application/pdf'
       const isDOC = file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
@@ -188,6 +189,7 @@ export default {
         this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
       }
       return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
+      */
     },
     loadData () {
     },