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
前端-黄佳鑫
jinfa-platform
Commits
35e88105
Commit
35e88105
authored
Jun 04, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加 自定义 Upload 组件
parent
39f20347
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
7 deletions
+105
-7
index.tsx
...s/member/components/QualificationUploadFormItem/index.tsx
+4
-5
index.less
src/pages/member/components/QualitiesUpload/index.less
+15
-0
index.tsx
src/pages/member/components/QualitiesUpload/index.tsx
+80
-0
index.tsx
...omingData/components/UploadQualificationsDrawer/index.tsx
+6
-2
No files found.
src/pages/member/components/QualificationUploadFormItem/index.tsx
View file @
35e88105
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-01 16:13:35
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-0
1 18:05:56
* @LastEditTime: 2021-06-0
4 18:56:22
* @Description: 资质证明上传组件
*/
import
React
from
'react'
;
...
...
@@ -28,18 +28,17 @@ const schema = new Schema({
properties
:
{
file
:
{
type
:
'string'
,
'x-component'
:
'
Fix
Upload'
,
'x-component'
:
'
Qualification
Upload'
,
'x-component-props'
:
{
maxCount
:
1
,
action
:
'/api/file/file/upload/prefix'
,
data
:
{
fileType
:
UPLOAD_TYPE
,
prefix
:
'member_qualifications_'
,
},
accept
:
'.doc, .docx, .xls, .xlsx, .pot, .pps, .vsd, .wps, .dps, .pdf, .txt, .png, .jpg, .rar, .zip'
,
accept
:
'.doc, .docx, .xls, .xlsx, .pot, .pps, .vsd, .wps, .dps, .pdf, .txt, .png, .jpg, .rar, .zip'
,
},
},
MEGA_LAYOUT
1
:
{
MEGA_LAYOUT
2
:
{
type
:
'object'
,
'x-component'
:
'Mega-Layout'
,
properties
:
{
...
...
src/pages/member/components/QualitiesUpload/index.less
0 → 100644
View file @
35e88105
.upload {
:global {
.ant-upload.ant-upload-select-picture-card {
width: 175px;
height: 120px;
}
}
.img {
width: 175px;
height: 120px;
object-fit: contain;
}
}
\ No newline at end of file
src/pages/member/components/QualitiesUpload/index.tsx
0 → 100644
View file @
35e88105
/*
* @Author: XieZhiXiong
* @Date: 2021-06-04 17:26:51
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-04 18:52:50
* @Description: 资质上传组件
*/
import
React
from
'react'
;
import
{
Upload
}
from
'antd'
;
import
{
PlusOutlined
,
FileOutlined
}
from
'@ant-design/icons'
;
import
{
UploadChangeParam
}
from
'antd/lib/upload'
;
import
styles
from
'./index.less'
;
const
QualitiesUpload
=
(
props
)
=>
{
const
{
value
,
className
,
editable
,
path
,
mutators
,
// schema,
}
=
props
;
const
arrValue
=
value
?
[
value
]
:
[];
const
handleChange
=
(
info
:
UploadChangeParam
)
=>
{
const
{
file
}
=
info
;
const
{
response
=
{},
...
rest
}
=
file
;
mutators
.
change
({
...
rest
,
...(
response
.
data
||
{}),
});
};
const
uploadButton
=
(
<
div
>
<
PlusOutlined
/>
<
div
style=
{
{
marginTop
:
8
}
}
>
上传
</
div
>
</
div
>
);
const
renderFile
=
()
=>
{
const
url
=
value
?.
url
||
''
;
const
imgReg
=
/
\.(
png|jpg|gif|jpeg|webp
)
$/
;
const
isImg
=
imgReg
.
test
(
url
);
if
(
!
url
)
{
return
<
div
/>;
}
if
(
isImg
)
{
return
(
<
img
src=
{
url
}
className=
{
styles
.
img
}
/>
)
}
return
(
<
FileOutlined
style=
{
{
fontSize
:
36
}
}
/>
);
};
return
(
<
div
className=
{
styles
.
upload
}
>
<
Upload
{
...
(
props
.
props
['
x
-
component
-
props
']
||
{})}
listType=
"picture-card"
showUploadList=
{
false
}
maxCount=
{
1
}
fileList=
{
arrValue
}
onChange=
{
handleChange
}
>
{
arrValue
.
length
?
renderFile
()
:
uploadButton
}
</
Upload
>
</
div
>
);
};
QualitiesUpload
.
isFieldComponent
=
true
;
export
default
QualitiesUpload
;
src/pages/member/memberPrVerifyComingData/components/UploadQualificationsDrawer/index.tsx
View file @
35e88105
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-01 20:03:23
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-0
2 10:47:2
0
* @LastEditTime: 2021-06-0
4 17:33:3
0
* @Description: 补充资质证明抽屉
*/
import
React
from
'react'
;
...
...
@@ -13,9 +13,10 @@ import {
import
{
createFormActions
,
}
from
'@formily/antd'
;
import
{
DatePicker
}
from
'@formily/antd-components'
import
{
DatePicker
,
Checkbox
}
from
'@formily/antd-components'
import
NiceForm
from
'@/components/NiceForm'
;
import
{
schema
}
from
'./schema'
;
import
QualificationUpload
from
'../../../components/QualitiesUpload'
;
import
QualificationUploadFormItem
from
'../../../components/QualificationUploadFormItem'
;
export
type
FileType
=
{
...
...
@@ -117,6 +118,9 @@ const UploadQualificationsDrawer: React.FC<IProps> = (props: IProps) => {
previewPlaceholder=
"' '"
components=
{
{
DatePicker
,
Checkbox
,
CheckboxGroup
:
Checkbox
.
Group
,
QualificationUpload
,
QualificationUploadFormItem
,
}
}
effects=
{
()
=>
{
...
...
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