From abf2789c7a60dfea69d1bb619c423f7cbdc9021b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 27 Jul 2019 08:57:56 +0800 Subject: [PATCH 01/33] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/user/LoginRegisterComponent.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 3f54149bf..fa56398e2 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -358,7 +358,6 @@ class LoginRegisterComponent extends Component { weekArray="/"; } window.location.href = weekArray; - } } From 4f1430c914b71ea0345ce38637b7c74c06485313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 27 Jul 2019 09:14:14 +0800 Subject: [PATCH 02/33] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/user/LoginRegisterComponent.js | 10 ++++++++-- public/react/src/modules/user/Notcompletedysl.js | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index fa56398e2..eb0a3a5c2 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -65,6 +65,7 @@ class LoginRegisterComponent extends Component { Whethertoverify:false, pciphone:true, MyEduCoderModals:false, + registered:undefined, } } @@ -101,6 +102,7 @@ class LoginRegisterComponent extends Component { Whethertoverify:false, pciphone:true, MyEduCoderModals:false, + registered:undefined, } } @@ -880,12 +882,15 @@ class LoginRegisterComponent extends Component { setNotcompleteds=()=>{ this.setState({ Notcompleteds:true, - MyEduCoderModals:false + MyEduCoderModals:false, + registered:undefined, + }) }; setMyEduCoderModals=()=>{ this.setState({ - MyEduCoderModals:true + MyEduCoderModals:true, + registered:"注册成功" }) }; render() { @@ -1039,6 +1044,7 @@ class LoginRegisterComponent extends Component { } {this.state.MyEduCoderModals===true? {this.setNotcompleteds()}} />:""} diff --git a/public/react/src/modules/user/Notcompletedysl.js b/public/react/src/modules/user/Notcompletedysl.js index fc70f838e..8f147957a 100644 --- a/public/react/src/modules/user/Notcompletedysl.js +++ b/public/react/src/modules/user/Notcompletedysl.js @@ -53,13 +53,13 @@ class Notcompletedysl extends Component { closable={false} footer={null} destroyOnClose={true} - title="提示" + title={this.props.registered===undefined?"提示":"注册成功"} centered={true} visible={this.props.modalsType} width="530px" >
-

完善您的资料,将获得更多的使用权限

+

完善您的资料,将获得更多的使用权限

this.modalCancel()}>取消 this.setDownload()}>立即完善 From bc9ee87ee18820bfcc59f3401ac9a2cdfe46fe23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 27 Jul 2019 09:47:47 +0800 Subject: [PATCH 03/33] =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/component/TPMRightSection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/tpm/component/TPMRightSection.js b/public/react/src/modules/tpm/component/TPMRightSection.js index a3a7e9820..fd96454c4 100644 --- a/public/react/src/modules/tpm/component/TPMRightSection.js +++ b/public/react/src/modules/tpm/component/TPMRightSection.js @@ -67,7 +67,7 @@ class TPMRightSection extends Component {

创建者

- + 头像
From de3261c9a053643f28765551368b5edc521f4cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 27 Jul 2019 10:05:20 +0800 Subject: [PATCH 04/33] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/poll/PollNew.js | 2 +- .../src/modules/courses/shixunHomework/ShixunWorkReport.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index cd559b75f..705b1658c 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -2388,7 +2388,7 @@ class PollNew extends Component { this.gotohome()}>{this.props.coursedata.name} > 问卷 + href={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollid}`}>问卷 > {this.props.match.params.news === undefined ? "新建" : this.props.match.params.news === "new" ? "新建" : "编辑"}

diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js index 91f6f3001..565121e1b 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkReport.js @@ -135,7 +135,7 @@ class ShixunWorkReport extends Component { {data===undefined?"":data.category===null?"":data.category.category_name} > - 作业详情 + 作业详情 > {data&&data.username}

From 8c393990f0210310eb288a6de4d03354d90753e9 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 27 Jul 2019 10:16:55 +0800 Subject: [PATCH 05/33] height 40 --- public/react/src/modules/courses/boards/BoardsNew.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index 8d9db7c3f..03c5f84f8 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -297,6 +297,9 @@ class BoardsNew extends Component{ .courseForm .noBorder { border-bottom: none; } + .courseForm .ant-input-group > .ant-input:first-child, .ant-input-group-addon:first-child { + height: 40px; + } `}
Date: Sat, 27 Jul 2019 10:39:27 +0800 Subject: [PATCH 06/33] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=9A=84=E6=9C=80?= =?UTF-8?q?=E5=B0=8F=E9=80=89=E9=A1=B9=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_votes_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/controllers/poll_votes_controller.rb b/app/controllers/poll_votes_controller.rb index b1191d8ea..b376b870f 100644 --- a/app/controllers/poll_votes_controller.rb +++ b/app/controllers/poll_votes_controller.rb @@ -147,9 +147,17 @@ class PollVotesController < ApplicationController else question_max_choices = 0 end + if @poll_question.min_choices.present? + question_min_choices = @poll_question.min_choices + else + question_min_choices = 0 + end if question_max_choices > 0 && (user_vote_count > question_max_choices) normal_status(-1,"多选题答案超过最大限制!") end + if question_min_choices > 0 && (user_vote_count < question_min_choices) + normal_status(-1,"多选题答题不得少于最小限制!") + end elsif (poll_user.present? && poll_user.commit_status == 1) || poll_user_status == 3 normal_status(-1,"已提交/已结束的问卷不允许修改!") end From 14ce4c695f65904ef805fc61e22a37b7f3b80f9d Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 27 Jul 2019 10:40:56 +0800 Subject: [PATCH 07/33] 40 --- .../src/modules/courses/boards/BoardsNew.js | 4 +--- .../react/src/modules/courses/css/Courses.css | 20 +++++++++++++++++++ .../courses/members/modal/AddStudentModal.js | 2 +- .../courses/members/modal/AddTeacherModal.js | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index 03c5f84f8..7c48d372b 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -297,9 +297,7 @@ class BoardsNew extends Component{ .courseForm .noBorder { border-bottom: none; } - .courseForm .ant-input-group > .ant-input:first-child, .ant-input-group-addon:first-child { - height: 40px; - } + `}
.ant-input:first-child, .ant-input-group-addon:first-child { + height: 40px; +} +.courseForm .ant-select-selection, .courseForm .ant-select-selection-selected-value { + height: 40px; + line-height: 40px; +} +.courseForm .ant-input-affix-wrapper .ant-input { + height: 40px; +} +.courseForm .ant-select-auto-complete.ant-select .ant-input { + height: 40px; +} + +.courseForm .ant-select-auto-complete.ant-select .ant-select-selection__rendered { + line-height: 40px; +} +.courseForm .ant-select-auto-complete.ant-select .ant-input { + height: 40px; +} /*新建课堂*/ diff --git a/public/react/src/modules/courses/members/modal/AddStudentModal.js b/public/react/src/modules/courses/members/modal/AddStudentModal.js index c3d8cdd75..97e1a4bbe 100644 --- a/public/react/src/modules/courses/members/modal/AddStudentModal.js +++ b/public/react/src/modules/courses/members/modal/AddStudentModal.js @@ -159,7 +159,7 @@ class AddStudentModal extends Component{ title={`添加${moduleName}`} {...this.props } onOk={this.onOk} - className="addStudentModal" + className="addStudentModal courseForm" > -
-

- {course_name} - > - {left_banner_name} - > - {topicId==undefined?"新建":"编辑"} -

-
-

{topicId==undefined?"新建":"编辑"}毕设选题

- this.props.history.goBack()} className="color-grey-6 fr font-16">返回 -
- -
-
- - {getFieldDecorator('tea_id', { - rules: [{ - required: true, message: '请选择指导老师' - }], - })( - - )} - - - {getFieldDecorator('name', { - rules: [{ - required: true, message: '请输入选题名称', - }, { - max: 60, message: '最大限制为60个字符', - }], - })( - - )} - -
- - - -
- - - {getFieldDecorator('description', { - rules: [{ - required: true, message: '请输入选题简介', - }, { - max: 10000, message: '最大限制为10000个字符', - }], - })( - - )} - - - { - getFieldDecorator('file',{ - rules:[{ - required:false - }] - })( - - - (单个文件150M以内) - - ) - } - -
- - {getFieldDecorator('topic_type', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_source', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_property_first', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_property_second', { - rules: [{ - required: false, message: '', - }], - })( - - )} - -
-
- - - - - -
- - {getFieldDecorator('source_unit', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('topic_repeat', { - rules: [{ - required: false, message: '', - }], - })( - - )} - - - {getFieldDecorator('city', { - rules: [{ - initialValue: this.state.cityDefaultValue, - type: 'array', - required: false, message: '', - }], - })( - - )} - -
- - -
- - this.props.history.goBack()}>取消 -
-
- -
-
- ) - } -} - -const WrappedGraduateTopicNew = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicNew); -// RouteHOC() +import React,{ Component } from "react"; + +import { + Form, Input, InputNumber, Switch, Radio, + Slider, Button, Upload, Icon, Rate, Checkbox, message, + Row, Col, Select, Modal,Cascader +} from 'antd'; +import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; +import axios from 'axios' +import {getUrl} from 'educoder'; +import "../../common/formCommon.css" +import '../style.css' +import '../../css/Courses.css' +import { WordsBtn, City } from 'educoder' +// import City from './City' + +// import './board.css' +// import { RouteHOC } from './common.js' + +const confirm = Modal.confirm; +const $ = window.$ +const { Option } = Select; +// 新建毕设选题 +// https://lanhuapp.com/web/#/item/project/board/detail?pid=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&project_id=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&image_id=c6d9b36f-7701-4035-afdb-62404681108c +class GraduateTopicNew extends Component{ + constructor(props){ + super(props); + + this.mdRef = React.createRef(); + + this.state = { + fileList: [], + boards: [], + teacherList:[], + topic_property_first:[], + topic_property_second:[], + topic_repeat:[], + topic_source:[], + topic_type:[], + attachments:undefined, + addonAfter:60, + left_banner_id:undefined, + course_name:undefined + } + } + // 获取老师列表 + getTeacherList=()=>{ + const cid = this.props.match.params.coursesId + let url=`/courses/${cid}/graduation_topics/new.json`; + axios.get((url)).then((result)=>{ + if(result.status==200){ + this.setState({ + teacherList:result.data.teacher_list, + left_banner_id:result.data.left_banner_id, + course_name:result.data.course_name, + left_banner_name:result.data.left_banner_name, + topic_property_first:result.data.topic_property_first, + topic_property_second:result.data.topic_property_second, + topic_repeat:result.data.topic_repeat, + topic_source:result.data.topic_source, + topic_type:result.data.topic_type + }) + console.log("sdfds"); + console.log(this.props.current_user && this.props.current_user.user_id); + this.props.form.setFieldsValue({ + tea_id:this.props.current_user && this.props.current_user.user_id + }) + } + }).catch((error)=>{ + console.log(error); + }) + } + componentDidMount = () => { + //新建or编辑 + let topicId=this.props.match.params.topicId; + + if(topicId==undefined){ + this.getTeacherList(); + }else{ + this.getEditInfo(); + + } + } + //编辑,信息显示 + getEditInfo=()=>{ + const cid = this.props.match.params.coursesId + let topicId=this.props.match.params.topicId + let url=`/courses/${cid}/graduation_topics/${topicId}/edit.json`; + axios.get((url)).then((result)=>{ + if(result){ + this.setState({ + left_banner_id:result.data.left_banner_id, + course_name:result.data.course_name, + left_banner_name:result.data.left_banner_name, + teacherList:result.data.teacher_list, + topic_property_first:result.data.topic_property_first, + topic_property_second:result.data.topic_property_second, + topic_repeat:result.data.topic_repeat, + topic_source:result.data.topic_source, + topic_type:result.data.topic_type, + attachments:result.data.attachments, + addonAfter:20-parseInt(result.data.selected_data.name.length) + }) + this.props.form.setFieldsValue({ + tea_id:result.data.selected_data.tea_id, + name:result.data.selected_data.name, + city: [result.data.selected_data.province,result.data.selected_data.city], + topic_type:result.data.selected_data.topic_type || undefined, + topic_source:result.data.selected_data.topic_source || undefined, + topic_property_first:result.data.selected_data.topic_property_first || undefined, + topic_property_second:result.data.selected_data.topic_property_second || undefined, + source_unit:result.data.selected_data.source_unit, + topic_repeat:result.data.selected_data.topic_repeat || undefined + }); + this.mdRef.current.setValue(result.data.selected_data.description) + const _fileList = result.data.attachments.map(item => { + return { + id: item.id, + uid: item.id, + name: item.title, + url: item.url, + status: 'done' + } + }) + this.setState({ fileList: _fileList, cityDefaultValue: [result.data.selected_data.province,result.data.selected_data.city] }) + } + }).catch((error)=>{ + console.log(error); + }) + } + + handleSubmit = (e) => { + e.preventDefault(); + const cid = this.props.match.params.coursesId + const topicId = this.props.match.params.topicId + // console.log(this.props); + + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + console.log('Received values of form: ', values); + if (topicId !=undefined) { + const editTopic = this.editTopic + const editUrl = `/courses/${cid}/graduation_topics/${topicId}.json` + + let attachment_ids = undefined + if (this.state.fileList) { + attachment_ids = this.state.fileList.map(item => { + return item.response ? item.response.id : item.id + }) + } + axios.put(editUrl, { + graduation_topic:{ + ...values, + province: values.city==undefined?"":values.city[0], + city: values.city==undefined?"":values.city[1], + }, + attachment_ids + }).then((response) => { + if (response.status == 200) { + const { id } = response.data; + if (id) { + this.props.showNotification('保存成功!'); + this.props.history.push(`/courses/${cid}/graduation_topics/${this.state.left_banner_id}`); + } + } + }).catch(function (error) { + console.log(error); + }); + } else { + const url = `/courses/${cid}/graduation_topics.json` + let attachment_ids = undefined + if (this.state.fileList) { + attachment_ids = this.state.fileList.map(item => { + return item.response.id + }) + } + + axios.post(url, { + graduation_topic:{ + ...values, + province: values.city==undefined?"":values.city[0], + city: values.city==undefined?"":values.city[1], + }, + attachment_ids, + }).then((response) => { + if (response.data) { + const { id } = response.data; + if (id) { + this.props.showNotification('提交成功!'); + this.props.history.push(`/courses/${cid}/graduation_topics/${this.state.left_banner_id}`); + } + } + }) + .catch(function (error) { + console.log(error); + }); + } + } else { + $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) + } + }); + } + + // 选择省市 + ChangeCity=(value, selectedOptions)=>{ + console.log(selectedOptions); + } + + // 附件相关 START + handleChange = (info) => { + let fileList = info.fileList; + this.setState({ fileList }); + } + onAttachmentRemove = (file) => { + confirm({ + title: '确定要删除这个附件吗?', + okText: '确定', + cancelText: '取消', + // content: 'Some descriptions', + onOk: () => { + this.deleteAttachment(file) + }, + onCancel() { + console.log('Cancel'); + }, + }); + return false; + } + deleteAttachment = (file) => { + 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, + }; + }); + } + } + }) + .catch(function (error) { + console.log(error); + }); + } + + // 附件相关 ------------ END + + changeTopicName=(e)=>{ + let num= 60 - parseInt(e.target.value.length); + this.setState({ + addonAfter:num < 0 ? 0 : num + }) + } + render() { + let { + fileList, + teacherList, + topic_property_first, + topic_property_second, + topic_repeat, + topic_source, + topic_type, + addonAfter, + left_banner_id, + course_name, + left_banner_name + } = this.state; + const { current_user } = this.props + const { getFieldDecorator } = this.props.form; + let{ topicId,coursesId }=this.props.match.params + // console.log(this.props); + + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + // sm: { span: 8 }, + sm: { span: 24 }, + }, + wrapperCol: { + xs: { span: 24 }, + // sm: { span: 16 }, + sm: { span: 24 }, + }, + }; + const uploadProps = { + width: 600, + fileList, + multiple: true, + // https://github.com/ant-design/ant-design/issues/15505 + // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 + // showUploadList: false, + action: `${getUrl()}/api/attachments.json`, + 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!'); + } + return isLt150M; + }, + }; + // console.log("dfsf"); + // console.log(this.props); + return( +
+ +
+

+ {course_name} + > + {left_banner_name} + > + {topicId==undefined?"新建":"编辑"} +

+
+ +
+
+ + {getFieldDecorator('tea_id', { + rules: [{ + required: true, message: '请选择指导老师' + }], + })( + + )} + + + {getFieldDecorator('name', { + rules: [{ + required: true, message: '请输入选题名称', + }, { + max: 60, message: '最大限制为60个字符', + }], + })( + + )} + +
+ + + +
+ + + {getFieldDecorator('description', { + rules: [{ + required: true, message: '请输入选题简介', + }, { + max: 10000, message: '最大限制为10000个字符', + }], + })( + + )} + + + { + getFieldDecorator('file',{ + rules:[{ + required:false + }] + })( + + + (单个文件150M以内) + + ) + } + +
+ + {getFieldDecorator('topic_type', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('topic_source', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('topic_property_first', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('topic_property_second', { + rules: [{ + required: false, message: '', + }], + })( + + )} + +
+
+ + + + + +
+ + {getFieldDecorator('source_unit', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('topic_repeat', { + rules: [{ + required: false, message: '', + }], + })( + + )} + + + {getFieldDecorator('city', { + rules: [{ + initialValue: this.state.cityDefaultValue, + type: 'array', + required: false, message: '', + }], + })( + + )} + +
+ + +
+ + this.props.history.goBack()}>取消 +
+
+ +
+
+ ) + } +} + +const WrappedGraduateTopicNew = Form.create({ name: 'topicPostWorksNew' })(GraduateTopicNew); +// RouteHOC() export default (WrappedGraduateTopicNew); \ No newline at end of file diff --git a/public/react/src/modules/courses/poll/Poll.js b/public/react/src/modules/courses/poll/Poll.js index 92b69a9d1..926cd9b1d 100644 --- a/public/react/src/modules/courses/poll/Poll.js +++ b/public/react/src/modules/courses/poll/Poll.js @@ -464,7 +464,7 @@ class Poll extends Component{ modalsBottomval, loadtype }=this.state; - console.log(this.props); + // console.log(this.props); let {child}=this.props; let {coursesId,Id}=this.props.match.params const isAdmin = this.props.isAdmin() diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index 9119b7902..a1c98b07b 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -34,7 +34,7 @@ class PollDetailIndex extends Component{ } getPollInfo=()=>{ - console.log(this.props); + // console.log(this.props); let pollId=this.props.match.params.pollId; let url=`/polls/${pollId}/common_header.json` axios.get(url).then((result)=>{ diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js index b89990420..8eb2c76dd 100644 --- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js @@ -3,7 +3,7 @@ import React, { Component } from 'react'; import MonacoEditor from 'react-monaco-editor'; //MonacoDiffEditor 对比模式 -import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker} from 'antd'; +import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Icon,DatePicker,Breadcrumb} from 'antd'; // import "antd/dist/antd.css"; @@ -1256,701 +1256,706 @@ export default class TPMsettings extends Component { let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.state.status==0?true:false; return ( -
-
-
- 配置 - { - this.props.identity===1&&this.state.status==2? - this.operateshixuns(2)}> - 永久关闭 - :"" - } - { - this.props.identity < 5 && this.state.status==0? - this.operateshixuns(1)}> - 删除实训 - :"" - } - { - this.props.identity == 1 && this.state.status == 2 ? - this.operateshixuns(1)}> - 删除实训 - :"" - } - - -
- {delType===1?

是否确认删除 ?

:

关闭后,
用户不能再开始挑战了是否确认关闭 ?

} -
-
- 取消 - {delType===2?确定:确定} -
-
- -
- -
- -

实训名称

- -
- * -
-
- {settingsData === undefined ? "" : - } -
-
- 必填项 -
-
- - -
- -
-
- -
- -

简介

- -
- -
-
-
-

-

-
- -
-
-

技术平台

- - -
- * -
+ + 实训详情 + 配置 + + +
+
+ 配置 + { + this.props.identity===1&&this.state.status==2? + this.operateshixuns(2)}> + 永久关闭 + :"" + } + { + this.props.identity < 5 && this.state.status==0? + this.operateshixuns(1)}> + 删除实训 + :"" + } + { + this.props.identity == 1 && this.state.status == 2 ? + this.operateshixuns(1)}> + 删除实训 + :"" + } + + - -

- 列表中没有? - 申请新建 -

- - - - - - -
-

新建申请已提交,请等待管理员的审核

-
  • 我们将在1-2个工作日内与您联系 -
  • -
    -
    - 知道啦 -
    -
    -
    -
    - -
    - -
    -
    - 必填项 -
    - {/*

    请在配置页面完成后续的评测脚本设置操作

    */} - -
    -
    - {/*
    */} - {/*
    */} -
    -

    评测脚本

    -
    - - -
    -

    原有脚本将被新的脚本覆盖,无法撤销

    -

    是否确认执行覆盖操作

    -
    - - -
    - - -

    评测脚本生成成功!

    - -
    - - { - this.props.identity<5||this.props.power==true? - 使用自定义脚本 : "" - } -
    - this.testscripttip(0)}> -
    - -
    -

    - 使用自定义模板,平台无法自动更新脚本,
    - 请在关卡创建完后手动更新脚本中的必填参
    - 数和以下2个数组元素:
    - challengeProgramNames
    - sourceClassNames

    - 示例:有2个关卡的实训

    - 各关卡的待编译文件为:
    - src/step1/HelloWorld.java
    - src/step2/Other.java

    - 各关卡的编译后生成的执行文件为:
    - step1.HelloWorld
    - step2.Other

    - 则数组元素更新如下:
    - challengeProgramNames=("src/step1/
    - HelloWorld.java" "src/step2/Other.java")
    - sourceClassNames=("step1.HelloWorld
    - " "step2.Other")

    - 其它参数可按实际需求定制 -

    +
    + +
    + +

    实训名称

    + +
    + * +
    +
    + {settingsData === undefined ? "" : + } +
    +
    + 必填项
    -

    - this.testscripttip(1)}>知道了 -

    + +
    - -
    -
  • - - -

    执行命令不能为空

    -
  • - -
  • - - -
  • -
    -
    -
    -
    - -
    -
    - * -
    - - -
    - {/**/} - -
    - - - {/*
    */} - {/*{evaluate_script===undefined?"":evaluate_script}*/} - - {/*
    */} - - - -
    - -
    -
    -
    - - 必填项 -
    -

    -

    -
    -
    - - {/*
    */} - {/***/} - - {/*

    程序最大执行时间

    */} - - {/* 秒*/} - - {/*
    */} - {/*必填项*/} - {/*
    */} - {/*
    */} - - {/*
    - * - -

    Pod存活时间

    - - - -
    - 必填项 -
    -
    */} - - -
    -

    命令行

    - - 无命令行窗口 (选中则不给学员的实践任务提供命令窗口) - 命令行练习窗口 (选中则给学员提供用于练习操作的命令行窗口) - 命令行评测窗口 (选中则给学员提供用于关卡评测的命令行窗口) - - 多个命令行窗口(选中则允许学员同时开启多个命令行窗口) - - -
    - -
    -

    公开程度

    - - 对所有公开 (选中则所有已被试用授权的用户可以学习) - 对指定单位公开 (选中则下方指定单位的已被试用授权的用户可以学习) - - -
    -
    -
    -
    -
    - -
    - (搜索并选中添加单位名称) -
    - {/*+*/} - {/*添加*/} -
    - -
    - - {/*{*/} - {/*scope_partment===undefined?"":scope_partment.map((item,key)=>{*/} - {/*return(*/} - {/*
    */} - {/*this.deleteScopeInput(key)} style={{ color: 'rgba(0,0,0,.25)' }} />}*/} - {/*value={item}*/} - {/*/>*/} - {/*
    */} - - {/*)*/} - {/*})*/} - {/*}*/} -
    - - - 请选择需要公开的单位 - -
    -
    -
    - -
    -

    发布信息

    - -
    - * - 面向学员: - -
    - -
    - 实训难易度定位,不限定用户群体 -
    - 必填项 -
    - -
    -
    - 复制: - - - - -
    - -
    - 跳关: - - - - -
    -
    - 测试集解锁: - - - - -
    - -
    - 隐藏代码窗口: - - - - -
    - -
    - 代码目录隐藏: - - - - -
    - -
    - 禁用复制粘贴: - - - - -
    - -
    - 开启时间: - - - - -
    - - {this.props.identity<3?
    - VNC图形化: - - - - -
    :""} +
    +
    -
    - {/*"name": "我是镜像名", # 镜像名称*/} - {/*"cpu_limit": 1, # cpu核*/} - {/*"lower_cpu_limit": 0.1, # 最低cpu核 浮点数*/} - {/*"memory_limit": 1024 ,#内存限制*/} - {/*"request_limit": 10, # 内存要求*/} - {/*"mirror_repository_id": 12, # 镜像id*/} - {this.props.identity<3?
    -

    服务配置

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

    {item.name}

    -
    - -
    - this.setConfigsInputs(e,key,1)} - className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
    + +

    简介

    + +
    + +
    +
    +
    +

    +

    +
    + +
    +
    +

    技术平台

    + + +
    + * +
    + +

    + 列表中没有? + 申请新建 +

    + + + + + + +
    +

    新建申请已提交,请等待管理员的审核

    +
  • 我们将在1-2个工作日内与您联系 +
  • +
    +
    + 知道啦 +
    +
    +
    +
    + +
    + +
    +
    + 必填项 +
    + {/*

    请在配置页面完成后续的评测脚本设置操作

    */} + +
    +
    + {/*
    */} + {/*
    */} +
    +

    评测脚本

    +
    + + +
    +

    原有脚本将被新的脚本覆盖,无法撤销

    +

    是否确认执行覆盖操作

    +
    + + +
    + + +

    评测脚本生成成功!

    + +
    + + { + this.props.identity<5||this.props.power==true? + 使用自定义脚本 : "" + } +
    + this.testscripttip(0)}> +
    + +
    +

    + 使用自定义模板,平台无法自动更新脚本,
    + 请在关卡创建完后手动更新脚本中的必填参
    + 数和以下2个数组元素:
    + challengeProgramNames
    + sourceClassNames

    + 示例:有2个关卡的实训

    + 各关卡的待编译文件为:
    + src/step1/HelloWorld.java
    + src/step2/Other.java

    + 各关卡的编译后生成的执行文件为:
    + step1.HelloWorld
    + step2.Other

    + 则数组元素更新如下:
    + challengeProgramNames=("src/step1/
    + HelloWorld.java" "src/step2/Other.java")
    + sourceClassNames=("step1.HelloWorld
    + " "step2.Other")

    + 其它参数可按实际需求定制 +

    +
    +

    + this.testscripttip(1)}>知道了 +

    -
    -
    - -
    - this.setConfigsInputs(e,key,2)} - className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> + + +
    +
  • + + +

    执行命令不能为空

    +
  • + +
  • + + +
  • -
    +
    +
    +
    + +
    +
    + * +
    + + +
    + {/**/} +
    -
    - -
    - this.setConfigsInputs(e,key,3)} - className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> + + + {/*
    */} + {/*{evaluate_script===undefined?"":evaluate_script}*/} + + {/*
    */} + + + +
    + +
    +
    +
    + + 必填项 +
    +

    +

    +
    +
    + + {/*
    */} + {/***/} + + {/*

    程序最大执行时间

    */} + + {/* 秒*/} + + {/*
    */} + {/*必填项*/} + {/*
    */} + {/*
    */} + + {/*
    + * + +

    Pod存活时间

    + + + +
    + 必填项 +
    +
    */} + + +
    +

    命令行

    + + 无命令行窗口 (选中则不给学员的实践任务提供命令窗口) + 命令行练习窗口 (选中则给学员提供用于练习操作的命令行窗口) + 命令行评测窗口 (选中则给学员提供用于关卡评测的命令行窗口) + + 多个命令行窗口(选中则允许学员同时开启多个命令行窗口) + + +
    + +
    +

    公开程度

    + + 对所有公开 (选中则所有已被试用授权的用户可以学习) + 对指定单位公开 (选中则下方指定单位的已被试用授权的用户可以学习) + + +
    +
    +
    +
    +
    + +
    + (搜索并选中添加单位名称)
    -
    + {/*+*/} + {/*添加*/}
    -
    - -
    - this.setConfigsInputs(e,key,4)} - className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> + +
    + - -
    + {/*{*/} + {/*scope_partment===undefined?"":scope_partment.map((item,key)=>{*/} + {/*return(*/} + {/*
    */} + {/*this.deleteScopeInput(key)} style={{ color: 'rgba(0,0,0,.25)' }} />}*/} + {/*value={item}*/} + {/*/>*/} + {/*
    */} + + {/*)*/} + {/*})*/} + {/*}*/}
    + + + 请选择需要公开的单位 + +
    +
    +
    + +
    +

    发布信息

    + +
    + * + 面向学员: + +
    + +
    + 实训难易度定位,不限定用户群体 +
    + 必填项
    -
    - ) - - })} -
    :""} -

    - { - // this.props.identity<4&&this.props.status==0? - this.props.identity<5? -

    - 保存 - 取消 -
    :"" - } +
    +
    + 复制: + + + + +
    + +
    + 跳关: + + + + +
    +
    + 测试集解锁: + + + + +
    + +
    + 隐藏代码窗口: + + + + +
    + +
    + 代码目录隐藏: + + + + +
    + +
    + 禁用复制粘贴: + + + + +
    + +
    + 开启时间: + + + + +
    + + {this.props.identity<3?
    + VNC图形化: + + + + +
    :""} + +
    + {/*"name": "我是镜像名", # 镜像名称*/} + {/*"cpu_limit": 1, # cpu核*/} + {/*"lower_cpu_limit": 0.1, # 最低cpu核 浮点数*/} + {/*"memory_limit": 1024 ,#内存限制*/} + {/*"request_limit": 10, # 内存要求*/} + {/*"mirror_repository_id": 12, # 镜像id*/} + {this.props.identity<3?
    +

    服务配置

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

    {item.name}

    +
    + +
    + this.setConfigsInputs(e,key,1)} + className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
    +
    +
    +
    + +
    + this.setConfigsInputs(e,key,2)} + className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
    +
    +
    +
    + +
    + this.setConfigsInputs(e,key,3)} + className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
    +
    +
    +
    + +
    + this.setConfigsInputs(e,key,4)} + className="panel-box-sizing task-form-100 task-height-40" placeholder="请输入类别名称" /> +
    + +
    +
    +
    +
    + ) + + })} +
    :""} + +

    + { + // this.props.identity<4&&this.props.status==0? + this.props.identity<5? +

    + 保存 + 取消 +
    :"" + } -

    +

    -
    +
    ); } } diff --git a/public/react/src/modules/tpm/component/TPMNav.js b/public/react/src/modules/tpm/component/TPMNav.js index 7bcc858e2..1683c59a0 100644 --- a/public/react/src/modules/tpm/component/TPMNav.js +++ b/public/react/src/modules/tpm/component/TPMNav.js @@ -42,7 +42,7 @@ class TPMNav extends Component { className={`${match.url.indexOf('ranking_list') != -1 ? 'active' : ''} fl`}>排行榜 {/* target="_blank"*/} 4||this.props.identity===undefined ? "none" : 'block'}} >配置
    diff --git a/public/react/src/modules/user/account/AccountNav.js b/public/react/src/modules/user/account/AccountNav.js index b0038e43b..e14921d34 100644 --- a/public/react/src/modules/user/account/AccountNav.js +++ b/public/react/src/modules/user/account/AccountNav.js @@ -14,7 +14,7 @@ class AccountNav extends Component { } render() { let { basicInfo } = this.props - console.log(this.props); + // console.log(this.props); const path = window.location.pathname const isBasic = path.indexOf('profile') != -1 || path == "/account" const isCertification = path.indexOf('certification') != -1 From cf10b2cbc7125bbf5b97e791976fdccf8934f313 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 27 Jul 2019 11:21:36 +0800 Subject: [PATCH 12/33] visible --- .../react/src/modules/courses/common/ModalWrapper.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/react/src/modules/courses/common/ModalWrapper.js b/public/react/src/modules/courses/common/ModalWrapper.js index b998061eb..9fff8d928 100644 --- a/public/react/src/modules/courses/common/ModalWrapper.js +++ b/public/react/src/modules/courses/common/ModalWrapper.js @@ -36,6 +36,17 @@ class ModalWrapper extends Component{ className={className || ''} keyboard={false} > + { + visible == true ? :"" + }
    {this.props.children} {this.props.checkBoxValuestype===true?
    From 6ffa26bc3ac5a02211c25bc5e0268952ddf67632 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Sat, 27 Jul 2019 11:30:41 +0800 Subject: [PATCH 13/33] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=9A=84=E5=A4=9A?= =?UTF-8?q?=E9=80=89=E6=8F=90=E4=BA=A4=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_votes_controller.rb | 8 ------ app/controllers/polls_controller.rb | 32 ++++++++++++++++++------ 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/app/controllers/poll_votes_controller.rb b/app/controllers/poll_votes_controller.rb index b376b870f..b1191d8ea 100644 --- a/app/controllers/poll_votes_controller.rb +++ b/app/controllers/poll_votes_controller.rb @@ -147,17 +147,9 @@ class PollVotesController < ApplicationController else question_max_choices = 0 end - if @poll_question.min_choices.present? - question_min_choices = @poll_question.min_choices - else - question_min_choices = 0 - end if question_max_choices > 0 && (user_vote_count > question_max_choices) normal_status(-1,"多选题答案超过最大限制!") end - if question_min_choices > 0 && (user_vote_count < question_min_choices) - normal_status(-1,"多选题答题不得少于最小限制!") - end elsif (poll_user.present? && poll_user.commit_status == 1) || poll_user_status == 3 normal_status(-1,"已提交/已结束的问卷不允许修改!") end diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index f5003a0c7..a89544669 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -896,13 +896,31 @@ class PollsController < ApplicationController def commit_poll ActiveRecord::Base.transaction do begin - poll_user_current = @poll.poll_users.find_by_group_ids(current_user.id).first - poll_user_params = { - :commit_status => 1, - :end_at => Time.now - } - poll_user_current.update_attributes(poll_user_params) - normal_status(0, "问卷提交成功!") + @poll_multi_questions = @poll.poll_questions.where(question_type:2).select(:id,:max_choices,:min_choices,:question_number) + error_question = [] + @poll_multi_questions.each do |q| + poll_user_votes = current_user.poll_votes.where(question_id:q.id)&.size + if q.max_choices.present? && (poll_user_votes > q.max_choices) + error_messages = "第#{q.question_number}题:超过最大选项限制" + elsif q.min_choices.present? && (poll_user_votes < q.min_choices) + error_messages = "第#{q.question_number}题:不得少于最小选项限制" + else + error_messages = nil + end + error_question.push(error_messages) + end + error_question = error_question.reject(&:blank?) + if error_question.reject(&:blank?).length > 0 + normal_status(-1, "#{error_question.join("\n")}") + else + poll_user_current = @poll.poll_users.find_by_group_ids(current_user.id).first + poll_user_params = { + :commit_status => 1, + :end_at => Time.now + } + poll_user_current.update_attributes(poll_user_params) + normal_status(0, "问卷提交成功!") + end ## 需添加发送消息的接口,稍后添加 rescue Exception => e uid_logger_error(e.message) From fdea2203a46ffc8be595108cfcae6a3b5dd0ec79 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 27 Jul 2019 11:30:57 +0800 Subject: [PATCH 14/33] answer_percent --- public/react/src/modules/courses/poll/PollDetailTabSecond.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollDetailTabSecond.js b/public/react/src/modules/courses/poll/PollDetailTabSecond.js index a6a2b6b62..45b3c1583 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabSecond.js +++ b/public/react/src/modules/courses/poll/PollDetailTabSecond.js @@ -127,9 +127,9 @@ class PollDetailTabSecond extends Component{ {options.answer_users_count}

    - +

    - {parseFloat(options.answer_percent ? options.answer_percent : 0 ).toFixed(2)*100} % + {options.answer_percent * 100}%
    { From 0a6e9189a23ad0e8e55192e34dfb26f9dcfabb00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 27 Jul 2019 11:32:17 +0800 Subject: [PATCH 15/33] =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/new/CoursesNew.js | 5 +++++ public/react/src/modules/user/account/AccountBasicEdit.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index 0114f564c..888f4c9e6 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -459,6 +459,11 @@ class CoursesNew extends Component { width: 280px; margin-left: 10px; } + + .construction .ant-select-selection__placeholder, .ant-select-search__field__placeholder { + line-height: 28px; + z-index: 2000; + } `} diff --git a/public/react/src/modules/user/account/AccountBasicEdit.js b/public/react/src/modules/user/account/AccountBasicEdit.js index a4637c00e..44baf7778 100644 --- a/public/react/src/modules/user/account/AccountBasicEdit.js +++ b/public/react/src/modules/user/account/AccountBasicEdit.js @@ -668,7 +668,7 @@ class AccountBasic extends Component { }], })( - + { filterSchoolList && filterSchoolList.map((item,key)=>{ return() From 4d14499b6edbf7b1ab48120ad6709fec9915b831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 27 Jul 2019 11:32:54 +0800 Subject: [PATCH 16/33] =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/user/account/AccountBasicEdit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/user/account/AccountBasicEdit.js b/public/react/src/modules/user/account/AccountBasicEdit.js index 44baf7778..a4637c00e 100644 --- a/public/react/src/modules/user/account/AccountBasicEdit.js +++ b/public/react/src/modules/user/account/AccountBasicEdit.js @@ -668,7 +668,7 @@ class AccountBasic extends Component { }], })( - + { filterSchoolList && filterSchoolList.map((item,key)=>{ return() From 969ae735d0a53f31ce16d3fae72871bf5a866e3f Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 27 Jul 2019 11:33:47 +0800 Subject: [PATCH 17/33] current_user --- public/react/src/modules/courses/poll/PollDetailIndex.js | 2 +- public/react/src/modules/courses/poll/PollNew.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index 9119b7902..6106e5ea2 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -123,7 +123,7 @@ class PollDetailIndex extends Component{ />

    - {this.props.coursedata.name} + {this.props.coursedata.name} > 问卷 > diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 705b1658c..be904afe7 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -2322,7 +2322,7 @@ class PollNew extends Component { gotohome=()=>{ const { current_user} = this.props - this.props.history.push(current_user.first_category_url); + this.props.history.push(current_user && current_user.first_category_url); // let courseId=this.props.match.params.coursesId; From 8ea7e46fb57978ffd311e67240b51550d8771dbe Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 27 Jul 2019 11:35:00 +0800 Subject: [PATCH 18/33] current_user --- public/react/src/modules/courses/poll/PollInfo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/poll/PollInfo.js b/public/react/src/modules/courses/poll/PollInfo.js index f32d652c2..22c1f542e 100644 --- a/public/react/src/modules/courses/poll/PollInfo.js +++ b/public/react/src/modules/courses/poll/PollInfo.js @@ -315,7 +315,7 @@ class PollInfo extends Component{ >

    - {courseName} + {courseName} > 问卷 > From f2acf4b2c7e12e2491770542a64c0aa157d3aed3 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Sat, 27 Jul 2019 11:40:52 +0800 Subject: [PATCH 19/33] fixbug --- app/controllers/polls_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index a89544669..5aecaadb0 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -899,7 +899,7 @@ class PollsController < ApplicationController @poll_multi_questions = @poll.poll_questions.where(question_type:2).select(:id,:max_choices,:min_choices,:question_number) error_question = [] @poll_multi_questions.each do |q| - poll_user_votes = current_user.poll_votes.where(question_id:q.id)&.size + poll_user_votes = current_user.poll_votes.where(poll_question_id:q.id)&.size if q.max_choices.present? && (poll_user_votes > q.max_choices) error_messages = "第#{q.question_number}题:超过最大选项限制" elsif q.min_choices.present? && (poll_user_votes < q.min_choices) From 8d89ef8a003d3ea51b7c497c60e2d50941ece666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 27 Jul 2019 11:40:53 +0800 Subject: [PATCH 20/33] =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/new/CoursesNew.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index 888f4c9e6..b817136ed 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -646,7 +646,7 @@ class CoursesNew extends Component {

    -
    +
    {getFieldDecorator('school', { rules: [{required: true, message: "不能为空"}], From acfde4ae2f50741b4d1d16180bcfc0aa52d49ee8 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Sat, 27 Jul 2019 11:43:43 +0800 Subject: [PATCH 21/33] toFixed(1) --- public/react/src/modules/courses/poll/PollDetailTabSecond.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollDetailTabSecond.js b/public/react/src/modules/courses/poll/PollDetailTabSecond.js index 45b3c1583..b3a1e829c 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabSecond.js +++ b/public/react/src/modules/courses/poll/PollDetailTabSecond.js @@ -127,9 +127,9 @@ class PollDetailTabSecond extends Component{ {options.answer_users_count}

    - +

    - {options.answer_percent * 100}% + {(options.answer_percent * 100).toFixed(1)}%
    { From 0ad641843d5b0792c2fb7b47986e1418c8f810a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 27 Jul 2019 11:55:59 +0800 Subject: [PATCH 22/33] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/poll/PollNew.js | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 705b1658c..82d06a991 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -844,12 +844,12 @@ class PollNew extends Component { if (object.question.question_type === 2) { if (object.question.max_choices > 0) { - if (object.question.min_choices < 2) { - this.props.showNotification(`可选最小不能少于2个`); - - return; - - } + // if (object.question.min_choices < 2) { + // this.props.showNotification(`可选最小不能少于2个`); + // + // return; + // + // } } } @@ -1332,10 +1332,10 @@ class PollNew extends Component { if (object.question.question_type === 2) { if (object.question.max_choices > 0) { - if (object.question.min_choices < 2) { - this.props.showNotification(`可选最小不能少于2个`); - return; - } + // if (object.question.min_choices < 2) { + // this.props.showNotification(`可选最小不能少于2个`); + // return; + // } } } if (object.question.new === "new") { @@ -2108,14 +2108,17 @@ class PollNew extends Component { } //最大值 - HandleGradationGroupChangeee = (value, index) => { - + HandleGradationGroupChangeee = (value, index,minchoices) => { + // console.log(value); let arr = this.state.adddom; for (var i = 0; i < arr.length; i++) { if (index === i) { + arr[i].question.min_choices= minchoices===null?0:minchoices===undefined?0:parseInt(minchoices); arr[i].question.max_choices = parseInt(value); } } + // console.log(2119); + // console.log(arr); this.setState({ adddom: arr }) @@ -2772,7 +2775,7 @@ class PollNew extends Component { className="ml10 mr10 color-grey-6 lineh-40 fl">~ {/*可选最大*/} this.HandleGradationGroupChangeee(value, indexo)} + onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)} value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} > @@ -3267,7 +3270,7 @@ class PollNew extends Component { className="ml10 mr10 color-grey-6 lineh-40 fl">~ {/*可选最大*/}