Parcourir la source

修复文件上传限制错误

cfort il y a 3 ans
Parent
commit
d933312cd1
1 fichiers modifiés avec 9 ajouts et 24 suppressions
  1. 9 24
      src/business/platform/file/uploader/index.vue

+ 9 - 24
src/business/platform/file/uploader/index.vue

@@ -197,40 +197,25 @@
              * 文件类型的限制
              */
             fileExtType() {
-                const accept = this.accept
-                const acceptTypes = this.acceptTypes
-                const fileTypes = this.fileTypes
-                let type = ''
                 let targetFileTypes = []
                 this.targetExt = false
-                for (const i in acceptTypes) {
-                    if (acceptTypes[i] === accept) {
-                        type = i
-                        targetFileTypes = fileTypes[i]
-                    } else {
-                        if (accept === '*') {
-                            // 不限制
-                            targetFileTypes = '*'
-                        } else {
-                            // 自定义
-                            targetFileTypes = accept.split(',')
-                        }
-                    }
+                if (this.accept === '*') {
+                    // 不限制
+                    targetFileTypes = '*'
+                } else {
+                    // 自定义
+                    targetFileTypes = this.accept.split(',')
                 }
                 const fileList = this.multiple ? this.fileList : [this.fileList]
                 if (targetFileTypes !== '*') {
                     this.targetExt = fileList.every(i => {
-                        // console.log(targetFileTypes, `.${i.ext}`) // 控件类型集,过滤文件得后缀
-                        if (type === 'compress') {
-                            return targetFileTypes.includes(`${i.ext}`)
-                        } else {
-                            return targetFileTypes.includes(`${i.ext}`)
-                        }
+                        // console.log(targetFileTypes, `.${i.ext}`)
+                        return targetFileTypes.includes(`.${i.ext}`)
                     })
                 } else {
                     this.targetExt = true
                 }
-                // console.log(fileList, this.targetExt, 'lll') // 已上传文件,过滤结果
+                // console.log(fileList, this.targetExt)
                 return this.targetExt
             },
             handleConfirm() {