Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
merchant-manage-ui
Commits
5b1e9608
Commit
5b1e9608
authored
Apr 20, 2021
by
王苓芝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件格式限制
parent
fcb238bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
upload.jsx
src/pages/components/upload.jsx
+12
-2
No files found.
src/pages/components/upload.jsx
View file @
5b1e9608
import
{
Upload
,
Icon
,
Modal
}
from
'
antd
'
;
import
{
Upload
,
Icon
,
Modal
,
notification
}
from
'
antd
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
config
from
'
../../../config/env.config
'
;
import
config
from
'
../../../config/env.config
'
;
import
{
qiniuToken
}
from
'
@/services/qiniu
'
;
import
{
qiniuToken
}
from
'
@/services/qiniu
'
;
...
@@ -42,6 +42,16 @@ class PicturesWall extends React.Component {
...
@@ -42,6 +42,16 @@ class PicturesWall extends React.Component {
});
});
};
};
beforeUpload
=
file
=>
{
console
.
log
(
'
files
'
,
file
);
const
types
=
[
'
application/pdf
'
,
'
image/png
'
,
'
image/jpeg
'
];
if
(
types
.
indexOf
(
file
.
type
)
===
-
1
)
{
notification
.
error
(
'
输入格式有问题
'
);
return
false
;
}
return
true
;
};
handleChange
=
({
fileList
})
=>
{
handleChange
=
({
fileList
})
=>
{
this
.
setState
({
fileList
});
this
.
setState
({
fileList
});
};
};
...
@@ -90,12 +100,12 @@ class PicturesWall extends React.Component {
...
@@ -90,12 +100,12 @@ class PicturesWall extends React.Component {
return
(
return
(
<
div
className=
"clearfix"
>
<
div
className=
"clearfix"
>
<
Upload
<
Upload
accept=
"image/png, image/jpeg, .pdf"
customRequest=
{
this
.
customRequest
}
customRequest=
{
this
.
customRequest
}
listType=
"picture-card"
listType=
"picture-card"
fileList=
{
fileList
}
fileList=
{
fileList
}
onPreview=
{
this
.
handlePreview
}
onPreview=
{
this
.
handlePreview
}
onChange=
{
this
.
handleChange
}
onChange=
{
this
.
handleChange
}
beforeUpload=
{
this
.
beforeUpload
}
{
...
this
.
props
}
{
...
this
.
props
}
>
>
{
max
&&
fileList
.
length
>=
max
?
null
:
uploadButton
}
{
max
&&
fileList
.
length
>=
max
?
null
:
uploadButton
}
...
...
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