This commit is contained in:
caishi 2023-03-17 16:02:25 +08:00
parent 4aa09a5d86
commit 201ece7558
1 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
import React , { forwardRef , useState , useRef } from 'react';
import React , { forwardRef , useState } from 'react';
import { Form , Input , Button } from 'antd';
import MDEditor from "../../../modules/tpm/challengesnew/tpm-md-editor";
import Upload from "../../Upload/Index";
@ -7,6 +7,7 @@ import UploadImg from '../Img/UploadImg.png';
function NewPanel(props,ref){
const [ description , setDescription ] = useState("");
const [ fileList , setFileList] = useState(undefined);
const [ attachments , setAttachments ] = useState([]);
const [ receivers_login , setReceiversLogin ] = useState(undefined);
@ -14,8 +15,6 @@ function NewPanel(props,ref){
const { form: { getFieldDecorator, validateFields , setFieldsValue } } = props;
const fileList = useRef(undefined);
useState(()=>{
title && setTimeout(()=>{
setFieldsValue({subject:title});
@ -34,7 +33,7 @@ function NewPanel(props,ref){
arr = files.map(i=>{return i.id});
}
list = arr && arr.length>0 ? f.concat(arr) : f ;
fileList.current = list;
setFileList(list);
};
function deleteLoad(id){
@ -43,8 +42,8 @@ function NewPanel(props,ref){
if(list && list.length>0 ){
arr = list.filter(i=>i.id !== id);
}
let idArr = arr.map(i=>{return i.id});
fileList.current = idArr;
console.log('删除后:',arr);
setFileList(arr.map(i=>{return i.id}));
}
function changeAtWhoLoginList(loginList){
@ -56,7 +55,8 @@ function NewPanel(props,ref){
function sureFunc(){
validateFields((error,values)=>{
if (!error) {
createFunc(values,fileList.current,receivers_login,description);
console.log('保存时:',fileList);
createFunc(values,fileList,receivers_login,description);
}
})
}