Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-platform
Commits
0a09ab66
Commit
0a09ab66
authored
Jun 09, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 搬运逻辑
parent
ac787994
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
11 deletions
+33
-11
index.tsx
src/components/NiceForm/components/AntUpload/index.tsx
+33
-11
No files found.
src/components/NiceForm/components/AntUpload/index.tsx
View file @
0a09ab66
...
...
@@ -96,6 +96,26 @@ const testOpts = (ext, options) => {
return
true
}
const
getURL
=
(
target
:
any
)
=>
{
return
target
?.[
'url'
]
||
target
?.[
'downloadURL'
]
||
target
?.[
'imgURL'
]
}
const
getThumbURL
=
(
target
:
any
)
=>
{
return
(
target
?.[
'thumbUrl'
]
||
target
?.[
'url'
]
||
target
?.[
'downloadURL'
]
||
target
?.[
'imgURL'
]
)
}
const
getState
=
(
target
:
any
)
=>
{
if
(
target
?.
success
===
false
)
return
'error'
if
(
target
?.
failed
===
true
)
return
'error'
if
(
target
?.
error
)
return
'error'
return
target
?.
state
||
target
?.
status
}
const
getImageByUrl
=
(
url
,
options
)
=>
{
for
(
let
i
=
0
;
i
<
exts
.
length
;
i
++
)
{
if
(
exts
[
i
].
ext
.
test
(
url
)
&&
testOpts
(
exts
[
i
].
ext
,
options
))
{
...
...
@@ -108,17 +128,19 @@ const getImageByUrl = (url, options) => {
const
normalizeFileList
=
fileList
=>
{
if
(
fileList
&&
fileList
.
length
)
{
return
fileList
.
map
(
file
=>
{
return
file
.
response
?
{
uid
:
file
.
uid
,
status
:
file
.
status
,
url
:
file
.
downloadURL
||
file
.
imgURL
||
file
.
url
,
...
file
.
response
.
data
,
name
:
file
.
name
,
thumbUrl
:
file
.
imgURL
||
getImageByUrl
(
file
.
downloadURL
||
file
.
url
,
{
exclude
:
[
'.png'
,
'.jpg'
,
'.jpeg'
,
'.gif'
]
}),
}
:
file
;
return
fileList
.
map
((
file
,
index
)
=>
{
return
{
...
file
,
uid
:
file
.
uid
||
`
${
index
}
`
,
status
:
getState
(
file
.
response
)
||
getState
(
file
),
url
:
getURL
(
file
)
||
getURL
(
file
?.
response
),
thumbUrl
:
getImageByUrl
(
getThumbURL
(
file
)
||
getThumbURL
(
file
?.
response
),
{
exclude
:
[
'.png'
,
'.jpg'
,
'.jpeg'
,
'.gif'
],
}
),
}
})
}
return
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment