feat:文件请求接口

main
chunquansang 1 year ago
parent 4bba679cb0
commit 4abab076d7

@ -10,6 +10,7 @@ import { Form, Image } from 'antd';
import React, { useState } from 'react';
// @ts-ignore
import cookie from 'react-cookies';
import axios from 'axios';
const ShowInfoDemo: React.FC = () => {
const [form] = Form.useForm<API.ModelImage>();
const [imageUrl, setImageUrl] = useState<string>('');
@ -27,7 +28,7 @@ const ShowInfoDemo: React.FC = () => {
<ProFormUploadDragger
width={800}
name="projectFilePath"
action="/api/v1/file/uploadFile"
action="/api/v1/common/upload_file/"
max={1}
fieldProps={{
showUploadList: false,
@ -47,10 +48,8 @@ const ShowInfoDemo: React.FC = () => {
maxCount: 1,
name: 'file',
// beforeUpload: beforeUploadFile,
data: { path: 'project/files' },
headers: {
'X-CSRFToken': cookie.load('csrftoken'),
Authorization: `Bearer ${localStorage.getItem('access') || ''}`,
},
}}
>
@ -72,6 +71,7 @@ const ShowInfoDemo: React.FC = () => {
} // 配置 submitter
>
<ProFormSelect
style={{width: 160}}
fieldProps={{
labelInValue: true,
}}
@ -88,7 +88,7 @@ const ShowInfoDemo: React.FC = () => {
if (name1) {
console.log(name1, 'ProFormDependency_name1');
return (
<ProFormText label={name1.label} name={name1.value} disabled required={false} />
<ProFormText width={160} label={name1.label} name={name1.value} disabled required={false}/>
);
}
return <></>;

Loading…
Cancel
Save