From 795fb51d12515ee4e2cde7488dcf6e0f2ba863ef Mon Sep 17 00:00:00 2001 From: zhuyangbin Date: Wed, 9 Sep 2020 16:57:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=94=AF=E6=8C=81heic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/apolloTable/component/base/extra/upload/index.tsx | 2 +- .../apolloTable/component/base/extra/upload/preview.tsx | 4 +--- components/apolloTable/component/base/extra/upload/utils.ts | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/components/apolloTable/component/base/extra/upload/index.tsx b/components/apolloTable/component/base/extra/upload/index.tsx index 9c9c685..2b8e1b9 100644 --- a/components/apolloTable/component/base/extra/upload/index.tsx +++ b/components/apolloTable/component/base/extra/upload/index.tsx @@ -110,7 +110,7 @@ const UploadCom = (props) => { const obj = checkoutFileType(file.name); const typeArr = file.name.match(/\.[a-zA-Z0-9]+$/); const type = typeArr && typeArr[0] ? typeArr[0].replace('.', '') : ''; - if (!['png', 'gif', 'bmp', 'jpg', 'jpeg'].includes(type)) { + if (!['png', 'gif', 'bmp', 'jpg', 'jpeg', 'heic'].includes(type)) { res(obj.thumbUrl); } }); diff --git a/components/apolloTable/component/base/extra/upload/preview.tsx b/components/apolloTable/component/base/extra/upload/preview.tsx index 3f4fa4c..0b2c885 100644 --- a/components/apolloTable/component/base/extra/upload/preview.tsx +++ b/components/apolloTable/component/base/extra/upload/preview.tsx @@ -10,14 +10,12 @@ export default class uploadDetail extends React.Component { }; onPreview = (url:string, name:string) => { - console.log('name: ', name); - console.log('url: ', url); const nameTypeArr = name.match(/\.[a-zA-Z0-9]+$/); const urlTypeArr = url.match(/\.[a-zA-Z0-9]+$/); const typeArr = nameTypeArr || urlTypeArr; let type = typeArr && typeArr[0] ? typeArr[0].replace('.', '') : ''; type = type.toLowerCase(); - if (['png', 'gif', 'bmp', 'jpg', 'jpeg'].includes(type)) { + if (['png', 'gif', 'bmp', 'jpg', 'jpeg', 'heic'].includes(type)) { this.setState({ showDialog: true, type: 'image', url }); } else if (['doc', 'docx', 'document', 'xls', 'xlsx', 'ppt', 'pptx'].includes(type)) { this.setState({ showDialog: true, type: 'office', url }); diff --git a/components/apolloTable/component/base/extra/upload/utils.ts b/components/apolloTable/component/base/extra/upload/utils.ts index 8cc0d0f..5fd02e4 100644 --- a/components/apolloTable/component/base/extra/upload/utils.ts +++ b/components/apolloTable/component/base/extra/upload/utils.ts @@ -4,7 +4,7 @@ export const checkoutFileType = (url = '') => { const typeArr = url.match(/\.[a-zA-Z0-9]+$/); let type = typeArr && typeArr[0] ? typeArr[0].replace('.', '') : ''; type = type.toLowerCase(); - if (type === 'png' || type === 'jpg' || type === 'gif' || type === 'bmp' || type === 'jpeg') { + if (type === 'png' || type === 'jpg' || type === 'gif' || type === 'bmp' || type === 'jpeg' || type === 'heic') { return { thumbUrl: `${url}?imageView2/1/w/120/h/120`, fileType: type }; } return fileType[type] ? fileType[type] : fileType.other; -- 2.21.0