|  |  |  | @ -2,11 +2,12 @@ import React, {Component} from "React"; | 
			
		
	
		
			
				
					|  |  |  |  | import {Form, Select, Input, Button, Checkbox, Upload, Icon, message, Modal} from "antd"; | 
			
		
	
		
			
				
					|  |  |  |  | import {Link} from 'react-router-dom'; | 
			
		
	
		
			
				
					|  |  |  |  | import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; | 
			
		
	
		
			
				
					|  |  |  |  | import {WordsBtn, getUrl,bytesToSize,appendFileSizeToUploadFileAll} from 'educoder'; | 
			
		
	
		
			
				
					|  |  |  |  | import {WordsBtn, getUrl,bytesToSize,appendFileSizeToUploadFileAll , getUploadActionUrl} from 'educoder'; | 
			
		
	
		
			
				
					|  |  |  |  | import axios from 'axios'; | 
			
		
	
		
			
				
					|  |  |  |  | import Modals from '../../../modals/Modals'; | 
			
		
	
		
			
				
					|  |  |  |  | import '../../css/Courses.css'; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | const {Option} = Select; | 
			
		
	
		
			
				
					|  |  |  |  | const CheckboxGroup = Checkbox.Group; | 
			
		
	
		
			
				
					|  |  |  |  | const confirm = Modal.confirm; | 
			
		
	
	
		
			
				
					|  |  |  | @ -127,7 +128,7 @@ class GraduationTasksnew extends Component { | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 	// 附件相关 START
 | 
			
		
	
		
			
				
					|  |  |  |  | 	handleChange = (info) => { | 
			
		
	
		
			
				
					|  |  |  |  | 		if(info.file.status == "done" || info.file.status == "uploading"){ | 
			
		
	
		
			
				
					|  |  |  |  | 		if(info.file.status == "done" || info.file.status == "uploading" || info.file.status === 'removed'){ | 
			
		
	
		
			
				
					|  |  |  |  | 			let fileList = info.fileList; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 			// for(var list of fileList ){
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -174,7 +175,26 @@ class GraduationTasksnew extends Component { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	onAttachmentRemove = (file) => { | 
			
		
	
		
			
				
					|  |  |  |  | 		if(!file.percent || file.percent == 100){ | 
			
		
	
		
			
				
					|  |  |  |  | 			const url = `/attachments/${file.response ? file.response.id : file.uid}.json` | 
			
		
	
		
			
				
					|  |  |  |  | 			this.props.confirm({ | 
			
		
	
		
			
				
					|  |  |  |  | 				content: '确定要删除这个附件吗?', | 
			
		
	
		
			
				
					|  |  |  |  | 				okText: '确定', | 
			
		
	
		
			
				
					|  |  |  |  | 				cancelText: '取消', | 
			
		
	
		
			
				
					|  |  |  |  | 				// content: 'Some descriptions',
 | 
			
		
	
		
			
				
					|  |  |  |  | 				onOk: () => { | 
			
		
	
		
			
				
					|  |  |  |  | 					this.deleteAttachment(file) | 
			
		
	
		
			
				
					|  |  |  |  | 				}, | 
			
		
	
		
			
				
					|  |  |  |  | 				onCancel() { | 
			
		
	
		
			
				
					|  |  |  |  | 					console.log('Cancel'); | 
			
		
	
		
			
				
					|  |  |  |  | 				}, | 
			
		
	
		
			
				
					|  |  |  |  | 			}); | 
			
		
	
		
			
				
					|  |  |  |  | 			return false; | 
			
		
	
		
			
				
					|  |  |  |  | 			 | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	deleteAttachment = (file) =>{ | 
			
		
	
		
			
				
					|  |  |  |  | 		const url = `/attachments/${file.response ? file.response.id : file.uid}.json` | 
			
		
	
		
			
				
					|  |  |  |  | 			// const url = `/attachments/${file}.json`
 | 
			
		
	
		
			
				
					|  |  |  |  | 			axios.delete(url, {}) | 
			
		
	
		
			
				
					|  |  |  |  | 				.then((response) => { | 
			
		
	
	
		
			
				
					|  |  |  | @ -198,8 +218,6 @@ class GraduationTasksnew extends Component { | 
			
		
	
		
			
				
					|  |  |  |  | 				.catch(function (error) { | 
			
		
	
		
			
				
					|  |  |  |  | 					console.log(error); | 
			
		
	
		
			
				
					|  |  |  |  | 				}); | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	//滚动
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -267,7 +285,7 @@ class GraduationTasksnew extends Component { | 
			
		
	
		
			
				
					|  |  |  |  | 			// https://github.com/ant-design/ant-design/issues/15505
 | 
			
		
	
		
			
				
					|  |  |  |  | 			// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
 | 
			
		
	
		
			
				
					|  |  |  |  | 	    // showUploadList: false,
 | 
			
		
	
		
			
				
					|  |  |  |  | 			action: `${getUrl()}/api/attachments.json`, | 
			
		
	
		
			
				
					|  |  |  |  | 			action: `${getUploadActionUrl()}`, | 
			
		
	
		
			
				
					|  |  |  |  | 			onChange: this.handleChange, | 
			
		
	
		
			
				
					|  |  |  |  | 			onRemove: this.onAttachmentRemove, | 
			
		
	
		
			
				
					|  |  |  |  | 			beforeUpload: (file) => { | 
			
		
	
	
		
			
				
					|  |  |  | 
 |