Merge remote-tracking branch 'origin/topic_bank' into topic_bank

dev_aliyun_beta
杨树明 5 years ago
commit 6b938d222d

@ -5,9 +5,7 @@ import {
} from 'antd';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
import axios from 'axios'
import {getUrl} from 'educoder';
import { City } from 'educoder'
import { City , getUploadActionUrl , appendFileSizeToUploadFileAll } from 'educoder';
const NAME_COUNT=60;
class GraduateTopicNewForm extends Component{
@ -80,15 +78,21 @@ class GraduateTopicNewForm extends Component{
// 附件相关 START
handleChange = (info) => {
let fileList = info.fileList;
this.setState({ fileList });
if (info.file.status === 'done' || info.file.status === 'uploading') {
let contentFileList = info.fileList;
// this.setState({ fileList: appendFileSizeToUploadFileAll(contentFileList)});
// let list = appendFileSizeToUploadFileAll(contentFileList);
// let arr = list.map(item=>{
// return ( item.response && item.response.id )
// })
this.setState({
fileList:contentFileList
});
}
}
onAttachmentRemove = (file) => {
confirm({
title: '确定要删除这个附件吗?',
okText: '确定',
cancelText: '取消',
// content: 'Some descriptions',
this.props.confirm({
content: '确定要删除这个附件吗?',
onOk: () => {
this.deleteAttachment(file)
},
@ -102,9 +106,7 @@ class GraduateTopicNewForm extends Component{
console.log(file);
let id=file.response ==undefined ? file.id : file.response.id
const url = `/attachments/${id}.json`
axios.delete(url, {
})
.then((response) => {
axios.delete(url).then((response) => {
if (response.data) {
const { status } = response.data;
if (status == 0) {
@ -205,20 +207,20 @@ class GraduateTopicNewForm extends Component{
width: 600,
fileList,
multiple: true,
// 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) => {
console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) {
message.error('文件大小必须小于150MB!');
}
//message.error('文件大小必须小于150MB!');
this.props.define({
title:'提示',
content:"该文件无法上传。超过文件大小限制(150MB),建议上传到百度云等其它共享工具里然后再txt文档里给出链接以及共享密码并上传"
})
return isLt150M;
},
}
}
};
let { topicId , teacherName }=this.props;
return(

@ -35,13 +35,12 @@ class PollDetailTabThird extends Component{
render(){
let {pollDetail}=this.state;
return(
<div>
<div className="edu-back-white">
{
pollDetail && pollDetail.poll.polls_description &&
<p style={{backgroundColor:"#F2F9FF",whiteSpace:"pre-wrap"}} className="color-blue pt15 pb15 pl30 pr30">{ pollDetail.poll.polls_description }</p>
<p style={{whiteSpace:"pre-wrap"}} className="color-grey-9 padding20-30 edu-back-white">{ pollDetail.poll.polls_description }</p>
}
<div className="edu-back-white">
<p className="padding20-30 clearfix bor-bottom-greyE edu-txt-left">
<p className="padding20-30 clearfix edu-txt-left" style={{background:'#FAFAFA'}}>
{ pollDetail && pollDetail.question_types.q_counts===0 ? "" :
<span className="color-grey-3">
{
@ -133,7 +132,6 @@ class PollDetailTabThird extends Component{
})
}
</div>
</div>
)
}
}

@ -185,7 +185,7 @@
width: 100%;
}
.answerList li:hover{
background: #F8F8F8;
background: #F0F8FF;
}
textarea:read-only{
background: #f3f3f3;

Loading…
Cancel
Save