|
@ -29,7 +29,6 @@ class Uploads extends Component { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
setFileList = (value) => { |
|
|
setFileList = (value) => { |
|
|
console.log(value,'value') |
|
|
|
|
|
let defaultFileList = []; |
|
|
let defaultFileList = []; |
|
|
defaultFileList = value.map((u, index) => { |
|
|
defaultFileList = value.map((u, index) => { |
|
|
let fileUrl = `${u.url}`; |
|
|
let fileUrl = `${u.url}`; |
|
@ -57,11 +56,11 @@ class Uploads extends Component { |
|
|
componentWillReceiveProps (np) { |
|
|
componentWillReceiveProps (np) { |
|
|
const { dispatch, value: thisEditData, onChange } = this.props; |
|
|
const { dispatch, value: thisEditData, onChange } = this.props; |
|
|
const { value: nextEditData, clearFileList } = np; |
|
|
const { value: nextEditData, clearFileList } = np; |
|
|
console.log(np,'npp') |
|
|
|
|
|
const setFileList = () => { |
|
|
const setFileList = () => { |
|
|
let defaultFileList = []; |
|
|
let defaultFileList = []; |
|
|
defaultFileList = nextEditData.map((u, index) => { |
|
|
defaultFileList = nextEditData.map((u, index) => { |
|
|
let fileUrl = `${u.storageUrl}`; |
|
|
let fileUrl = `${this.ApiRoot}/${u.storageUrl}`; |
|
|
return { |
|
|
return { |
|
|
uid: -index - 1, |
|
|
uid: -index - 1, |
|
|
name: this.dealName(u.storageUrl), |
|
|
name: this.dealName(u.storageUrl), |
|
@ -151,7 +150,7 @@ class Uploads extends Component { |
|
|
name: 'checkFile_', |
|
|
name: 'checkFile_', |
|
|
multiple: false, |
|
|
multiple: false, |
|
|
showUploadList: showUploadList || true, |
|
|
showUploadList: showUploadList || true, |
|
|
action: `attachments/${uploadType_}`, |
|
|
action: `${this.ApiRoot}/attachments/${uploadType_}`, |
|
|
listType: listType || 'text', |
|
|
listType: listType || 'text', |
|
|
disabled: disabled, |
|
|
disabled: disabled, |
|
|
beforeUpload: (file) => { |
|
|
beforeUpload: (file) => { |
|
@ -247,7 +246,6 @@ class Uploads extends Component { |
|
|
}); |
|
|
}); |
|
|
}, |
|
|
}, |
|
|
onPreview (file) { |
|
|
onPreview (file) { |
|
|
console.log(file,'file') |
|
|
|
|
|
let filePostfix = file.url.split('.').pop(); |
|
|
let filePostfix = file.url.split('.').pop(); |
|
|
filePostfix = filePostfix.toLowerCase(); |
|
|
filePostfix = filePostfix.toLowerCase(); |
|
|
if (UploadPath.image.some((img) => img == filePostfix)) { |
|
|
if (UploadPath.image.some((img) => img == filePostfix)) { |
|
@ -261,7 +259,6 @@ class Uploads extends Component { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
let fileList_ = fileList |
|
|
let fileList_ = fileList |
|
|
|
|
|
|
|
|
// .map(f => {
|
|
|
// .map(f => {
|
|
|
// if (f.storageUrl) {
|
|
|
// if (f.storageUrl) {
|
|
|
// let realName = f.storageUrl.split('/').pop()
|
|
|
// let realName = f.storageUrl.split('/').pop()
|
|
|