|
@@ -229,29 +229,9 @@ const Step2 = (props) => {
|
|
|
|
|
|
const handleCancel = () => setPreviewVisible(false);
|
|
|
|
|
|
- const handleUpload = ({ file }) => {
|
|
|
- console.log(file)
|
|
|
- let formData = new FormData();
|
|
|
- formData.append('file',file);
|
|
|
- formData.append('caseId',currentTestCaseRef.current.id);
|
|
|
- formData.append('work_id','2');
|
|
|
-
|
|
|
- dispatch({
|
|
|
- type: 'editReport/uploadImg',
|
|
|
- payload: {
|
|
|
- formData
|
|
|
- }
|
|
|
- }).then((res)=>{
|
|
|
- const newFile = {
|
|
|
- uid: fileList.length,
|
|
|
- name:file.name,
|
|
|
- status: 'done',
|
|
|
- url: res
|
|
|
- }
|
|
|
- setFileList([...fileList,newFile])
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
+ const handleChange = ({ fileList }) => {
|
|
|
+ setFileList(fileList);
|
|
|
+ };
|
|
|
|
|
|
useEffect(() => {
|
|
|
//判断是否已经有报告
|
|
@@ -676,11 +656,16 @@ const Step2 = (props) => {
|
|
|
name="testName"
|
|
|
>
|
|
|
<Upload
|
|
|
+ action='/api/upload/image'
|
|
|
+ data={file => ({ // data里存放的是接口的请求参数
|
|
|
+ file,
|
|
|
+ caseId:currentTestCaseRef.current.id,
|
|
|
+ work_id:'2'
|
|
|
+ })}
|
|
|
listType="picture-card"
|
|
|
fileList={fileList}
|
|
|
onPreview={handlePreview}
|
|
|
- customRequest={handleUpload}
|
|
|
- // beforeUpload = {beforeUpload}
|
|
|
+ onChange={handleChange}
|
|
|
>
|
|
|
{uploadButton}
|
|
|
</Upload>
|