|
|
@ -2,7 +2,7 @@ import React,{Component} from "React";
|
|
|
|
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal} from "antd";
|
|
|
|
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal} from "antd";
|
|
|
|
import {Link} from 'react-router-dom';
|
|
|
|
import {Link} from 'react-router-dom';
|
|
|
|
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
|
|
|
|
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
|
|
|
|
import { WordsBtn,getUrl ,bytesToSize} from 'educoder';
|
|
|
|
import { WordsBtn,getUrl ,bytesToSize,appendFileSizeToUploadFileAll} from 'educoder';
|
|
|
|
import axios from 'axios';
|
|
|
|
import axios from 'axios';
|
|
|
|
import Modals from '../../../modals/Modals';
|
|
|
|
import Modals from '../../../modals/Modals';
|
|
|
|
import '../../css/Courses.css';
|
|
|
|
import '../../css/Courses.css';
|
|
|
@ -105,7 +105,9 @@ class GraduationTasksedit extends Component{
|
|
|
|
// for(var list of fileList ){
|
|
|
|
// for(var list of fileList ){
|
|
|
|
// console.log(fileList)
|
|
|
|
// console.log(fileList)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
this.setState({ fileList });
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
fileList: appendFileSizeToUploadFileAll(fileList),
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// onAttachmentRemove = (file) => {
|
|
|
|
// onAttachmentRemove = (file) => {
|
|
|
@ -143,10 +145,10 @@ class GraduationTasksedit extends Component{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onAttachmentRemove = (file) => {
|
|
|
|
onAttachmentRemove = (file) => {
|
|
|
|
|
|
|
|
debugger
|
|
|
|
this.cancelAttachment();
|
|
|
|
this.cancelAttachment();
|
|
|
|
// const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
|
|
|
|
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
|
|
|
|
const url = `/attachments/${file}.json`
|
|
|
|
// const url = `/attachments/${file}.json`
|
|
|
|
axios.delete(url, {
|
|
|
|
axios.delete(url, {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.then((response) => {
|
|
|
|
.then((response) => {
|
|
|
@ -281,7 +283,7 @@ class GraduationTasksedit extends Component{
|
|
|
|
width: 600,
|
|
|
|
width: 600,
|
|
|
|
// https://github.com/ant-design/ant-design/issues/15505
|
|
|
|
// https://github.com/ant-design/ant-design/issues/15505
|
|
|
|
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
|
|
|
|
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
|
|
|
|
showUploadList: false,
|
|
|
|
// showUploadList: false,
|
|
|
|
action: `${getUrl()}/api/attachments.json`,
|
|
|
|
action: `${getUrl()}/api/attachments.json`,
|
|
|
|
onChange: this.handleChange,
|
|
|
|
onChange: this.handleChange,
|
|
|
|
onRemove: this.onAttachmentRemove,
|
|
|
|
onRemove: this.onAttachmentRemove,
|
|
|
@ -414,12 +416,7 @@ class GraduationTasksedit extends Component{
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
</Form.Item>
|
|
|
|
</Form.Item>
|
|
|
|
<input type="hidden" id='descriptiontypes' />
|
|
|
|
<input type="hidden" id='descriptiontypes' />
|
|
|
|
<Upload {...uploadProps} fileList={this.state.fileList} className="upload_1 ml5">
|
|
|
|
|
|
|
|
<Button className="uploadBtn">
|
|
|
|
|
|
|
|
<Icon type="upload" /> 上传附件
|
|
|
|
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
(单个文件150M以内)
|
|
|
|
|
|
|
|
</Upload>
|
|
|
|
|
|
|
|
{attachments&&attachments.map((item,key)=>{
|
|
|
|
{attachments&&attachments.map((item,key)=>{
|
|
|
|
|
|
|
|
|
|
|
|
return(
|
|
|
|
return(
|
|
|
@ -448,37 +445,43 @@ class GraduationTasksedit extends Component{
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
})}
|
|
|
|
})}
|
|
|
|
<style>
|
|
|
|
<Upload {...uploadProps} fileList={this.state.fileList} className="upload_1 ml5">
|
|
|
|
{
|
|
|
|
<Button className="uploadBtn">
|
|
|
|
`
|
|
|
|
<Icon type="upload" /> 上传附件
|
|
|
|
.maxwidth500{
|
|
|
|
</Button>
|
|
|
|
max-width:500px;
|
|
|
|
(单个文件150M以内)
|
|
|
|
overflow: hidden;
|
|
|
|
</Upload>
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
{/*<style>*/}
|
|
|
|
white-space: nowrap;
|
|
|
|
{/*{*/}
|
|
|
|
color: #05101a;
|
|
|
|
{/*`*/}
|
|
|
|
}
|
|
|
|
{/*.maxwidth500{*/}
|
|
|
|
`
|
|
|
|
{/*max-width:500px;*/}
|
|
|
|
}
|
|
|
|
{/*overflow: hidden;*/}
|
|
|
|
</style>
|
|
|
|
{/*text-overflow: ellipsis;*/}
|
|
|
|
{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{
|
|
|
|
{/*white-space: nowrap;*/}
|
|
|
|
return(
|
|
|
|
{/*color: #05101a;*/}
|
|
|
|
<p className="color-grey mt10" key={key} >
|
|
|
|
{/*}*/}
|
|
|
|
<a className="color-grey fl">
|
|
|
|
{/*`*/}
|
|
|
|
<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>
|
|
|
|
{/*}*/}
|
|
|
|
</a>
|
|
|
|
{/*</style>*/}
|
|
|
|
<span className="mr12 color9B9B maxwidth500 fl" length="58">
|
|
|
|
{/*{this.state.fileList.length===0?"":this.state.fileList.map((item,key)=>{*/}
|
|
|
|
{item.name}
|
|
|
|
{/*return(*/}
|
|
|
|
</span>
|
|
|
|
{/*<p className="color-grey mt10" key={key} >*/}
|
|
|
|
<span className="color656565 mt2 color-grey-6 font-12 mr8">
|
|
|
|
{/*<a className="color-grey fl">*/}
|
|
|
|
{item.response===undefined?"":bytesToSize(item.size)}
|
|
|
|
{/*<i className="font-14 color-green iconfont icon-fujian mr8" aria-hidden="true"></i>*/}
|
|
|
|
</span>
|
|
|
|
{/*</a>*/}
|
|
|
|
<i className="font-14 iconfont icon-guanbi "
|
|
|
|
{/*<span className="mr12 color9B9B maxwidth500 fl" length="58">*/}
|
|
|
|
id={item.response===undefined?"":item.response.id}
|
|
|
|
{/*{item.name}*/}
|
|
|
|
aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}></i>
|
|
|
|
{/*</span>*/}
|
|
|
|
</p>
|
|
|
|
{/*<span className="color656565 mt2 color-grey-6 font-12 mr8">*/}
|
|
|
|
)
|
|
|
|
{/*{item.response===undefined?"":bytesToSize(item.size)}*/}
|
|
|
|
})}
|
|
|
|
{/*</span>*/}
|
|
|
|
|
|
|
|
{/*<i className="font-14 iconfont icon-guanbi "*/}
|
|
|
|
|
|
|
|
{/*id={item.response===undefined?"":item.response.id}*/}
|
|
|
|
|
|
|
|
{/*aria-hidden="true" onClick={()=>this.onAttachmentRemove(item.response===undefined?"":item.response.id&&item.response.id)}></i>*/}
|
|
|
|
|
|
|
|
{/*</p>*/}
|
|
|
|
|
|
|
|
{/*)*/}
|
|
|
|
|
|
|
|
{/*})}*/}
|
|
|
|
{/*{attachments&&attachments.map((item,key)=>{*/}
|
|
|
|
{/*{attachments&&attachments.map((item,key)=>{*/}
|
|
|
|
|
|
|
|
|
|
|
|
{/*return(*/}
|
|
|
|
{/*return(*/}
|
|
|
|