Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_hss
SylorHuang 6 years ago
commit dc04d43f9c

@ -40,6 +40,7 @@ class AccessoryModal extends Component{
} }
// 附件相关 START // 附件相关 START
handleChange = (info) => { handleChange = (info) => {
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList; let fileList = info.fileList;
console.log(fileList) console.log(fileList)
// for(var list of fileList ){ // for(var list of fileList ){
@ -50,6 +51,7 @@ class AccessoryModal extends Component{
Errormessage:false, Errormessage:false,
}); });
} }
}
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
// confirm({ // confirm({

@ -2,11 +2,12 @@ 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,appendFileSizeToUploadFileAll} from 'educoder'; import {WordsBtn, getUrl,bytesToSize,appendFileSizeToUploadFileAll , getUploadActionUrl} 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';
const {Option} = Select; const {Option} = Select;
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
const confirm = Modal.confirm; const confirm = Modal.confirm;
@ -127,7 +128,7 @@ class GraduationTasksnew extends Component {
} }
// 附件相关 START // 附件相关 START
handleChange = (info) => { 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; let fileList = info.fileList;
// for(var list of fileList ){ // for(var list of fileList ){
@ -174,6 +175,25 @@ class GraduationTasksnew extends Component {
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
if(!file.percent || file.percent == 100){ if(!file.percent || file.percent == 100){
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.response ? file.response.id : file.uid}.json`
// const url = `/attachments/${file}.json` // const url = `/attachments/${file}.json`
axios.delete(url, {}) axios.delete(url, {})
@ -200,8 +220,6 @@ class GraduationTasksnew extends Component {
}); });
} }
}
//滚动 //滚动
ifHasAnchorJustScorll() { ifHasAnchorJustScorll() {
// let anchor = this.getURLStuff("anchor"); // let anchor = this.getURLStuff("anchor");
@ -267,7 +285,7 @@ class GraduationTasksnew extends Component {
// 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: `${getUploadActionUrl()}`,
onChange: this.handleChange, onChange: this.handleChange,
onRemove: this.onAttachmentRemove, onRemove: this.onAttachmentRemove,
beforeUpload: (file) => { beforeUpload: (file) => {

@ -11,7 +11,7 @@ import {getUrl} from 'educoder';
import "../../common/formCommon.css" import "../../common/formCommon.css"
import '../style.css' import '../style.css'
import '../../css/Courses.css' import '../../css/Courses.css'
import { WordsBtn, City } from 'educoder' import { WordsBtn, City , getUploadActionUrl } from 'educoder'
import {Link} from 'react-router-dom' import {Link} from 'react-router-dom'
// import City from './City' // import City from './City'
@ -211,14 +211,16 @@ class GraduateTopicNew extends Component{
// 附件相关 START // 附件相关 START
handleChange = (info) => { handleChange = (info) => {
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let fileList = info.fileList; let fileList = info.fileList;
this.setState({ fileList }); this.setState({ fileList });
} }
}
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
if(!file.percent || file.percent == 100){ if(!file.percent || file.percent == 100){
confirm({ this.props.confirm({
title: '确定要删除这个附件吗?', content: '确定要删除这个附件吗?',
okText: '确定', okText: '确定',
cancelText: '取消', cancelText: '取消',
// content: 'Some descriptions', // content: 'Some descriptions',
@ -307,7 +309,7 @@ class GraduateTopicNew extends Component{
// 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: `${getUploadActionUrl()}`,
onChange: this.handleChange, onChange: this.handleChange,
onRemove: this.onAttachmentRemove, onRemove: this.onAttachmentRemove,
beforeUpload: (file) => { beforeUpload: (file) => {

Loading…
Cancel
Save