issue 2616 issue保存提示附件id不存在

This commit is contained in:
caishi 2023-03-17 13:49:52 +08:00
parent f0e74326ac
commit 4aa09a5d86
2 changed files with 14 additions and 7 deletions

View File

@ -174,11 +174,16 @@ function Contributors({owner,projectsId,currentLogin}){
{
list && list.length>0 && list.map((item,key)=>{
return(
item.id ?
<Popover content={menu} visible={item.visible} overlayClassName="menuPanels" placement="top">
<a key={key} href={item.id ? `/${item.login}` : `mailto:${item.email}`}>
<a key={key} href={`/${item.login}`}>
<img src={getImageUrl(`/${item.image_url}`)} alt="" onMouseOver={()=>setVisibleFunc(true,item.login,key)}/>
</a>
</Popover>
:
<a key={key} href={`mailto:${item.email}`}>
<img src={getImageUrl(`/${item.image_url}`)} alt="" onMouseOver={()=>setVisibleFunc(true,item.login,key)}/>
</a>
)
})
}

View File

@ -1,4 +1,4 @@
import React , { forwardRef , useState } from 'react';
import React , { forwardRef , useState , useRef } from 'react';
import { Form , Input , Button } from 'antd';
import MDEditor from "../../../modules/tpm/challengesnew/tpm-md-editor";
import Upload from "../../Upload/Index";
@ -7,7 +7,6 @@ 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);
@ -15,6 +14,8 @@ function NewPanel(props,ref){
const { form: { getFieldDecorator, validateFields , setFieldsValue } } = props;
const fileList = useRef(undefined);
useState(()=>{
title && setTimeout(()=>{
setFieldsValue({subject:title});
@ -33,16 +34,17 @@ function NewPanel(props,ref){
arr = files.map(i=>{return i.id});
}
list = arr && arr.length>0 ? f.concat(arr) : f ;
setFileList(list);
fileList.current = list;
};
function deleteLoad(id){
let arr = [];
let list = files
let list = files;
if(list && list.length>0 ){
arr = list.filter(i=>i.id !== id);
}
setFileList(arr.map(i=>{return i.id}));
let idArr = arr.map(i=>{return i.id});
fileList.current = idArr;
}
function changeAtWhoLoginList(loginList){
@ -54,7 +56,7 @@ function NewPanel(props,ref){
function sureFunc(){
validateFields((error,values)=>{
if (!error) {
createFunc(values,fileList,receivers_login,description);
createFunc(values,fileList.current,receivers_login,description);
}
})
}