Commit f85ae4cc authored by 田翔's avatar 田翔

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

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