From ad9ae3a7bd8a7243fe3ee7d9e309cc8b4963f0b0 Mon Sep 17 00:00:00 2001 From: hzwanghong Date: Mon, 16 Apr 2018 11:15:32 +0800 Subject: [PATCH] =?UTF-8?q?misc:=20=E6=B7=BB=E5=8A=A0=E6=96=B0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/KLUpload/components/UploadBase/index.js | 2 +- src/js/components/form/KLUpload/config.js | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/js/components/form/KLUpload/components/UploadBase/index.js b/src/js/components/form/KLUpload/components/UploadBase/index.js index 09b0a686..cbb476e0 100644 --- a/src/js/components/form/KLUpload/components/UploadBase/index.js +++ b/src/js/components/form/KLUpload/components/UploadBase/index.js @@ -562,7 +562,7 @@ const UploadBase = Component.extend({ Object.keys(typeMap).forEach((key) => { const reg = new RegExp(`${key}$`); // 名称后缀不区分大小写 - if (reg.test(type) || (!type && reg.test(`${name}`.toLowerCase()))) { + if (reg.test(type) || reg.test(`${name}`.toLowerCase())) { typeStr = typeMap[key]; } }); diff --git a/src/js/components/form/KLUpload/config.js b/src/js/components/form/KLUpload/config.js index e93657b4..a44f9396 100644 --- a/src/js/components/form/KLUpload/config.js +++ b/src/js/components/form/KLUpload/config.js @@ -21,12 +21,14 @@ const typeMap = { '.rar': 'rar', '.gz': 'gz', document: 'doc', - sheet: 'doc', - powerpoint: 'doc', + sheet: 'excel', + powerpoint: 'ppt', msword: 'doc', '.doc': 'doc', - '.xlsx': 'doc', - '.ppt': 'doc', + '.xlsx': 'excel', + '.xls': 'excel', + '.ppt': 'ppt', + '.pptx': 'ppt', 'video/*': 'video', '.mp4': 'video', '.mkv': 'video', @@ -40,6 +42,7 @@ const typeMap = { '.js': 'js', '.html': 'html', '.txt': 'text', + 'text/plain': 'text', '.json': 'json', };