|
|
|
@ -7,7 +7,7 @@ import TPMRightSection from './component/TPMRightSection';
|
|
|
|
|
import TPMNav from './component/TPMNav';
|
|
|
|
|
import axios from 'axios';
|
|
|
|
|
import './tpmmodel/tpmmodel.css'
|
|
|
|
|
import {getUploadActionUrl} from 'educoder';
|
|
|
|
|
import {getUploadActionUrl,appendFileSizeToUploadFileAll} from 'educoder';
|
|
|
|
|
import moment from 'moment';
|
|
|
|
|
|
|
|
|
|
const confirm = Modal.confirm;
|
|
|
|
@ -260,40 +260,26 @@ class TPMDataset extends Component {
|
|
|
|
|
if (index % 2 === 1) className = 'dark-row';
|
|
|
|
|
return className;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 附件相关 START
|
|
|
|
|
handleChange = (info) => {
|
|
|
|
|
console.log("handleChange");
|
|
|
|
|
console.log(info);
|
|
|
|
|
if(info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
|
|
|
|
|
let {fileList} = this.state;
|
|
|
|
|
|
|
|
|
|
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
|
|
|
|
|
console.log("handleChange1fileLists");
|
|
|
|
|
// if(fileList.length===0){
|
|
|
|
|
let fileLists = info.fileList;
|
|
|
|
|
// console.log(fileLists);
|
|
|
|
|
this.setState({
|
|
|
|
|
// fileList:appendFileSizeToUploadFileAll(fileList),
|
|
|
|
|
fileList: fileLists,
|
|
|
|
|
deleteisnot: false
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if(info.file.status == "done" || info.file.status == "uploading" || info.file.status === 'removed'){
|
|
|
|
|
let fileList = info.fileList;
|
|
|
|
|
|
|
|
|
|
// for(var list of fileList ){
|
|
|
|
|
// console.log(list)
|
|
|
|
|
// }
|
|
|
|
|
this.setState({
|
|
|
|
|
fileList: appendFileSizeToUploadFileAll(fileList),
|
|
|
|
|
});
|
|
|
|
|
if(info.file.status === 'done'){
|
|
|
|
|
//done 成功就会调用这个方法
|
|
|
|
|
this.getdatas();
|
|
|
|
|
// this.props.showNotification(`上传文件成功`);
|
|
|
|
|
|
|
|
|
|
}else if(info.file.status === 'removed'){
|
|
|
|
|
// this.props.showNotification(`上传文件失败`);
|
|
|
|
|
|
|
|
|
|
}else if(info.file.status === 'uploading'){
|
|
|
|
|
// this.props.showNotification(`正在上传文件中`);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onAttachmentRemove = (file) => {
|
|
|
|
|
// debugger
|
|
|
|
|
if(!file.percent || file.percent == 100){
|
|
|
|
@ -405,47 +391,27 @@ class TPMDataset extends Component {
|
|
|
|
|
width: 600,
|
|
|
|
|
fileList,
|
|
|
|
|
data:{
|
|
|
|
|
attachtype: 2,
|
|
|
|
|
attachtype: 2,
|
|
|
|
|
container_id:this.props.match.params.shixunId,
|
|
|
|
|
container_type: "Shixun",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
multiple: true,
|
|
|
|
|
// https://github.com/ant-design/ant-design/issues/15505
|
|
|
|
|
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
|
|
|
|
|
// showUploadList: false,
|
|
|
|
|
action: `${getUploadActionUrl()}`,
|
|
|
|
|
action: `${getUploadActionUrl()}`,
|
|
|
|
|
onChange: this.handleChange,
|
|
|
|
|
onRemove: this.onAttachmentRemove,
|
|
|
|
|
beforeUpload: (file, fileList) => {
|
|
|
|
|
|
|
|
|
|
if (this.state.fileList.length >= 1) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
// console.log('beforeUpload', file.name);
|
|
|
|
|
const isLt150M = file.size / 1024 / 1024 < 50;
|
|
|
|
|
beforeUpload: (file) => {
|
|
|
|
|
console.log('beforeUpload', file.name);
|
|
|
|
|
const isLt150M = file.size / 1024 / 1024 < 150;
|
|
|
|
|
if (!isLt150M) {
|
|
|
|
|
// this.props.showNotification(`文件大小必须小于50MB`);
|
|
|
|
|
notification.open(
|
|
|
|
|
{
|
|
|
|
|
message: '提示',
|
|
|
|
|
description:
|
|
|
|
|
'文件大小必须小于50MB',
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
if(this.state.file !== undefined){
|
|
|
|
|
console.log("763")
|
|
|
|
|
this.setState({
|
|
|
|
|
file:file
|
|
|
|
|
})
|
|
|
|
|
}else {
|
|
|
|
|
this.setState({
|
|
|
|
|
file:file
|
|
|
|
|
})
|
|
|
|
|
this.props.showNotification('文件大小必须小于150MB!');
|
|
|
|
|
}
|
|
|
|
|
return isLt150M;
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
<div className="tpmComment educontent clearfix mt30 mb80">
|
|
|
|
@ -477,7 +443,7 @@ class TPMDataset extends Component {
|
|
|
|
|
`
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<div className="deletebuttom intermediatecenter "> <Upload {...uploadProps}><p className="deletebuttomtest">
|
|
|
|
|
<div className="deletebuttom intermediatecenter "> <Upload {...uploadProps}><p className="deletebuttomtest" type="upload">
|
|
|
|
|
|
|
|
|
|
上传文件</p> </Upload></div>
|
|
|
|
|
{
|
|
|
|
|