Commit f85ae4cc authored by 田翔's avatar 田翔

fix: 支持其他地址附件预览

parent d3e9bb1b
{
"name": "panda-xform",
"version": "5.2.3",
"description": "5.2.3 附件形态问题",
"version": "5.2.4",
"description": "5.2.4 支持其他地址附件预览",
"keywords": [
"panda-xform"
],
......
......@@ -107,7 +107,7 @@ const FileUpload = (props) => {
if (filenameVerification(file).type === 'error') return false;
// 返回的链接在file.response内;不设置url,预览图表不可点击
if (file.status === 'done' && file.response.code === 0) {
file.url = `${downloadFileUrl}?filePath=${file.response.data}${site ? `&_site=${site}` : ''}`
file.url = `${window.origin}${downloadFileUrl}?filePath=${file.response.data}${site ? `&_site=${site}` : ''}`
file.sourcePath = file.response.data;
message.success('上传成功!')
} else if (file.status === 'done' && file.response.code !== 0) {
......@@ -154,7 +154,7 @@ const FileUpload = (props) => {
if (['jpg', 'png', 'svg', 'jpeg'].includes(showFile.fileType)) {
return (
<div style={{ width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<img style={{ maxWidth: '100%', maxHeight: '100%' }} src={window.location.origin + showFile.filePath}></img>
<img style={{ maxWidth: '100%', maxHeight: '100%' }} src={showFile.filePath}></img>
</div>
)
} else if (['xlsx', 'xls'].includes(showFile.fileType)) {
......@@ -216,7 +216,7 @@ const FileUpload = (props) => {
className='fileViewer'
title='123'
fileType={showFile.fileType}
filePath={window.location.origin + showFile.filePath}
filePath={showFile.filePath}
/>
)
}
......@@ -246,9 +246,9 @@ const FileUpload = (props) => {
name: list[i].split('\\').reverse()[0],
type: fileType === '图片' ? 'image/jpeg' : 'file',
status: 'done',
url: `${downloadFileUrl}?filePath=${list[i]}${site ? `&_site=${site}` : ''}`,
url: list[i]?.includes('http') ? list[i] : `${window.origin}${downloadFileUrl}?filePath=${list[i]}${site ? `&_site=${site}` : ''}`,
sourcePath: list[i],
thumbUrl: list[i].includes('svg') ? await convertUrlToBase64(`${window.origin}${downloadFileUrl}?filePath=${list[i]}${site ? `&_site=${site}` : ''}`) : `${window.origin}${downloadFileUrl}?filePath=${list[i]}${site ? `&_site=${site}` : ''}`,
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}` : ''}`),
originFileObj: { "uid": uid },
"response": { "code": 0, "msg": "Ok", "data": list[i], "stackTrace": null },
"xhr": {},
......@@ -276,7 +276,6 @@ const FileUpload = (props) => {
return (
<div className={styles.uploadBox}>
<Upload
// disabled={disabled}
accept={accepts[fileType]}
fileList={showList}
className="upload-list-inline"
......
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