From 489a3205a251771143825803fb0532bf1963d1f1 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Thu, 29 Aug 2019 15:48:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E5=8D=B7+=E6=AF=95=E8=AE=BE=E9=80=89?= =?UTF-8?q?=E9=A2=98=E7=9A=84=E9=99=84=E4=BB=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../graduation/topics/GraduateTopicNewFrom.js | 80 ++++---- .../courses/poll/PollDetailTabThird.js | 176 +++++++++--------- .../src/modules/courses/poll/pollStyle.css | 2 +- 3 files changed, 129 insertions(+), 129 deletions(-) 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 && pollDetail.poll.polls_description && -

{ 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}题 + } + + } +

+ + { + pollDetail && pollDetail.questions.map((item,key)=>{ + return( +
+

+ {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_title}
  • { - pollDetail && pollDetail.question_types.q_singles > 0 && - 单选题{pollDetail.question_types.q_singles}题 + // 单选题 + item.question.question_type==1 && + + { + item.question.answers.map((index,k)=>{ + return( +
  • + + {index.answer_text} + { + index.answer_text=="其他" ?

    :"" + } + +
  • + ) + }) + } +
    } { - pollDetail && pollDetail.question_types.q_doubles > 0 && - 多选题{pollDetail.question_types.q_doubles}题 + // 多选题 + item.question.question_type==2 && + + { + item.question.answers.map((index,k)=>{ + return( +
  • + + {index.answer_text} + { + index.answer_text=="其他" ?

    :"" + } +
  • + ) + }) + } +
    } { - pollDetail && pollDetail.question_types.q_mains > 0 && - 主观题{pollDetail.question_types.q_mains}题 + // 主观题 + item.question.question_type == 3 && +
    + +
    } - - } -

    - - { - pollDetail && pollDetail.questions.map((item,key)=>{ - return( -
    -

    - {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_title}
  • - { - // 单选题 - item.question.question_type==1 && - - { - item.question.answers.map((index,k)=>{ - return( -
  • - - {index.answer_text} - { - index.answer_text=="其他" ?

    :"" - } - -
  • - ) - }) - } -
    - } - { - // 多选题 - item.question.question_type==2 && - - { - item.question.answers.map((index,k)=>{ - return( -
  • - - {index.answer_text} - { - index.answer_text=="其他" ?

    :"" - } -
  • - ) - }) - } -
    - } - { - // 主观题 - item.question.question_type == 3 && -
    - -
    - } - -
    - ) - }) - } -
    + +
    + ) + }) + }
    ) } diff --git a/public/react/src/modules/courses/poll/pollStyle.css b/public/react/src/modules/courses/poll/pollStyle.css index a486101cd..023229f92 100644 --- a/public/react/src/modules/courses/poll/pollStyle.css +++ b/public/react/src/modules/courses/poll/pollStyle.css @@ -185,7 +185,7 @@ width: 100%; } .answerList li:hover{ - background: #F8F8F8; + background: #F0F8FF; } textarea:read-only{ background: #f3f3f3;