From 91fd4fc40123122c6d2fe3149a61a32404b58c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 24 Jul 2019 15:56:29 +0800 Subject: [PATCH 1/7] =?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/Interestpage.js | 4 ++-- .../react/src/modules/user/InterestpageMax.js | 20 ++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/user/Interestpage.js b/public/react/src/modules/user/Interestpage.js index 4642707b2..2e1cdcca2 100644 --- a/public/react/src/modules/user/Interestpage.js +++ b/public/react/src/modules/user/Interestpage.js @@ -166,7 +166,7 @@ class InterestpageComponent extends Component { //兴趣页面点击 Interestcompletionpage(){ if(this.state.gouxuans.length === 0){ - this.openNotification("请选择您的职业"); + this.openNotification("请选择职业"); return } @@ -177,7 +177,7 @@ class InterestpageComponent extends Component { } } if(ints.length<1){ - this.openNotification("内容是最少得选一个"); + this.openNotification("请至少选择一个您感兴趣的内容"); return } var url = "/users/interest.json"; diff --git a/public/react/src/modules/user/InterestpageMax.js b/public/react/src/modules/user/InterestpageMax.js index fb3f1544c..22e53c968 100644 --- a/public/react/src/modules/user/InterestpageMax.js +++ b/public/react/src/modules/user/InterestpageMax.js @@ -71,7 +71,21 @@ class InterestpageMax extends Component { }if(response.data.repertoires[i].id===9){ qdkfys=rgzn; } - var datas={id:response.data.repertoires[i].id,name:response.data.repertoires[i].name,bool:false,url:qdkfys}; + if(response.data.repertoires[i].id===1) { + var datas = { + id: response.data.repertoires[i].id, + name: response.data.repertoires[i].name, + bool: true, + url: qdkfys + }; + } else{ + var datas = { + id: response.data.repertoires[i].id, + name: response.data.repertoires[i].name, + bool: false, + url: qdkfys + }; + } gouxuans4.push(datas); this.setState({ gouxuans4:gouxuans4, @@ -171,7 +185,7 @@ class InterestpageMax extends Component { setpagecomplet:true }) if(this.state.gouxuans.length === 0){ - this.openNotification("请选择您的职业"); + this.openNotification("请选择职业"); return } @@ -182,7 +196,7 @@ class InterestpageMax extends Component { } } if(ints.length<1){ - this.openNotification("内容是最少得选一个"); + this.openNotification("请至少选择一个您感兴趣的内容"); return } var url = "/users/interest.json"; From a44dbc2aea85ac0120e1fe62188ade5ae0c7b36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 24 Jul 2019 15:57:35 +0800 Subject: [PATCH 2/7] =?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/Interestpage.js | 18 +++++++++++++++++- .../react/src/modules/user/InterestpageMax.js | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/user/Interestpage.js b/public/react/src/modules/user/Interestpage.js index 2e1cdcca2..dbca5a242 100644 --- a/public/react/src/modules/user/Interestpage.js +++ b/public/react/src/modules/user/Interestpage.js @@ -71,7 +71,23 @@ class InterestpageComponent extends Component { }if(response.data.repertoires[i].id===9){ qdkfys=rgzn; } - var datas={id:response.data.repertoires[i].id,name:response.data.repertoires[i].name,bool:false,url:qdkfys}; + + if(response.data.repertoires[i].id===1) { + var datas = { + id: response.data.repertoires[i].id, + name: response.data.repertoires[i].name, + bool: true, + url: qdkfys + }; + } else{ + var datas = { + id: response.data.repertoires[i].id, + name: response.data.repertoires[i].name, + bool: false, + url: qdkfys + }; + } + gouxuans4.push(datas); this.setState({ gouxuans4:gouxuans4, diff --git a/public/react/src/modules/user/InterestpageMax.js b/public/react/src/modules/user/InterestpageMax.js index 22e53c968..e0585ed33 100644 --- a/public/react/src/modules/user/InterestpageMax.js +++ b/public/react/src/modules/user/InterestpageMax.js @@ -71,6 +71,7 @@ class InterestpageMax extends Component { }if(response.data.repertoires[i].id===9){ qdkfys=rgzn; } + if(response.data.repertoires[i].id===1) { var datas = { id: response.data.repertoires[i].id, @@ -86,6 +87,7 @@ class InterestpageMax extends Component { url: qdkfys }; } + gouxuans4.push(datas); this.setState({ gouxuans4:gouxuans4, From 5914d83323bd29d8489ea632c4d133176106e6c8 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 24 Jul 2019 16:05:43 +0800 Subject: [PATCH 3/7] fix bind phone api --- app/controllers/users/interests_controller.rb | 6 ++++-- app/services/users/bind_phone_service.rb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/users/interests_controller.rb b/app/controllers/users/interests_controller.rb index 3f931612d..93f2345f1 100644 --- a/app/controllers/users/interests_controller.rb +++ b/app/controllers/users/interests_controller.rb @@ -9,13 +9,15 @@ class Users::InterestsController < Users::BaseController extension = current_user.user_extension || current_user.build_user_extension return render_error('请选择职业') unless %w(teacher student professional).include?(identity) + interest_ids = Array.wrap(params[:interest_ids]).map(&:to_i) + return render_error('请选择兴趣') if interest_ids.blank? + ActiveRecord::Base.transaction do extension.update_column(:identity, identity) # 兴趣 - current_user.user_interests.delete_all UserInterest.bulk_insert(:user_id, :repertoire_id) do |worker| - (Repertoire.pluck(:id) & Array.wrap(params[:interest_ids]).map(&:to_i)).each do |repertoire_id| + (Repertoire.pluck(:id) & interest_ids).each do |repertoire_id| worker.add(user_id: current_user.id, repertoire_id: repertoire_id) end end diff --git a/app/services/users/bind_phone_service.rb b/app/services/users/bind_phone_service.rb index 0ea39ae9b..af4292230 100644 --- a/app/services/users/bind_phone_service.rb +++ b/app/services/users/bind_phone_service.rb @@ -13,7 +13,7 @@ class Users::BindPhoneService < ApplicationService raise Error, '该手机号已被绑定' if User.where.not(id: user.id).exists?(phone: params[:phone]) - code = VerificationCode.where(phone: params[:phone], code: params[:code], code_type: 5).last + code = VerificationCode.where(phone: params[:phone], code: params[:code], code_type: 4).last raise Error, '验证码无效' unless code&.effective? ActiveRecord::Base.transaction do From a532653add259a460d525f6e5e4791eae7e22310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 24 Jul 2019 16:39:34 +0800 Subject: [PATCH 4/7] =?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/common.css | 2 +- public/react/src/modules/user/commontwo.css | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/user/common.css b/public/react/src/modules/user/common.css index b80677ee5..d23412d07 100644 --- a/public/react/src/modules/user/common.css +++ b/public/react/src/modules/user/common.css @@ -70,7 +70,7 @@ margin-right: 129px; } .ysldivhome2{ - width: 100%; + width: 800px; display: flex; flex-flow: row wrap; align-content:stretch; diff --git a/public/react/src/modules/user/commontwo.css b/public/react/src/modules/user/commontwo.css index 718139f36..d25b888c8 100644 --- a/public/react/src/modules/user/commontwo.css +++ b/public/react/src/modules/user/commontwo.css @@ -71,6 +71,7 @@ margin-top: 10px; } .ysldivhome22{ + width: 800px; display: flex; flex-flow: row wrap; align-content:stretch; From 022a2b57e3337e55f1dd6689d61f081541a560b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 24 Jul 2019 16:40:42 +0800 Subject: [PATCH 5/7] =?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/tpm/TPMIndex.css | 2 +- .../modules/tpm/challengesnew/TPMevaluation.js | 17 +++++++++++------ .../tpm/challengesnew/TpmQuestionMain.js | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndex.css b/public/react/src/modules/tpm/TPMIndex.css index c8a48440c..529c7df58 100644 --- a/public/react/src/modules/tpm/TPMIndex.css +++ b/public/react/src/modules/tpm/TPMIndex.css @@ -136,7 +136,7 @@ body>.-task-title { margin-right: 20px; } .HeaderSearch .ant-input-search .ant-input{ - height:30px; + /*height:30px;*/ background: #373e3f !important; border: 1px solid #373e3f !important; diff --git a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js index 01b99b4c2..b334d33e8 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js +++ b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js @@ -189,10 +189,14 @@ export default class TPMevaluation extends Component { } let newevaluationlist=[] if(response.data.test_sets.length===0){ - let newlist=[ - {hidden:0,input:"",output:"",score:50}, - {hidden:1,input:"",output:"",score:50} - ] + // let newlist=[ + // {hidden:0,input:"",output:"",score:50}, + // {hidden:1,input:"",output:"",score:50} + // ] + let newlist=[ + {input:"",output:"",score:50}, + {input:"",output:"",score:50} + ] newevaluationlist=newlist }else{ newevaluationlist=response.data.test_sets @@ -243,7 +247,8 @@ export default class TPMevaluation extends Component { addevaluationon=()=>{ let {evaluationlist,markvalue}=this.state; let newevaluationlist=evaluationlist; - newevaluationlist.push({hidden:0,input:"",output:"",score:0}); + // newevaluationlist.push({hidden:0,input:"",output:"",score:0}); + newevaluationlist.push({input:"",output:"",score:0}); newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue); this.setevaluationlist(newevaluationlist); } @@ -1076,7 +1081,7 @@ export default class TPMevaluation extends Component { >% - this.evaluationonChange(item.hidden,key)} checked={item.hidden===1?true:false}>隐藏 + {/*this.evaluationonChange(item.hidden,key)} checked={item.hidden===1?true:false}>隐藏*/} diff --git a/public/react/src/modules/tpm/challengesnew/TpmQuestionMain.js b/public/react/src/modules/tpm/challengesnew/TpmQuestionMain.js index 2de04f56a..614842ab8 100644 --- a/public/react/src/modules/tpm/challengesnew/TpmQuestionMain.js +++ b/public/react/src/modules/tpm/challengesnew/TpmQuestionMain.js @@ -51,7 +51,7 @@ export default class TpmQuestionMain extends Component { *
+ watch={true} className="courseMessageMD" initValue={this.props.contentMdRefval} height={700}>
Date: Wed, 24 Jul 2019 17:02:07 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 28f35b94a..cc1fc167e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -233,16 +233,6 @@ class ApplicationController < ActionController::Base end # User.current = User.find 81403 - - if params[:debug] == 'teacher' #todo 为了测试,记得讲debug删除 - User.current = User.find 81403 - elsif params[:debug] == 'student' - User.current = User.find 8686 - elsif params[:debug] == 'admin' - User.current = User.find 1 - elsif params[:debug] - User.current = User.find_by_login params[:debug] - end end # Sets the logged in user From 9d421e4c4f1d29acae9560f0840835883de27e26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 24 Jul 2019 17:34:32 +0800 Subject: [PATCH 7/7] =?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/public/css/edu-all.css | 4 +- .../src/modules/courses/new/CoursesNew.js | 143 +- public/react/src/modules/login/LoginDialog.js | 3 +- .../tpm/challengesnew/TPMevaluation.js | 2129 ++++++++--------- public/stylesheets/educoder/edu-all.css | 4 +- 5 files changed, 1168 insertions(+), 1115 deletions(-) diff --git a/public/react/public/css/edu-all.css b/public/react/public/css/edu-all.css index 216e11266..ed44e1f90 100644 --- a/public/react/public/css/edu-all.css +++ b/public/react/public/css/edu-all.css @@ -171,7 +171,9 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px} #log_reg_content{border-radius: 5px;background: #FFFFff;width: 100%;text-align: center;position: absolute;top: 165px; left: 0px;padding: 40px 30px;box-sizing: border-box} .log_nav{border-bottom:1px solid #eaeaea;} -.log_nav li{float: left;text-align: center;font-size: 16px;padding-bottom:15px;margin: 0px 20px;cursor: pointer;} +.log_nav li{float: left;text-align: center;font-size: 16px;padding-bottom:15px; + /*margin: 0px 20px;*/ + cursor: pointer;} .log_nav li.active{border-bottom: 2px solid #459be5;} .log-botton{width: 100%;text-align: center;color: #FFFFff!important;display: block;background: #cbcbcb;height: 45px;line-height: 45px;border-radius: 4px;letter-spacing: 2px;cursor: pointer} .log-botton:hover{color: #FFFFff!important;} diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index e819111c5..149f9bc27 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -1,5 +1,6 @@ import React, {Component} from "React"; import {Form, Select, Input, Button, Checkbox, DatePicker,Spin,Icon} from "antd"; +import ApplyForAddOrgModal from '../../user/modal/ApplyForAddOrgModal'; import axios from 'axios'; import "../css/Courses.css"; import locale from 'antd/lib/date-picker/locale/zh_CN'; @@ -7,6 +8,7 @@ import moment from 'moment'; import Modals from '../../modals/Modals'; + const { Option } = Select; @@ -284,12 +286,13 @@ class CoursesNew extends Component { // console.log(e.target.checked); } Searchvalue=(value)=>{ + let url="/courses/search_course_list.json"; axios.post(url,{ search:value }).then((result)=>{ // console.log(result.data) - if (result.data.message===undefined) { + if (result.data.status===0) { this.setState({ searchlist: result.data.course_lists, // course:value, @@ -304,14 +307,19 @@ class CoursesNew extends Component { }) } handleSearch=(value)=>{ - this.props.form.setFieldsValue({ - classroom:value, - course:value - }); - this.Searchvalue(value) + + if(value!=""){ + this.props.form.setFieldsValue({ + classroom:value, + course:value + }); + this.Searchvalue(value) + } + }; handleChange=(value)=>{ + this.props.form.setFieldsValue({ course:value, classroom:value @@ -320,13 +328,24 @@ class CoursesNew extends Component { handleSearchschool=(value)=>{ - this.props.form.setFieldsValue({ - school:value, - fetching:true, - }); - this.Searchvalue(value) + if(value!="") { + this.props.form.setFieldsValue({ + school: value, + fetching: true, + }); + + this.getschool(value) + } }; + handleChangeschools=(value)=>{ + + this.props.form.setFieldsValue({ + school: value, + fetching: true, + }); + } + handleChangeschool=(value)=>{ this.setState({ @@ -338,35 +357,56 @@ class CoursesNew extends Component { }; getschool=(value)=>{ + let url="/schools/school_list.json"; axios.get(url,{ params: { search: value } }).then((result)=>{ - if (result.data.message===undefined) { + if (result.data.status===0) { this.setState({ searchlistscholl: result.data.school_names, - scholl: value + school: value }) this.props.form.setFieldsValue({ - scholl: value + school: value }) } }).catch((error)=>{ console.log(error) }) } + showApplyForAddOrgModal = () => { + this.applyForAddOrgForm.setVisible(true) + } render() { - let {datatime} = this.state; + let {datatime,school,searchlistscholl} = this.state; const {getFieldDecorator} = this.props.form; + const propsWithoutForm = Object.assign({}, this.props) + delete propsWithoutForm.form const options = this.state.searchlist && this.state.searchlist.map(d => ); - const optionschool = this.state.searchlistscholl.map(z => ); + const optionschool = this.state.searchlistscholl&&this.state.searchlistscholl.map(z => ); // console.log(this.props.current_user.user_school) + // form合并了 + // console.log(optionschool) return (
+ + this.applyForAddOrgForm = form} schoolName={school} + {...propsWithoutForm}> {/*提示*/} -
- - {getFieldDecorator('school', { - rules: [{required: true, message: "不能为空"}], - })( - - )} - - {/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/} - -
-
-
+ {/*
*/} + + {/*
*/}
@@ -455,7 +473,6 @@ class CoursesNew extends Component { > {options} - )} {/*(错误示例:数据结构2017本部;数据结构2017秋季;数据结构2017电子商务1班)*/} @@ -605,7 +622,7 @@ class CoursesNew extends Component {
-
+
(选中后本课堂对所有用户可见,否则仅本课堂成员可见)
+ +
+ + {getFieldDecorator('school', { + rules: [{required: true, message: "不能为空"}], + })( + + )} + + {/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/} + +
+
+ + {searchlistscholl.length===0?
+ + 未找到包含“{school}”的高校, + 申请新增 + +
:""} + +
+ + +
- -
+ +
diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js index 395f2d9ba..d3df6090e 100644 --- a/public/react/src/modules/login/LoginDialog.js +++ b/public/react/src/modules/login/LoginDialog.js @@ -411,6 +411,7 @@ class LoginDialog extends Component { this.handleDialogClose()} > {isRender===true? @@ -477,7 +478,7 @@ class LoginDialog extends Component { 登录
-

+

", - testIcon1: "
" - }, - //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 - saveHTMLToTextarea: true, - // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 - dialogMaskOpacity: 0.6, - placeholder: placeholder, - imageUpload: true, - imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], - imageUploadURL: imageUrl,//url - onload: function () { - // this.previewing(); - $("#" + id + " [type=\"latex\"]").bind("click", function () { - editorName.cm.replaceSelection("```latex"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("```"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line - 1, 0); - }); - - $("#" + id + " [type=\"inline\"]").bind("click", function () { - editorName.cm.replaceSelection("$$$$"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); - editorName.cm.focus(); - }); - $("[type=\"inline\"]").attr("title", "行内公式"); - $("[type=\"latex\"]").attr("title", "多行公式"); - - window.md_elocalStorage(editorName, `exercise__${id}`, "Memochallengesnew"); - - callback && callback() - } - }); - return editorName; + var editorName = window.editormd(id, { + width: width, + height: high, + path: path, // "/editormd/lib/" + + syncScrolling: "single", + tex: true, + tocm: true, + emoji: true, + taskList: true, + codeFold: true, + searchReplace: true, + htmlDecode: "style,script,iframe", + sequenceDiagram: true, + autoFocus: false, + toolbarIcons: function () { + // Or return editormd.toolbarModes[name]; // full, simple, mini + // Using "||" set icons align right. + return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"] + }, + toolbarCustomIcons: { + testIcon: "
", + testIcon1: "
" + }, + //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 + saveHTMLToTextarea: true, + // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 + dialogMaskOpacity: 0.6, + placeholder: placeholder, + imageUpload: true, + imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], + imageUploadURL: imageUrl,//url + onload: function () { + // this.previewing(); + $("#" + id + " [type=\"latex\"]").bind("click", function () { + editorName.cm.replaceSelection("```latex"); + editorName.cm.replaceSelection("\n"); + editorName.cm.replaceSelection("\n"); + editorName.cm.replaceSelection("```"); + var __Cursor = editorName.cm.getDoc().getCursor(); + editorName.cm.setCursor(__Cursor.line - 1, 0); + }); + + $("#" + id + " [type=\"inline\"]").bind("click", function () { + editorName.cm.replaceSelection("$$$$"); + var __Cursor = editorName.cm.getDoc().getCursor(); + editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); + editorName.cm.focus(); + }); + $("[type=\"inline\"]").attr("title", "行内公式"); + $("[type=\"latex\"]").attr("title", "多行公式"); + + window.md_elocalStorage(editorName, `exercise__${id}`, "Memochallengesnew"); + + callback && callback() + } + }); + return editorName; } export default class TPMevaluation extends Component { - constructor(props) { - super(props) - this.state = { - choice_url: undefined, - practice_url: undefined, - go_back_url: undefined, - task_pass_default: undefined, - submit_url: undefined, - value: 1, - evaluationlist:[], - shixunId:undefined, - power:false, - shixunfilepath:undefined, - evaluationvisible:false, - trees:undefined, - path:"", - main:[], - saveshixunfilepath:undefined, - selectpath:undefined, - shixunfilepathplay:undefined, - shixunfileexpectpicturepath:undefined, - shixunfilestandardpicturepath:undefined, - shixunfilepicturepath:undefined, - pathoptionvalue:-1, - showrepositoryurltiptype: false, - prev_challenge: undefined, - next_challenge: undefined, - StudentTaskPapers:false, - StudentTaskDocs:false, - selectpatharr:[], - handpathopt:false, - scorevalue:false, - markvalue:true, - scoretype:undefined - } - } - - - exerciseMD(initValue, id) { - - this.contentChanged = false; - const placeholder = ""; + constructor(props) { + super(props) + this.state = { + choice_url: undefined, + practice_url: undefined, + go_back_url: undefined, + task_pass_default: undefined, + submit_url: undefined, + value: 1, + evaluationlist:[], + shixunId:undefined, + power:false, + shixunfilepath:undefined, + evaluationvisible:false, + trees:undefined, + path:"", + main:[], + saveshixunfilepath:undefined, + selectpath:undefined, + shixunfilepathplay:undefined, + shixunfileexpectpicturepath:undefined, + shixunfilestandardpicturepath:undefined, + shixunfilepicturepath:undefined, + pathoptionvalue:-1, + showrepositoryurltiptype: false, + prev_challenge: undefined, + next_challenge: undefined, + StudentTaskPapers:false, + StudentTaskDocs:false, + selectpatharr:[], + handpathopt:false, + scorevalue:false, + markvalue:true, + scoretype:undefined + } + } + + + exerciseMD(initValue, id) { + + this.contentChanged = false; + const placeholder = ""; // amp; // 编辑时要传memoId - const imageUrl = `/api/attachments.json`; + const imageUrl = `/api/attachments.json`; // 创建editorMd - const exercise_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => { - setTimeout(() => { - exercise_editormd.resize() - exercise_editormd.cm && exercise_editormd.cm.refresh() - }, 500) - - if (initValue != undefined) { - exercise_editormd.setValue(initValue) - } - exercise_editormd.cm.on("change", (_cm, changeObj) => { - console.log('....contentChanged') - this.contentChanged = true; - }) - }); - this.exercise_editormd = exercise_editormd; - window.exercise_editormd = exercise_editormd; - - } - - componentDidMount() { - let id = this.props.match.params.shixunId; - let checkpointId=this.props.match.params.checkpointId; - this.setState({ - shixunId:id, - checkpointId:checkpointId - }) - let newchoice_url= "/shixuns/"+id+"/challenges/newquestion"; - let newpractice_url= "/shixuns/"+id+"/challenges/new"; - let newgo_back_url="/shixuns/"+id+"/challenges"; - - let url = "/shixuns/" + id + "/challenges/" + checkpointId + "/edit.json?tab=1"; - axios.get(url).then((response) => { - let newprev_challenge = response.data.prev_challenge; - let next_challenge = response.data.next_challenge; - if (newprev_challenge != undefined) { - if(newprev_challenge.st===0){ - newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint"; - }else{ - newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editquestion"; - } - } - if (next_challenge != undefined) { - - if(next_challenge.st===0){ - next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editcheckpoint"; - }else{ - next_challenge = "/shixuns/" + id + "/challenges/" + next_challenge.id+ "/editquestion"; - } - } - let newevaluationlist=[] - if(response.data.test_sets.length===0){ - // let newlist=[ - // {hidden:0,input:"",output:"",score:50}, - // {hidden:1,input:"",output:"",score:50} - // ] - let newlist=[ - {input:"",output:"",score:50}, - {input:"",output:"",score:50} - ] - newevaluationlist=newlist - }else{ - newevaluationlist=response.data.test_sets - } - - this.setState({ - power: response.data.power, - evaluationlist:newevaluationlist, - shixunfilepath:response.data.path, - shixunfilepathplay:response.data.exec_path, - pathoptionvalue:response.data.show_type, - shixunfileexpectpicturepath:response.data.original_picture_path, - shixunfilestandardpicturepath:response.data.expect_picture_path, - shixunfilepicturepath:response.data.picture_path, - prev_challenge: newprev_challenge, - next_challenge: next_challenge, - choice_url: newchoice_url, // 导航中的新建选择题url - practice_url: newpractice_url, //string 导航中新建实践题url - go_back_url: newgo_back_url, //string 导航中的返回url - position: response.data.position, //int 关卡位置,导航栏中的第几关 - scorevalue:response.data.test_set_score, - markvalue:response.data.test_set_average, - }) - this.evaluationoninputvalueonload(); - if(response.data.power===false){ - this.props.showSnackbar("你没有权限修改"); - } - if(response.data.answer===undefined){ - this.answerMD("", "answerMD"); - }else{ - this.answerMD(response.data.answer, "answerMD"); - } - - }).catch((error) => { - console.log(error) - }); - - } - - - setevaluationlist=(newevaluationlist)=>{ - this.setState({ - evaluationlist:newevaluationlist - }) - } - - - addevaluationon=()=>{ - let {evaluationlist,markvalue}=this.state; - let newevaluationlist=evaluationlist; - // newevaluationlist.push({hidden:0,input:"",output:"",score:0}); - newevaluationlist.push({input:"",output:"",score:0}); - newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue); - this.setevaluationlist(newevaluationlist); - } - - del_test_array=(key)=>{ - let {evaluationlist,markvalue}=this.state; - let newevaluationlist=evaluationlist; - newevaluationlist.splice(key,1); - newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue); - this.setevaluationlist(newevaluationlist); - } - - getfilepath=(e,shixunfilepath)=>{ - this.setState({ - evaluationvisible: true, - selectpath:e.target.value, - selectpatharr:[], - }); - let id = this.props.match.params.shixunId; - let url ="/shixuns/"+id+"/repository.json"; - axios.post(url,{ - path: "" - }).then((response) => { - if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - - }else{ - this.setState({ - trees:response.data.trees, - saveshixunfilepath:shixunfilepath, - path:"", - main:[], - }) - } - - }).catch((error) => { - console.log(error) - }); - } - - sendgetfilepath=(newpath,type)=>{ - let id = this.props.match.params.shixunId; - let{path,main}=this.state; - let ary=main; - let paths=path; - - this.setState({ - selectpatharr:[], - }) - if(paths===""&&type==="tree"){ - newpath=newpath+"/"; - paths=""; - if(main.length===0){ - ary.push({val:"根目录/",path:""},{val:newpath,path:paths+newpath}) - }else{ - ary.push({val:newpath,path:paths+newpath}) - } - - }else if(paths!=""&&type==="tree"){ - newpath=newpath+"/"; - ary.push({val:newpath,path:paths+newpath}) - } - - - let url ="/shixuns/"+id+"/repository.json"; - if(type==="tree"){ - - axios.post(url,{ - path: paths+newpath - }).then((response) => { - if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - - }else{ - this.setState({ - trees:response.data.trees, - path:paths+newpath, - main:ary, - // selectpath:"" - }) - } - - }).catch((error) => { - console.log(error) - }); - } - - } - - goblakepath=(path,key)=>{ - let {main,selectpath} =this.state; - let newmain=[] - for(var i=0;i<=key;i++){ - newmain.push(main[i]) - } - let id = this.props.match.params.shixunId; - let url ="/shixuns/"+id+"/repository.json"; - axios.post(url,{ - path: path - }).then((response) => { - if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - - }else { - this.setState({ - trees: response.data.trees, - path: path, - main: newmain, - // selectpath:selectpath - }) - } - }).catch((error) => { - console.log(error) - }); - } - // delesavegetfilepath=(value)=>{ - // let {selectpatharr} = this.state - // let newarr =selectpatharr; - // let newselectpath=""; - // for(var i=0; i{ - let {selectpath,saveshixunfilepath} = this.state - // let newarr =selectpatharr; - // let arrtype=false; - // let arrsum=0; - // let newselectpath=""; - // newarr.push(value) - // if(newarr.length>1&&arrtype===false){ - // for(var i=0; i { + setTimeout(() => { + exercise_editormd.resize() + exercise_editormd.cm && exercise_editormd.cm.refresh() + }, 500) + + if (initValue != undefined) { + exercise_editormd.setValue(initValue) + } + exercise_editormd.cm.on("change", (_cm, changeObj) => { + console.log('....contentChanged') + this.contentChanged = true; + }) + }); + this.exercise_editormd = exercise_editormd; + window.exercise_editormd = exercise_editormd; + + } + + componentDidMount() { + let id = this.props.match.params.shixunId; + let checkpointId=this.props.match.params.checkpointId; + this.setState({ + shixunId:id, + checkpointId:checkpointId + }) + let newchoice_url= "/shixuns/"+id+"/challenges/newquestion"; + let newpractice_url= "/shixuns/"+id+"/challenges/new"; + let newgo_back_url="/shixuns/"+id+"/challenges"; + + let url = "/shixuns/" + id + "/challenges/" + checkpointId + "/edit.json?tab=1"; + axios.get(url).then((response) => { + let newprev_challenge = response.data.prev_challenge; + let next_challenge = response.data.next_challenge; + if (newprev_challenge != undefined) { + if(newprev_challenge.st===0){ + newprev_challenge = "/shixuns/" + id + "/challenges/" + newprev_challenge.id + "/editcheckpoint"; }else{ - const type = selectpath.split(';'); - let types=false; - for(var i=0; i { + console.log(error) + }); + + } + + + setevaluationlist=(newevaluationlist)=>{ + this.setState({ + evaluationlist:newevaluationlist + }) + } + + + addevaluationon=()=>{ + let {evaluationlist,markvalue}=this.state; + let newevaluationlist=evaluationlist; + newevaluationlist.push({hidden:0,input:"",output:"",score:0}); + newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue); + this.setevaluationlist(newevaluationlist); + } + + del_test_array=(key)=>{ + let {evaluationlist,markvalue}=this.state; + let newevaluationlist=evaluationlist; + newevaluationlist.splice(key,1); + newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue); + this.setevaluationlist(newevaluationlist); + } + + getfilepath=(e,shixunfilepath)=>{ + this.setState({ + evaluationvisible: true, + selectpath:e.target.value, + selectpatharr:[], + }); + let id = this.props.match.params.shixunId; + let url ="/shixuns/"+id+"/repository.json"; + axios.post(url,{ + path: "" + }).then((response) => { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + + }else{ + this.setState({ + trees:response.data.trees, + saveshixunfilepath:shixunfilepath, + path:"", + main:[], + }) + } + + }).catch((error) => { + console.log(error) + }); + } + + sendgetfilepath=(newpath,type)=>{ + let id = this.props.match.params.shixunId; + let{path,main}=this.state; + let ary=main; + let paths=path; + + this.setState({ + selectpatharr:[], + }) + if(paths===""&&type==="tree"){ + newpath=newpath+"/"; + paths=""; + if(main.length===0){ + ary.push({val:"根目录/",path:""},{val:newpath,path:paths+newpath}) + }else{ + ary.push({val:newpath,path:paths+newpath}) + } + + }else if(paths!=""&&type==="tree"){ + newpath=newpath+"/"; + ary.push({val:newpath,path:paths+newpath}) + } + + + let url ="/shixuns/"+id+"/repository.json"; + if(type==="tree"){ + + axios.post(url,{ + path: paths+newpath + }).then((response) => { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - if(types===false){ - newselectpath=selectpath+value+ ";" + }else{ + this.setState({ + trees:response.data.trees, + path:paths+newpath, + main:ary, + // selectpath:"" + }) + } + + }).catch((error) => { + console.log(error) + }); + } + + } + + goblakepath=(path,key)=>{ + let {main,selectpath} =this.state; + let newmain=[] + for(var i=0;i<=key;i++){ + newmain.push(main[i]) + } + let id = this.props.match.params.shixunId; + let url ="/shixuns/"+id+"/repository.json"; + axios.post(url,{ + path: path + }).then((response) => { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { + + }else { + this.setState({ + trees: response.data.trees, + path: path, + main: newmain, + // selectpath:selectpath + }) + } + }).catch((error) => { + console.log(error) + }); + } + // delesavegetfilepath=(value)=>{ + // let {selectpatharr} = this.state + // let newarr =selectpatharr; + // let newselectpath=""; + // for(var i=0; i{ + let {selectpath,saveshixunfilepath} = this.state + // let newarr =selectpatharr; + // let arrtype=false; + // let arrsum=0; + // let newselectpath=""; + // newarr.push(value) + // if(newarr.length>1&&arrtype===false){ + // for(var i=0; i{ + let {saveshixunfilepath,selectpath}=this.state; + this.setState({ + evaluationvisible: false, + [saveshixunfilepath]:selectpath + }); + } + evaluationhideModal=()=>{ + this.setState({ + evaluationvisible: false, + }); + } + handpathoptionvalue=(value)=>{ + this.setState({ + pathoptionvalue:value + }) + } + showrepositoryurltip=(type)=>{ + if(type===1){ + this.setState({ + showrepositoryurltiptype:true + }) + }else{ + this.setState({ + showrepositoryurltiptype:false + }) + } + } + + evaluationonChange=(e,key)=>{ + let {evaluationlist}=this.state; + let newevaluationlist=evaluationlist; + let newtype; + if(e===1){ + newtype=0; + }else{ + newtype=1; + } + // newevaluationlist[key].is_public=newtype; + // for(var i=0; i{ + let {evaluationlist,scoretype}=this.state; + + if(scoretype===key){ + this.setState({ + scoretype:undefined + }) + } + let newevaluationlist=evaluationlist; + let sum =parseInt(e.target.value); + if(isNaN(sum)){ + sum=0 + } + newevaluationlist[key].score=sum; + + this.setState({ + evaluationlist:newevaluationlist, + markvalue:false + }) + this.setevaluationlist(newevaluationlist); + } + + evaluationoninputvalue=(e,key,type)=>{ + $.fn.autoHeight = function(){ + function autoHeight(elem){ + elem.style.height = 'auto'; + elem.style.maxHeight = '140px'; + elem.scrollTop = 0; //防抖动 + elem.style.height = elem.scrollHeight + 'px'; + } + this.each(function(){ + autoHeight(this); + $(this).on('keyup', function(){ + autoHeight(this); + }); + }); + } + $('textarea[autoHeight]').autoHeight(); + + let {evaluationlist}=this.state; + let newevaluationlist=evaluationlist; + if(type==="sr"){ + newevaluationlist[key].input=e.target.value + }else if(type==="yq"){ + newevaluationlist[key].output=e.target.value + } + this.setevaluationlist(newevaluationlist); + } + + + evaluationoninputvalueonload=()=>{ + $.fn.autoHeight = function(){ + function autoHeight(elem){ + elem.style.height = 'auto'; + elem.style.maxHeight = '140px'; + elem.scrollTop = 0; //防抖动 + elem.style.height = elem.scrollHeight + 'px'; + } + this.each(function(){ + autoHeight(this); + $(this).on('keyup', function(){ + autoHeight(this); + }); + }); + } + $('textarea[autoHeight]').autoHeight(); + } + submitarbitrationevaluation=()=>{ + let{evaluationlist,shixunfilepath,shixunfilepathplay,shixunfileexpectpicturepath,shixunfilestandardpicturepath,shixunfilepicturepath,pathoptionvalue,scorevalue,markvalue}=this.state; + + + let newscorevalue; + if(scorevalue===false){ + newscorevalue=false + }else{ + //判断占比 + newscorevalue=true + + let sum=0; + for(var i=0; i100){ + this.props.showSnackbar("测试集的评分占比不能大于100"); + this.setState({ + scoretype:i + }) + return + } + sum=sum+evaluationlist[i].score + } + + if(sum>100||sum<100){ + this.props.showSnackbar("测试集的评分占比之和必须等于100"); + return + } + + + } + if(shixunfilepath===undefined||shixunfilepath===""||shixunfilepath===null){ + this.props.showSnackbar("学员任务文件路径为空"); + this.setState({ + StudentTaskPapers:true + }) + $('html').animate({ + scrollTop: 120 + }, 1000); + return + } + + if(shixunfilepathplay===undefined||shixunfilepathplay===""||shixunfilepathplay===null){ + this.props.showSnackbar("评测执行文件路径为空"); + this.setState({ + StudentTaskDocs:true + }) + $('html').animate({ + scrollTop: 130 + }, 1000); + return + } + + if(evaluationlist.length===0){ + this.props.showSnackbar("测试集不能为空"); + return + } + let id = this.props.match.params.shixunId; + let{checkpointId}=this.state; + let url = "/shixuns/"+id+"/challenges/"+checkpointId+".json"; + axios.put(url,{ + tab:1, + challenge:{ + path:shixunfilepath, + exec_path:shixunfilepathplay, + show_type:pathoptionvalue, + original_picture_path:shixunfileexpectpicturepath, + expect_picture_path:shixunfilestandardpicturepath, + picture_path:shixunfilepicturepath, + test_set_score:newscorevalue, + test_set_average:markvalue + }, + test_set:evaluationlist + } + ).then((response) => { + this.props.showSnackbar(response.data.messages); + // if(response.data.status===1){ + // window.location.href = "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=3" + // } + }).catch((error) => { + console.log(error) + }); + } + handpathoptionvalues=()=>{ + this.setState({ + handpathopt:true + }) + } + handpathoptionvaluess=()=>{ + this.setState({ + handpathopt:false + }) + } + saveselectpath=(e)=>{ + + this.setState({ + selectpath:e.target.value + }) + } + updatepath=(e,name)=>{ + this.setState({ + [name]:e.target.value + }) + } + + + oneditevaluationlist=(newevaluationlist,markvalue)=>{ + + if(markvalue===true){ + if(100%newevaluationlist.length===0){ + let sum=100/newevaluationlist.length; + for(var i=0; i{ - let {saveshixunfilepath,selectpath}=this.state; - this.setState({ - evaluationvisible: false, - [saveshixunfilepath]:selectpath - }); - } - evaluationhideModal=()=>{ - this.setState({ - evaluationvisible: false, - }); - } - handpathoptionvalue=(value)=>{ - this.setState({ - pathoptionvalue:value - }) - } - showrepositoryurltip=(type)=>{ - if(type===1){ - this.setState({ - showrepositoryurltiptype:true - }) - }else{ - this.setState({ - showrepositoryurltiptype:false - }) - } - } - - evaluationonChange=(e,key)=>{ - let {evaluationlist}=this.state; - let newevaluationlist=evaluationlist; - let newtype; - if(e===1){ - newtype=0; - }else{ - newtype=1; - } - // newevaluationlist[key].is_public=newtype; - // for(var i=0; i{ - let {evaluationlist,scoretype}=this.state; - - if(scoretype===key){ - this.setState({ - scoretype:undefined - }) - } - let newevaluationlist=evaluationlist; - let sum =parseInt(e.target.value); - if(isNaN(sum)){ - sum=0 - } - newevaluationlist[key].score=sum; - - this.setState({ - evaluationlist:newevaluationlist, - markvalue:false - }) - this.setevaluationlist(newevaluationlist); - } - - evaluationoninputvalue=(e,key,type)=>{ - $.fn.autoHeight = function(){ - function autoHeight(elem){ - elem.style.height = 'auto'; - elem.style.maxHeight = '140px'; - elem.scrollTop = 0; //防抖动 - elem.style.height = elem.scrollHeight + 'px'; - } - this.each(function(){ - autoHeight(this); - $(this).on('keyup', function(){ - autoHeight(this); - }); - }); - } - $('textarea[autoHeight]').autoHeight(); - - let {evaluationlist}=this.state; - let newevaluationlist=evaluationlist; - if(type==="sr"){ - newevaluationlist[key].input=e.target.value - }else if(type==="yq"){ - newevaluationlist[key].output=e.target.value - } - this.setevaluationlist(newevaluationlist); - } - - - evaluationoninputvalueonload=()=>{ - $.fn.autoHeight = function(){ - function autoHeight(elem){ - elem.style.height = 'auto'; - elem.style.maxHeight = '140px'; - elem.scrollTop = 0; //防抖动 - elem.style.height = elem.scrollHeight + 'px'; - } - this.each(function(){ - autoHeight(this); - $(this).on('keyup', function(){ - autoHeight(this); - }); - }); - } - $('textarea[autoHeight]').autoHeight(); - } - submitarbitrationevaluation=()=>{ - let{evaluationlist,shixunfilepath,shixunfilepathplay,shixunfileexpectpicturepath,shixunfilestandardpicturepath,shixunfilepicturepath,pathoptionvalue,scorevalue,markvalue}=this.state; - - - let newscorevalue; - if(scorevalue===false){ - newscorevalue=false - }else{ - //判断占比 - newscorevalue=true - - let sum=0; - for(var i=0; i100){ - this.props.showSnackbar("测试集的评分占比不能大于100"); - this.setState({ - scoretype:i - }) - return - } - sum=sum+evaluationlist[i].score - } - - if(sum>100||sum<100){ - this.props.showSnackbar("测试集的评分占比之和必须等于100"); - return - } - - - } - if(shixunfilepath===undefined||shixunfilepath===""||shixunfilepath===null){ - this.props.showSnackbar("学员任务文件路径为空"); - this.setState({ - StudentTaskPapers:true - }) - $('html').animate({ - scrollTop: 120 - }, 1000); - return - } - - if(shixunfilepathplay===undefined||shixunfilepathplay===""||shixunfilepathplay===null){ - this.props.showSnackbar("评测执行文件路径为空"); - this.setState({ - StudentTaskDocs:true - }) - $('html').animate({ - scrollTop: 130 - }, 1000); - return - } - - if(evaluationlist.length===0){ - this.props.showSnackbar("测试集不能为空"); - return - } - let id = this.props.match.params.shixunId; - let{checkpointId}=this.state; - let url = "/shixuns/"+id+"/challenges/"+checkpointId+".json"; - axios.put(url,{ - tab:1, - challenge:{ - path:shixunfilepath, - exec_path:shixunfilepathplay, - show_type:pathoptionvalue, - original_picture_path:shixunfileexpectpicturepath, - expect_picture_path:shixunfilestandardpicturepath, - picture_path:shixunfilepicturepath, - test_set_score:newscorevalue, - test_set_average:markvalue - }, - test_set:evaluationlist - } - ).then((response) => { - this.props.showSnackbar(response.data.messages); - // if(response.data.status===1){ - // window.location.href = "/shixuns/" + id + "/challenges/"+response.data.challenge_id+"/tab=3" - // } - }).catch((error) => { - console.log(error) - }); - } - handpathoptionvalues=()=>{ - this.setState({ - handpathopt:true - }) - } - handpathoptionvaluess=()=>{ - this.setState({ - handpathopt:false - }) - } - saveselectpath=(e)=>{ - - this.setState({ - selectpath:e.target.value - }) - } - updatepath=(e,name)=>{ - this.setState({ - [name]:e.target.value - }) - } - - - oneditevaluationlist=(newevaluationlist,markvalue)=>{ - - if(markvalue===true){ - if(100%newevaluationlist.length===0){ - let sum=100/newevaluationlist.length; - for(var i=0; i{ - - let {markvalue,evaluationlist}=this.state; - let newevaluationlist=evaluationlist; - - if(e.target.value===true){ - newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue) - } - - this.setState({ - scorevalue: e.target.value, - evaluationlist:newevaluationlist - }); - - this.setevaluationlist(newevaluationlist); - } - - //均匀比例 - onChangemarkvalue=(e)=>{ - let {evaluationlist}=this.state; - - if(e.target.value===true){ - let newevaluationlist=evaluationlist; - newevaluationlist=this.oneditevaluationlist(newevaluationlist,e.target.value); - this.setevaluationlist(newevaluationlist); - } - - this.setState({ - markvalue: e.target.value, - }); - - } - render() { - - let { - choice_url, - practice_url, - go_back_url, - position, - evaluationlist, - shixunId, - checkpointId, - power, - shixunfileexpectpicturepath, - shixunfilestandardpicturepath, - shixunfilepicturepath, - shixunfilepath, - evaluationvisible, - trees, - path, - main, - selectpath, - shixunfilepathplay, - pathoptionvalue, - showrepositoryurltiptype, - prev_challenge, - next_challenge, - StudentTaskPapers, - StudentTaskDocs, - handpathopt, - scorevalue, - markvalue, - scoretype - } = this.state; - - let tab1url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/editcheckpoint"; - let tab2url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=2"; - let tab3url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=3"; - // console.log(this.props) - const radioStyle = { - display: 'block', - height: '30px', - lineHeight: '30px', - marginLeft: '20px', - }; - return ( - -
-
+ } + + } + + return newevaluationlist + } + //选择得分规范 + onChangeRadioGroups=(e)=>{ + + let {markvalue,evaluationlist}=this.state; + let newevaluationlist=evaluationlist; + + if(e.target.value===true){ + newevaluationlist=this.oneditevaluationlist(newevaluationlist,markvalue) + } + + this.setState({ + scorevalue: e.target.value, + evaluationlist:newevaluationlist + }); + + this.setevaluationlist(newevaluationlist); + } + + //均匀比例 + onChangemarkvalue=(e)=>{ + let {evaluationlist}=this.state; + + if(e.target.value===true){ + let newevaluationlist=evaluationlist; + newevaluationlist=this.oneditevaluationlist(newevaluationlist,e.target.value); + this.setevaluationlist(newevaluationlist); + } + + this.setState({ + markvalue: e.target.value, + }); + + } + render() { + + let { + choice_url, + practice_url, + go_back_url, + position, + evaluationlist, + shixunId, + checkpointId, + power, + shixunfileexpectpicturepath, + shixunfilestandardpicturepath, + shixunfilepicturepath, + shixunfilepath, + evaluationvisible, + trees, + path, + main, + selectpath, + shixunfilepathplay, + pathoptionvalue, + showrepositoryurltiptype, + prev_challenge, + next_challenge, + StudentTaskPapers, + StudentTaskDocs, + handpathopt, + scorevalue, + markvalue, + scoretype + } = this.state; + + let tab1url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/editcheckpoint"; + let tab2url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=2"; + let tab3url="/shixuns/" + shixunId + "/challenges/"+checkpointId+"/tab=3"; + // console.log(this.props) + const radioStyle = { + display: 'block', + height: '30px', + lineHeight: '30px', + marginLeft: '20px', + }; + return ( + +
+
- 第{position}关 - 返回 - - {prev_challenge === undefined ? "" : - 上一关 - } - - {next_challenge === undefined ? "" : - 下一关 - } - - 4||this.props.identity===undefined||this.props.status===2||this.props.status===1? "none":'block'}} - data-tip-down="新增代码编辑类型的任务">+ 实践类型 - 4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}} - data-tip-down="新增选择题类型的任务">+ 选择题类型 - -
- -
- -
  • - 本关任务 -
  • - -
  • - 评测设置 -
  • - -
  • - 参考答案 -
  • -
    - -

    - 请先上传本关任务的所有代码文件、标准图片等所有必要的文件到 - 版本库 -

    - - -
    -
    -

    学员任务文件

    -
    - * -
    - this.updatepath(e,"shixunfilepath")} - onClick={(e)=>this.getfilepath(e,"shixunfilepath")} - /> -

    该文件将直接显示给学生,需要学生在其中填写代码

    -
    -
    + 第{position}关 + 返回 + + {prev_challenge === undefined ? "" : + 上一关 + } + + {next_challenge === undefined ? "" : + 下一关 + } + + 4||this.props.identity===undefined||this.props.status===2||this.props.status===1? "none":'block'}} + data-tip-down="新增代码编辑类型的任务">+ 实践类型 + 4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"none":'block'}} + data-tip-down="新增选择题类型的任务">+ 选择题类型 + +
    + +
    + +
  • + 本关任务 +
  • + +
  • + 评测设置 +
  • + +
  • + 参考答案 +
  • +
    + +

    + 请先上传本关任务的所有代码文件、标准图片等所有必要的文件到 + 版本库 +

    + + +
    +
    +

    学员任务文件

    +
    + * +
    + this.updatepath(e,"shixunfilepath")} + onClick={(e)=>this.getfilepath(e,"shixunfilepath")} + /> +

    该文件将直接显示给学生,需要学生在其中填写代码

    +
    +
    必填项 -
    -
    -
    -
    - -
    -
    - -
    - - this.saveselectpath(e)} - value={selectpath}/> -
    - - this.evaluationenter()}>确定 - this.evaluationhideModal()}>取消 -
    -
    -
    - -
    -
    -

    评测执行文件

    -
    - * -
    - this.updatepath(e,"shixunfilepathplay")} - onClick={(e)=>this.getfilepath(e,"shixunfilepathplay")} - /> -

    该文件由平台执行,用来测试平台学员代码是否正确

    -
    -
    + className="fa fa-exclamation-circle mr3">必填项 +
    +
    +
    +
    + +
    +
    + +
    + + this.saveselectpath(e)} + value={selectpath}/> +
    + + this.evaluationenter()}>确定 + this.evaluationhideModal()}>取消 +
    +
    +
    + +
    +
    +

    评测执行文件

    +
    + * +
    + this.updatepath(e,"shixunfilepathplay")} + onClick={(e)=>this.getfilepath(e,"shixunfilepathplay")} + /> +

    该文件由平台执行,用来测试平台学员代码是否正确

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

    效果展现方式

    -
    - - this.showrepositoryurltip(1)}> -
    - -
    -

    - 图片:处理或输出图片类型的任务,请选填此项
    - 可以通过设置图片路径和学员答案文件路径,展示代码对应的图片效果

    - apk/exe:写可执行文件的任务,请选填此项
    - 可以通过设置学员答案文件路径,展示二维码以供扫码下载

    - txt:输出txt文档类型的任务,请选填此项
    - 可以通过学员答案文件路径设置,展示txt文件内容

    - html:web类型的任务,请选填此项
    - 可以通过Web路由设置,展示html效果预览页 -

    -

    this.showrepositoryurltip(2)} - >知道了 -

    -
    -
    -

    该选项用来配置学员评测本关任务时,查看效果页上需要展现的文件类型

    -
    -
    - - - {pathoptionvalue===1?
    -
    -

    待处理图片路径

    -
    -
    - this.updatepath(e,"shixunfileexpectpicturepath")} - onClick={(e)=>this.getfilepath(e,"shixunfileexpectpicturepath")} - /> -

    - 该路径下的文件将在学员评测本关任务时,作为原始图片显示在查看效果页,供学员参考,任务为图片处理时请指定该路径,并注意与程序文件所在文件夹分开 -

    -
    -
    -
    -
    -
    :""} - - - {pathoptionvalue===1?
    -
    -

    标准答案图片路径

    -
    -
    - this.updatepath(e,"shixunfilestandardpicturepath")} - onClick={(e)=>this.getfilepath(e,"shixunfilestandardpicturepath")} - /> -

    - 该路径下的文件将在学员评测本关任务时,作为参考答案显示在查看效果页,供学员参考任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开 -

    -
    -
    -
    -
    -
    :""} - - - {pathoptionvalue===-1?"":
    -
    -

    学员答案文件路径

    -
    -
    - this.updatepath(e,"shixunfilepicturepath")} - onClick={(e)=>this.getfilepath(e,"shixunfilepicturepath")} - placeholder="请在版本库中指定用来保存学员代码实际输出结果的路径。例:src/step1/outputimages"/> -

    - 学员评测本关任务时生成的文件将保存在该路径下,并作为实际输出显示在查看效果页,供学员确认任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开 -

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

    测试集

    */} -

    测试集和系统评分规则

    -

    - 得分规范: - - - 通过全部测试集 - (学员评测,仅当所有测试集都正确时,才获得一次性奖励) - - - 通过部分测试集 - (学员评测,当至少有一组测试集正确时,即可获得其对应比例的奖励) - -

    - -

    + className="fa fa-exclamation-circle mr3">必填项 +

    +
    +
    +
    + + +
    +
    +

    效果展现方式

    +
    + + this.showrepositoryurltip(1)}> +
    + +
    +

    + 图片:处理或输出图片类型的任务,请选填此项
    + 可以通过设置图片路径和学员答案文件路径,展示代码对应的图片效果

    + apk/exe:写可执行文件的任务,请选填此项
    + 可以通过设置学员答案文件路径,展示二维码以供扫码下载

    + txt:输出txt文档类型的任务,请选填此项
    + 可以通过学员答案文件路径设置,展示txt文件内容

    + html:web类型的任务,请选填此项
    + 可以通过Web路由设置,展示html效果预览页 +

    +

    this.showrepositoryurltip(2)} + >知道了 +

    +
    +
    +

    该选项用来配置学员评测本关任务时,查看效果页上需要展现的文件类型

    +
    +
    + + + {pathoptionvalue===1?
    +
    +

    待处理图片路径

    +
    +
    + this.updatepath(e,"shixunfileexpectpicturepath")} + onClick={(e)=>this.getfilepath(e,"shixunfileexpectpicturepath")} + /> +

    + 该路径下的文件将在学员评测本关任务时,作为原始图片显示在查看效果页,供学员参考,任务为图片处理时请指定该路径,并注意与程序文件所在文件夹分开 +

    +
    +
    +
    +
    +
    :""} + + + {pathoptionvalue===1?
    +
    +

    标准答案图片路径

    +
    +
    + this.updatepath(e,"shixunfilestandardpicturepath")} + onClick={(e)=>this.getfilepath(e,"shixunfilestandardpicturepath")} + /> +

    + 该路径下的文件将在学员评测本关任务时,作为参考答案显示在查看效果页,供学员参考任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开 +

    +
    +
    +
    +
    +
    :""} + + + {pathoptionvalue===-1?"":
    +
    +

    学员答案文件路径

    +
    +
    + this.updatepath(e,"shixunfilepicturepath")} + onClick={(e)=>this.getfilepath(e,"shixunfilepicturepath")} + placeholder="请在版本库中指定用来保存学员代码实际输出结果的路径。例:src/step1/outputimages"/> +

    + 学员评测本关任务时生成的文件将保存在该路径下,并作为实际输出显示在查看效果页,供学员确认任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开 +

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

    测试集

    */} +

    测试集和系统评分规则

    +

    + 得分规范: + + + 通过全部测试集 + (学员评测,仅当所有测试集都正确时,才获得一次性奖励) + + + 通过部分测试集 + (学员评测,当至少有一组测试集正确时,即可获得其对应比例的奖励) + +

    + +

    系统评分占比: + value={markvalue} + onChange={this.onChangemarkvalue} + > 均分比例 自定义比例 -

    +

    -
    -
    +
    +
    -
    +
    - {evaluationlist===undefined?"":evaluationlist.length===0?"":evaluationlist.map((item,key)=>{ - return( -
    -

    - * - 组{key+1} - + {evaluationlist===undefined?"":evaluationlist.length===0?"":evaluationlist.map((item,key)=>{ + return( +

    +

    + * + 组{key+1} + {/*checked={item.is_public===1?false:true}*/} - this.editpercentage(e,key)} - value={item.score} /> + this.editpercentage(e,key)} + value={item.score} /> % + style={{display:scorevalue===true?'inline-block':'none'}} + >% - {/*this.evaluationonChange(item.hidden,key)} checked={item.hidden===1?true:false}>隐藏*/} + this.evaluationonChange(item.hidden,key)} checked={item.hidden===1?true:false}>隐藏 - - this.del_test_array(key)}> - - - -

    - - -
    - ) - })} - -
    -
    - -

    - - 新增测试集 - -

    -

    温馨提示:建议公开测试集和隐藏测试集结合使用,降低作弊的几率;隐藏测试集,在“提交评测”时也将被自动检测

    -
    -
    -
    - - -
    4||this.props.identity===undefined||power===false?"none":"block"}}> - 提交 - 取消 -
    - - -
    - - ) - } + + this.del_test_array(key)}> + + + +

    + + +
    + ) + })} + +
    +
    + +

    + + 新增测试集 + +

    +

    温馨提示:建议公开测试集和隐藏测试集结合使用,降低作弊的几率;隐藏测试集,在“提交评测”时也将被自动检测

    +
    +
    +
    + + +
    4||this.props.identity===undefined||power===false?"none":"block"}}> + 提交 + 取消 +
    + + +
    +
    + ) + } } diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 50c5af396..4006fb615 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -173,7 +173,9 @@ em.vertical-line{display: inline-block;width: 2px;background: #999;height: 10px} #log_reg_content{border-radius: 5px;background: #FFFFff;width: 100%;text-align: center;position: absolute;top: 165px; left: 0px;padding: 40px 30px;box-sizing: border-box} .log_nav{border-bottom:1px solid #eaeaea;} -.log_nav li{float: left;text-align: center;font-size: 16px;padding-bottom:15px;margin: 0px 20px;cursor: pointer;} +.log_nav li{float: left;text-align: center;font-size: 16px;padding-bottom:15px; + /*margin: 0px 20px;*/ + cursor: pointer;} .log_nav li.active{border-bottom: 2px solid #459be5;} .log-botton{width: 100%;text-align: center;color: #FFFFff!important;display: block;background: #cbcbcb;height: 45px;line-height: 45px;border-radius: 4px;letter-spacing: 2px;cursor: pointer} .log-botton:hover{color: #FFFFff!important;}