diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index af0158cfd..f01ad4b6b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -442,12 +442,18 @@ class ApplicationController < ActionController::Base shixun.shixun_service_configs.each do |config| mirror = config.mirror_repository if mirror.name.present? + # 资源限制没有就传默认值。 + cpu_limit = config.cpu_limit.presence || 1 + cpu_request = config.lower_cpu_limit.presence || 0.1 + memory_limit = config.memory_limit.presence || 1024 + request_limit = config.resource_limit.presence || 10 + resource_limit = config.resource_limit.presence || 10000 container << {:image => mirror.name, - :cpuLimit => config.cpu_limit, - :cpuRequest => config.lower_cpu_limit, - :memoryLimit => "#{config.memory_limit}M", - :memoryRequest => "#{config.request_limit}M", - :resourceLimit => "#{config.resource_limit}K", + :cpuLimit => cpu_limit, + :cpuRequest => cpu_request, + :memoryLimit => "#{memory_limit}M", + :memoryRequest => "#{request_limit}M", + :resourceLimit => "#{resource_limit}K", :type => mirror.try(:main_type) == "1" ? "main" : "sub"} end end diff --git a/app/controllers/edu_settings_controller.rb b/app/controllers/edu_settings_controller.rb index 0d80cbf3d..6baf38e5b 100644 --- a/app/controllers/edu_settings_controller.rb +++ b/app/controllers/edu_settings_controller.rb @@ -1,5 +1,5 @@ class EduSettingsController < ApplicationController - # before_action :require_admin + before_action :require_admin before_action :set_edu_setting, only: [:show, :edit, :update, :destroy] # GET /edu_settings 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..5aecaadb0 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(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) + 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) diff --git a/public/react/src/modules/courses/busyWork/NewWork.js b/public/react/src/modules/courses/busyWork/NewWork.js index 2519f95e2..164b3f61e 100644 --- a/public/react/src/modules/courses/busyWork/NewWork.js +++ b/public/react/src/modules/courses/busyWork/NewWork.js @@ -370,7 +370,7 @@ class NewWork extends Component{ {pageType==="new"?"新建":"编辑"}

*/}
{/* onSubmit={this.handleSubmit} */} -
+ + { + visible == true ? :"" + }
{this.props.children} {this.props.checkBoxValuestype===true?
diff --git a/public/react/src/modules/courses/exercise/question/shixunAnswer.js b/public/react/src/modules/courses/exercise/question/shixunAnswer.js index 5897ebd79..f1fb09227 100644 --- a/public/react/src/modules/courses/exercise/question/shixunAnswer.js +++ b/public/react/src/modules/courses/exercise/question/shixunAnswer.js @@ -135,8 +135,8 @@ class shixunAnswer extends Component{ let url=`/exercise_questions/${this.props.questionType.question_id}/adjust_score.json` const list = Object.assign({}, this.state.dataCopy[key]) - console.log("111111111111111111111111"); - console.log(this.props); + // console.log("111111111111111111111111"); + // console.log(this.props); // 调分值为0,且和第一次的数据相同则不修改 if(parseInt(e.target.value)==parseInt(list.my_score)){ return; diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js index 569c76331..43a0e31f5 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js @@ -1,614 +1,614 @@ -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?"新建":"编辑"} -

-
-

{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/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index 0114f564c..b817136ed 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; + } `} @@ -641,7 +646,7 @@ class CoursesNew extends Component {
-
+
{getFieldDecorator('school', { rules: [{required: true, message: "不能为空"}], 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..b1e8c3443 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)=>{ @@ -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/PollDetailTabSecond.js b/public/react/src/modules/courses/poll/PollDetailTabSecond.js index 5ddf673c6..cebae4153 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).toFixed(1)}% { diff --git a/public/react/src/modules/courses/poll/PollInfo.js b/public/react/src/modules/courses/poll/PollInfo.js index d5b5af2e1..5d3bd36c3 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} > 问卷 > diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 705b1658c..edafd9e5b 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 }) @@ -2322,7 +2325,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; @@ -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">~ {/*可选最大*/} } -

-
- 必填项 -
-
- - -
- -
-
- -
- -

简介

- -
- -
-
-
-

-

-
- -
-
-

技术平台

- - -
- * -
+ + 实训详情 + 配置 + + +
+
+ 配置 + { + 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