Commit 10912935 authored by XieZhiXiong's avatar XieZhiXiong

feat: 添加 loading

parent f7717d7d
......@@ -2,12 +2,12 @@
* @Author: XieZhiXiong
* @Date: 2021-06-04 17:26:51
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-04 18:52:50
* @LastEditTime: 2021-06-07 16:20:40
* @Description: 资质上传组件
*/
import React from 'react';
import React, { useState } from 'react';
import { Upload } from 'antd';
import { PlusOutlined, FileOutlined } from '@ant-design/icons';
import { PlusOutlined, FileOutlined, LoadingOutlined } from '@ant-design/icons';
import { UploadChangeParam } from 'antd/lib/upload';
import styles from './index.less';
......@@ -20,12 +20,19 @@ const QualitiesUpload = (props) => {
mutators,
// schema,
} = props;
const [loading, setLoading] = useState(false);
const arrValue = value ? [value] : [];
const handleChange = (info: UploadChangeParam) => {
const { file } = info;
const { response = {}, ...rest } = file;
if (file.status === 'uploading') {
setLoading(true);
}
if (file.status === 'done' || file.status === 'error') {
setLoading(false);
}
mutators.change({
...rest,
...(response.data || {}),
......@@ -69,7 +76,11 @@ const QualitiesUpload = (props) => {
fileList={arrValue}
onChange={handleChange}
>
{arrValue.length ? renderFile() : uploadButton}
{!loading ? (
arrValue.length ? renderFile() : uploadButton
) : (
<LoadingOutlined />
)}
</Upload>
</div>
);
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-01 16:13:35
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-07 15:07:45
* @LastEditTime: 2021-06-07 16:18:24
* @Description: 资质证明上传组件
*/
import React from 'react';
......@@ -35,7 +35,7 @@ const schema = new Schema({
action: '/api/file/file/upload/prefix',
data: {
fileType: UPLOAD_TYPE,
prefix: 'member_qualifications_',
prefix: '',
},
accept: '.doc, .docx, .xls, .xlsx, .pot, .pps, .vsd, .wps, .dps, .pdf, .txt, .png, .jpg, .rar, .zip',
},
......
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