Commit 259981a1 authored by 田翔's avatar 田翔

fix: 无预览图片时增加通用图片

parent 049d16a2
{
"name": "panda-xform",
"version": "5.6.3",
"description": "5.6.3 样式优化",
"version": "5.6.4",
"description": "5.6.4 无预览图片时增加通用图片",
"keywords": [
"panda-xform"
],
......
......@@ -9,6 +9,7 @@ import { filenameVerification } from '../../../../utils'
import Drag from '../../../components/Drag'
import * as XLSX from 'xlsx'
import { convertUrlToBase64 } from '../../../../utils/index'
import fileImg from '../../../../assets/images/file/文件通用图标.png'
const accepts = {
'全部': ['.bmp', '.gif', '.jpeg', '.tiff', '.png', '.svg', '.jpg', '.docx', '.xlsx', '.pdf', '.mp4', '.mp3'],
......@@ -65,7 +66,8 @@ const FileUpload = (props) => {
const site = window.globalConfig?.userInfo?.site || window.globalConfig?.userInfo?.LocalSite
const { addons, value, schema, onChange } = props
const { disabled, fileType, presetValue, placeholder, preview, download } = schema
const { disabled, fileType, placeholder, preview, download } = schema
const presetValue = 'be489bc1-db3f-4d24-8d81-79910c99b7cb/业务系统菜单配置说明.pdf'
const [imgVisible, setImgVisible] = useState(false)
const [showList, setShowList] = useState([])
......@@ -278,7 +280,11 @@ const FileUpload = (props) => {
"xhr": {},
};
if (fileType === '图片') {
_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}` : ''}`)
if (['jpg', 'png', 'svg', 'jpeg'].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
}
}
fileList.push(_obj);
}
......
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