Commit 8efd8214 authored by 田翔's avatar 田翔

fix: 图片支持webp格式

parent 18162cea
{
"name": "panda-xform",
"version": "5.9.15",
"description": "5.9.15 台账细节修改",
"version": "5.9.16",
"description": "5.9.16 图片支持webp格式",
"keywords": [
"panda-xform"
],
......
......@@ -13,7 +13,7 @@ import fileImg from '../../../../assets/images/file/文件通用图标.png'
const accepts = {
'全部': ['.bmp', '.gif', '.jpeg', '.tiff', '.png', '.svg', '.jpg', '.docx', '.xlsx', '.pdf', '.mp4', '.mp3'],
'图片': ['.bmp', '.gif', '.jpeg', '.tiff', '.png', '.svg', '.jpg'],
'图片': ['.bmp', '.gif', '.jpeg', '.tiff', '.png', '.svg', '.jpg', '.webp'],
'文档': ['.docx', '.xlsx', '.pdf'],
'视频': ['.mp4'],
'音频': ['.mp3'],
......@@ -34,6 +34,9 @@ const getFileType = (fileName) => {
if (fileName.includes('jpeg')) {
return 'jpeg'
}
if (fileName.includes('webp')) {
return 'webp'
}
//文档
if (fileName.includes('docx')) {
return 'docx'
......@@ -180,7 +183,7 @@ const FileUpload = (props) => {
}
const elemet = () => {
if (['jpg', 'png', 'svg', 'jpeg'].includes(showFile.fileType)) {
if (['jpg', 'png', 'svg', 'jpeg', 'webp'].includes(showFile.fileType)) {
return (
<div style={{ width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<img style={{ maxWidth: '100%', maxHeight: '100%' }} src={showFile.filePath}></img>
......@@ -293,7 +296,7 @@ const FileUpload = (props) => {
"xhr": {},
};
if (fileType === '图片') {
if (['jpg', 'png', 'svg', 'jpeg'].includes(getFileType(list[i]))) {
if (['jpg', 'png', 'svg', 'jpeg', 'webp'].includes(getFileType(list[i]))) {
_obj.thumbUrl = list[i]?.includes('http') ? list[i] : (list[i].includes('svg') ? await convertUrlToBase64(`${window.origin}${downloadFileUrl}?filePath=${list[i]}${site ? `&_site=${site}` : ''}`) : `${window.origin}${downloadFileUrl}?filePath=${list[i]}${site ? `&_site=${site}` : ''}`)
} else {
_obj.thumbUrl = fileImg
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment