|
|
|
@ -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<newattachments.length; i++){
|
|
|
|
|
if(newattachments[i].id===id){
|
|
|
|
|
newattachments.splice(i, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
attachments:newattachments
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.cancelAttachment();
|
|
|
|
|
this.setState((state) => {
|
|
|
|
|
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{
|
|
|
|
|
</Upload>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{attachments&&attachments.map((item,key)=>{
|
|
|
|
|
|
|
|
|
|
return(
|
|
|
|
|
<div className="color-grey mt5"
|
|
|
|
|
key={key}
|
|
|
|
|
>
|
|
|
|
|
<a className="color-grey ml3">
|
|
|
|
|
<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>
|
|
|
|
|
</a>
|
|
|
|
|
<a
|
|
|
|
|
href={item.url}
|
|
|
|
|
className="mr12 color9B9B" length="58">
|
|
|
|
|
{item.title}
|
|
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
<span className="color656565 mt2 color-grey-6 font-12 mr8">
|
|
|
|
|
{item.filesize}
|
|
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
{item.delete===true?
|
|
|
|
|
<i className="font-14 iconfont icon-guanbi "
|
|
|
|
|
id={item.id}
|
|
|
|
|
onClick={()=>this.onAttachmentRemoves(item.id)}
|
|
|
|
|
aria-hidden="true">
|
|
|
|
|
</i>:""}
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
})}
|
|
|
|
|
{/*{attachments&&attachments.map((item,key)=>{*/}
|
|
|
|
|
|
|
|
|
|
{/*return(*/}
|
|
|
|
|
{/*<div className="color-grey mt5"*/}
|
|
|
|
|
{/*key={key}*/}
|
|
|
|
|
{/*>*/}
|
|
|
|
|
{/*<a className="color-grey ml3">*/}
|
|
|
|
|
{/*<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>*/}
|
|
|
|
|
{/*</a>*/}
|
|
|
|
|
{/*<a*/}
|
|
|
|
|
{/*href={item.url}*/}
|
|
|
|
|
{/*className="mr12 color9B9B" length="58">*/}
|
|
|
|
|
{/*{item.title}*/}
|
|
|
|
|
|
|
|
|
|
{/*</a>*/}
|
|
|
|
|
{/*<span className="color656565 mt2 color-grey-6 font-12 mr8">*/}
|
|
|
|
|
{/*{item.filesize}*/}
|
|
|
|
|
|
|
|
|
|
{/*</span>*/}
|
|
|
|
|
{/*{item.delete===true?*/}
|
|
|
|
|
{/*<i className="font-14 iconfont icon-guanbi "*/}
|
|
|
|
|
{/*id={item.id}*/}
|
|
|
|
|
{/*onClick={()=>this.onAttachmentRemoves(item.id)}*/}
|
|
|
|
|
{/*aria-hidden="true">*/}
|
|
|
|
|
{/*</i>:""}*/}
|
|
|
|
|
{/*</div>*/}
|
|
|
|
|
{/*)*/}
|
|
|
|
|
{/*})}*/}
|
|
|
|
|
|
|
|
|
|
{/*<style>*/}
|
|
|
|
|
{/*{*/}
|
|
|
|
|