diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicNewFrom.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicNewFrom.js index a015b96cf..24336c356 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicNewFrom.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicNewFrom.js @@ -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,28 +106,26 @@ 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) => { - if (response.data) { - const { status } = response.data; - if (status == 0) { - console.log('--- success') - - this.setState((state) => { - const index = state.fileList.indexOf(file); - const newFileList = state.fileList.slice(); - newFileList.splice(index, 1); - return { - fileList: newFileList, - }; - }); - } + axios.delete(url).then((response) => { + if (response.data) { + const { status } = response.data; + if (status == 0) { + console.log('--- success') + + this.setState((state) => { + const index = state.fileList.indexOf(file); + const newFileList = state.fileList.slice(); + newFileList.splice(index, 1); + return { + fileList: newFileList, + }; + }); } - }) - .catch(function (error) { - console.log(error); - }); + } + }) + .catch(function (error) { + console.log(error); + }); } changeTopicName=(e)=>{ @@ -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; } - return isLt150M; - }, + } }; let { topicId , teacherName }=this.props; return( diff --git a/public/react/src/modules/courses/poll/PollDetailTabThird.js b/public/react/src/modules/courses/poll/PollDetailTabThird.js index 47fcaf52f..564deb1ca 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabThird.js +++ b/public/react/src/modules/courses/poll/PollDetailTabThird.js @@ -35,104 +35,102 @@ class PollDetailTabThird extends Component{ render(){ let {pollDetail}=this.state; return( -
{ pollDetail.poll.polls_description }
+{ pollDetail.poll.polls_description }
} -
- { pollDetail && pollDetail.question_types.q_counts===0 ? "" :
-
- {
- pollDetail && pollDetail.question_types.q_counts > 0 &&
- 合计{pollDetail.question_types.q_counts}题:
- }
+
+ { pollDetail && pollDetail.question_types.q_counts===0 ? "" :
+
+ {
+ pollDetail && pollDetail.question_types.q_counts > 0 &&
+ 合计{pollDetail.question_types.q_counts}题:
+ }
+ {
+ pollDetail && pollDetail.question_types.q_singles > 0 &&
+ 单选题{pollDetail.question_types.q_singles}题
+ }
+ {
+ pollDetail && pollDetail.question_types.q_doubles > 0 &&
+ 多选题{pollDetail.question_types.q_doubles}题
+ }
+ {
+ pollDetail && pollDetail.question_types.q_mains > 0 &&
+ 主观题{pollDetail.question_types.q_mains}题
+ }
+
+ }
+
+ {item.question.question_number}、{map[item.question.question_type]}
+ { item.question.is_necessary==1 ? 必答:选答 }
+ { item.question.question_type == 2 && item.question.min_choices && item.question.max_choices ?
+
+ {
+ item.question.min_choices == item.question.max_choices ? "可选"+item.question.max_choices+"项" :
+ "可选"+item.question.min_choices+"-"+item.question.max_choices+"项"
+ }
+ :""
+ }
+
- {item.question.question_number}、{map[item.question.question_type]}
- { item.question.is_necessary==1 ? 必答:选答 }
- { item.question.question_type == 2 && item.question.min_choices && item.question.max_choices ?
-
- {
- item.question.min_choices == item.question.max_choices ? "可选"+item.question.max_choices+"项" :
- "可选"+item.question.min_choices+"-"+item.question.max_choices+"项"
- }
- :""
- }
-