diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js index c527824c5..d5c6dd9c2 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js @@ -2,7 +2,7 @@ import React,{Component} from "React"; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Spin,Tooltip} from "antd"; import {Link} from 'react-router-dom'; import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import { WordsBtn,getUrl ,bytesToSize,getImageUrl,appendFileSizeToUploadFileAll} from 'educoder'; +import { WordsBtn,getUrl ,bytesToSize,getImageUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder'; import axios from 'axios'; import Modals from '../../../modals/Modals'; const Search = Input.Search; @@ -49,13 +49,23 @@ class GraduationTasksSubmitedit extends Component{ if(result){ console.log(result.data.description); - + const fileList = result.data.attachments.map(item => { + return { + id: item.id, + uid: item.id, + name: appendFileSizeToUploadFile(item), + url: item.url, + filesize: item.filesize, + status: 'done' + } + }) this.setState({ workslist:result.data, attachments:result.data.attachments, selectmemberslist:result.data.members, selectobjct:result.data.members, description:result.data.description, + fileList:fileList }) if(result.data.task_type===1){ @@ -134,18 +144,7 @@ class GraduationTasksSubmitedit extends Component{ } } - onAttachmentRemoves = (file) => { - if(!file.percent || file.percent == 100){ - this.setState({ - Modalstype:true, - Modalstopval:'确定要删除这个附件吗?', - ModalSave: ()=>this.deleteAttachments(file), - ModalCancel:this.cancelAttachment - }) - return false; - } - } cancelAttachment=()=>{ this.setState({ Modalstype:false, @@ -155,49 +154,7 @@ class GraduationTasksSubmitedit extends Component{ }) } - deleteAttachments = (id) => { - - let {attachments,fileList}=this.state; - - const url = `/attachments/${id}.json` - axios.delete(url, { - }) - .then((response) => { - if (response.data) { - // const { status } = response.data; - if (response.data.status === 0) { - console.log('--- success') - let newattachments=attachments; - - for(var i=0; i { - const index = state.fileList.indexOf(id); - const newFileList = state.fileList.slice(); - newFileList.splice(index, 1); - return { - fileList: newFileList - }; - }); - } - } - }) - .catch(function (error) { - console.log(error); - }); - - } deleteAttachment = (file) => { if(!file.percent || file.percent == 100){ let {attachments,fileList}=this.state; @@ -672,34 +629,34 @@ class GraduationTasksSubmitedit extends Component{ - {attachments&&attachments.map((item,key)=>{ - - return( -
- - - - - {item.title} - - - - {item.filesize} - - - {item.delete===true? - this.onAttachmentRemoves(item.id)} - aria-hidden="true"> - :""} -
- ) - })} + {/*{attachments&&attachments.map((item,key)=>{*/} + + {/*return(*/} + {/*
*/} + {/**/} + {/**/} + {/**/} + {/**/} + {/*{item.title}*/} + + {/**/} + {/**/} + {/*{item.filesize}*/} + + {/**/} + {/*{item.delete===true?*/} + {/*this.onAttachmentRemoves(item.id)}*/} + {/*aria-hidden="true">*/} + {/*:""}*/} + {/*
*/} + {/*)*/} + {/*})}*/} {/*