|
|
webpackJsonp([234],{3714:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=a(65),l=(a.n(s),a(66)),E=a.n(l),n=a(174),i=(a.n(n),a(175)),c=a.n(i),r=a(166),o=(a.n(r),a(165)),y=a.n(o),u=a(287),m=(a.n(u),a(283)),N=a.n(m),p=a(0),w=a.n(p),P=a(45),C=a(298),h=a(12),d=a.n(h),f=a(335),S=(a.n(f),a(5)),x=function(e,t,a){return t&&v(e.prototype,t),a&&v(e,a),e};function v(e,t){for(var a=0;a<t.length;a++){var s=t[a];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}Object(S.Q)(),Object(S.Q)("/editormd/lib/");var g=window.$,j=N.a.Option,M=y.a.Group,b=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(k,p.Component),x(k,[{key:"componentDidMount",value:function(){var l=this,n=this.props.match.params.shixunId,i=this.props.match.params.checkpointId,c="/shixuns/"+n+"/challenges/newquestion",r="/shixuns/"+n+"/challenges/new",o="/shixuns/"+n+"/challenges";if(void 0===i){var e="/shixuns/"+n+"/challenges/new.json";d.a.get(e).then(function(e){l.setState({choice_url:c,practice_url:r,go_back_url:o,position:e.data.position,task_pass_default:e.data.task_pass_default,submit_url:e.data.submit_url,checkpointId:i,exercisememoMDRefval:e.data.task_pass_default}),l.exercisememoMDRef.current.setValue(e.data.task_pass_default||"")}).catch(function(e){console.log(e)})}else{var t="/shixuns/"+n+"/challenges/"+i+".json?tab=0";d.a.get(t).then(function(e){var t=void 0;1===e.data.difficulty?t=[100,200]:2===e.data.difficulty?t=[300,400,500,600]:3===e.data.difficulty&&(t=[700,800,900,1e3]);var a=e.data.prev_challenge,s=e.data.next_challenge;null!=a&&(a=0===a.st?"/shixuns/"+n+"/challenges/"+a.id+"/editcheckpoint":"/shixuns/"+n+"/challenges/"+a.id+"/editquestion"),null!=s&&(s=0===s.st?"/shixuns/"+n+"/challenges/"+s.id+"/editcheckpoint":"/shixuns/"+n+"/challenges/"+s.id+"/editquestion"),l.setState({power:e.data.power,prev_challenge:a,next_challenge:s,choice_url:c,practice_url:r,go_back_url:o,shixunCreatePractice:e.data.subject,position:e.data.position,shixunCreatePracticeGroup:e.data.difficulty,optionsums:t,onshixunsmarkvalue:e.data.score,shixunsskillvaluelist:e.data.tags,checkpointId:i,exec_time:e.data.exec_time,tab2url:"/shixuns/"+n+"/challenges/"+i+"/tab=2",tab3url:"/shixuns/"+n+"/challenges/"+i+"/tab=3",exercisememoMDRefval:e.data.task_pass}),!1===e.data.power&&l.props.showSnackbar("你没有权限修改"),l.exercisememoMDRef.current.setValue(e.data.task_pass||"")}).catch(function(e){console.log(e)})}}},{key:"render",value:function(){var a=this,e=(this.props.match.params.type,this.state),t=(e.marktype,e.shixunCreatePracticetype),s=e.shixunsskillvaluelisttype,l=e.choice_url,n=e.practice_url,i=e.go_back_url,c=e.position,r=(e.task_pass_default,e.submit_url,e.setopen,e.checkpointId),o=e.prev_challenge,u=e.next_challenge,m=(e.power,e.shixunCreatePractice),p=e.shixunCreatePracticeGroup,h=e.onshixunsmarkvalue,d=e.shixunsskillvalue,f=e.shixunsskillvaluelist,x=e.tab2url,v=e.tab3url,g=e.optionsums,b=e.CreatePracticesendtype,k=e.editPracticesendtype,_=void 0;return null!=g&&(_=g.map(function(e,t){return w.a.createElement(j,{key:e,id:t},e)})),w.a.createElement(w.a.Fragment,null,w.a.createElement("div",{className:"educontent mt30 mb30"},w.a.createElement("div",{className:"padding10-20 mb10 edu-back-white clearfix"},w.a.createElement("span",{className:"fl ring-blue mr10 mt7"},w.a.createElement("img",{src:Object(S.M)("images/educoder/icon/code.svg"),"data-tip-down":"实训任务",className:"fl mt2 ml2"})),w.a.createElement("span",{className:"font-16 task-hide fl TPMtaskName"},"第",c,"关"),w.a.createElement(P.b,{to:void 0===i?"":i,className:"color-grey-6 fr font-15 mt3"},"返回"),void 0===u?"":w.a.createElement("a",{href:u,className:"fr color-blue mr15 mt4"},"下一关"),void 0===o?"":w.a.createElement("a",{href:o,className:"fr color-blue mr15 mt4"},"上一关"),w.a.createElement("a",{href:void 0===n?"":n,className:"fr color-blue mr15 mt4",style:{display:4<this.props.identity||void 0===this.props.identity||2===this.props.status||1===this.props.status?"none":"block"},"data-tip-down":"新增代码编辑类型的任务"},"+ 实践类型"),w.a.createElement("a",{href:void 0===l?"":l,className:"fr color-blue mr15 mt4",style:{display:4<this.props.identity||void 0===this.props.identity||2===this.props.status||1===this.props.status?"none":"block"},"data-tip-down":"新增选择题类型的任务"},"+ 选择题类型")),w.a.createElement("div",{className:"challenge_nav clearfix edu-back-white"},w.a.createElement("li",{className:"active"},w.a.createElement("a",null,"本关任务")),w.a.createElement("li",{className:""},""===x?w.a.createElement("span",null,"评测设置"):w.a.createElement(P.b,{to:x},"评测设置")),w.a.createElement("li",{className:""},""===v?w.a.createElement("span",null,"参考答案"):w.a.createElement(P.b,{to:v},"参考答案"))),w.a.createElement("div",{className:"edu-back-white mb10 clearfix"},w.a.createElement("div",{className:"padding40-20"},w.a.createElement("p",{className:"color-grey-6 font-16 mb30"},"任务名称"),w.a.createElement("div",{className:"df"},w.a.createElement("span",{className:"mr30 color-orange pt10"},"*"),w.a.createElement("div",{className:"flex1 mr20"},w.a.createElement("input",{type:"text",className:!0===t?"input-100-45 greyInpus wind100":"input-100-45 greyInput ",maxLength:"50",name:"challenge[subject]",value:m,onInput:this.shixunCreatePractice,placeholder:"请输入任务名称(此信息将提前展示给学员),例:计算学生的课程成绩绩点"})),w.a.createElement("div",{style:{width:"57px"}},w.a.createElement("span",{className:!0===t?"color-orange mt8 fl block":"color-orange mt8 fl none",id:"new_shixun_name"},w.a.createElement("i",{className:"fa fa-exclamation-circle mr3"}),"必填项"))))),w.a.createElement("div",{className:"edu-back-white padding40-20 mb20"},w.a.createElement("p",{className:"color-grey-6 font-16 mb30"},"过关任务"),w.a.createElement(C.a,{ref:this.exercisememoMDRef,placeholder:"请输入选择题的题干内容",mdID:"exercisememoMD",refreshTimeout:1500,watch:!0,className:"courseMessageMD",initValue:this.state.exercisememoMDRefval,height:700}),w.a.createElement("p",{id:"e_tip_Memochallengesnew",className:"edu-txt-right color-grey-cd font-12"}),w.a.createElement("p",{id:"e_tips_Memochallengesnew",className:"edu-txt-right color-grey-cd font-12"})),w.a.createElement("div",{className:"edu-back-white padding40-20 mb20"},w.a.createElement("p",{className:"color-grey-6 font-16 mb30"},"难度系数"),w.a.createElement("div",{className:"clearfix mb40"},w.a.createElement(M,{value:p,className:"fl mr40",disabled:2===this.props.status,onChange:2===this.props.status?"":this.onshixunCreatePracticeChange},w.a.createElement(y.a,{value:1},"简单"),w.a.createElement(y.a,{value:2},"中等"),w.a.createElement(y.a,{value:3},"困难"))),w.a.createElement("p",{className:"color-grey-6 font-16 mb30"},"奖励经验值"),w.a.createElement("div",{className:"clearfix"},w.a.createElement("span",{className:"fl mr30 color-orange pt10"},"*"),w.a.createElement(N.a,{style:{width:120},className:"winput-240-40 fl",id:"challenge_score",onChange:2===this.props.status?"":this.onshixunsmark,disabled:2===this.props.status,value:h,getPopupContainer:function(e){return e.parentNode}},_),w.a.createElement("p",{className:"fl color-grey-9 font-12 ml20"},"如果学员答题错误,则不能得到相应的经验值",w.a.createElement("br",null),"如果学员成功得到经验值,那么将同时获得等值的金币奖励,如:+10经验值、+10金币"),w.a.createElement("span",{className:"color-orange mt7 fl ml20 none",id:"ex_value_notice"},w.a.createElement("i",{className:"fa fa-exclamation-circle mr3"}),"必填项"))),w.a.createElement("div",{className:"edu-back-white padding40-20 mb20"},w.a.createElement("p",{className:"color-grey-6 font-16 mb30"},"技能标签"),w.a.createElement("div",{className:"clearfix df"},w.a.createElement("span",{className:"mr30 color-orange pt10"},"*"),w.a.createElement("div",{className:"flex1"},w.a.createElement(E.a,{type:"text",className:"winput-240-40 fl mr20 winput-240-40s",id:"input_task_tag",placeholder:"添加标签",onInput:this.shixunsskill,value:d,onPressEnter:this.clickshixunsskill,onBlur:this.clickshixunsskill}),w.a.createElement("div",{className:"ml15 color-grey-9 mt5"},"学员答题正确将获得技能,否则不能获得技能"),w.a.createElement("div",{className:"mt20 clearfix",id:"task_tag_content"},void 0===f?"":0===f.length?"":f.map(function(e,t){return w.a.createElement("li",{className:"task_tag_span",key:t},w.a.createElement("span",null,e),w.a.createElement("a",{onClick:function(){return a.delshixunsskilllist(t)}},"×"))}))),w.a.createElement("span",{className:!0===s?"color-orange mt7 fl ml20 block":" color-orange mt7 fl ml20 none",id:"stage_name_notice"},w.a.createElement("i",{className:"fa fa-exclamation-circle mr3"}),"必填项"))),w.a.createElement("div",{className:"edu-back-white padding40-20 mb20"},w.a.createElement("p",{className:"color-grey-6 font-16 mb30"},"服务配置"),w.a.createElement("div",{className:"clearfix mb5"},w.a.createElement("span",{className:"color-orange pt10 fl"},"*"),w.a.createElement("label",{className:"panel-form-label fl"},"评测时限(S):"),w.a.createElement("div",{className:"pr fl with80 status_con"},w.a.createElement("input",{value:this.state.exec_time,className:"panel-box-sizing task-form-100 task-height-40",placeholder:"请输入类别名称",onInput:this.setexec_time})),w.a.createElement("span",{className:!0===this.state.shixunExec_timeType?"color-orange mt8 fl block ml20":"color-orange mt8 fl none",id:"new_shixun_name"},w.a.createElement("i",{className:"fa fa-exclamation-circle mr3"}),"必填项"),w.a.createElement("div",{className:"cl"}))),w.a.createElement("div",{className:"clearfix mt30",style:{display:4<this.props.identity||void 0===this.props.identity?"none":"block"}},void 0===r?w.a.createElement("a",{className:"defalutSubmitbtn fl mr20",onClick:!0===b?"":this.CreatePracticesend},"提交"):w.a.createElement("a",{className:"defalutSubmitbtn fl mr20",onClick:!0===k?"":this.editPracticesend},"提交"),w.a.createElement("a",{href:void 0===i?"":i,className:"defalutCancelbtn fl"},"取消"))))}}]),k);function k(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,k);var u=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(k.__proto__||Object.getPrototypeOf(k)).call(this,e));return u.onshixunCreatePracticeChange=function(e){var t=void 0,a=void 0;1===e.target.value?(t=[100,200],a=100):2===e.target.value?(t=[300,400,500,600],a=300):3===e.target.value&&(t=[700,800,900,1e3],a=700),u.setState({shixunCreatePracticeGroup:e.target.value,optionsums:t,onshixunsmarkvalue:a})},u.shixunCreatePractice=function(e){u.setState({shixunCreatePractice:e.target.value})},u.CreatePracticesend=function(){if(u.setState({CreatePracticesendtype:!0}),2===u.props.status)return u.props.showSnackbar("该实训已经发布不能新建"),void u.setState({CreatePracticesendtype:!1});var e=u.state,t=e.shixunCreatePractice,a=e.shixunCreatePracticeGroup,s=e.onshixunsmarkvalue,l=e.shixunsskillvaluelist,n=e.exec_time;if(void 0===t||""==t)return u.setState({shixunCreatePracticetype:!0}),u.props.showSnackbar("任务名称为空"),g("html").animate({scrollTop:10},1e3),void u.setState({CreatePracticesendtype:!1});if(0===l.length)return u.setState({shixunsskillvaluelisttype:!0,CreatePracticesendtype:!1}),void u.props.showSnackbar("技能标签为空");if(null!=n&&""!==n){var i=u.exercisememoMDRef.current.getValue().trim(),c=u.props.match.params.shixunId,r="/shixuns/"+c+"/challenges.json";d.a.post(r,{identifier:c,subject:t,task_pass:i,difficulty:a,score:s,challenge_tag:l,st:0,exec_time:n}).then(function(e){1===e.data.status&&(window.location.href="/shixuns/"+c+"/challenges/"+e.data.challenge_id+"/tab=2")}).catch(function(e){console.log(e)})}else u.setState({shixunExec_timeType:!1})},u.onshixunsmark=function(e){u.setState({onshixunsmarkvalue:e})},u.shixunsskill=function(e){u.setState({shixunsskillvalue:e.target.value})},u.clickshixunsskill=function(){var e=u.state,t=e.shixunsskillvalue,a=e.shixunsskillvaluelist;if(""!==t&&void 0!==t)if(""==t||null==t||null==t||0<t.length&&0==t.trim().length)c.a.error("输入为空,不能保存!");else{var s=a;s.push(t),u.setState({shixunsskillvaluelist:s,shixunsskillvalue:""})}},u.delshixunsskilllist=function(e){var t=u.state.shixunsskillvaluelist;t.splice(e,1),u.setState({shixunsskillvaluelist:t})},u.editPracticesend=function(){u.setState({editPracticesendtype:!0});var e=u.state,t=e.shixunCreatePractice,a=e.shixunCreatePracticeGroup,s=e.onshixunsmarkvalue,l=e.shixunsskillvaluelist,n=e.checkpointId,i=e.exec_time,c=u.exercisememoMDRef.current.getValue().trim(),r=u.props.match.params.shixunId,o="/shixuns/"+r+"/challenges/"+n+".json";return void 0===t||""==t?(u.props.showSnackbar("任务名称为空"),g("html").animate({scrollTop:10},1e3),void u.setState({editPracticesendtype:!1})):0===l.length?(u.props.showSnackbar("技能标签为空"),void u.setState({editPracticesendtype:!1})):void(null!=i&&""!==i?d.a.put(o,{tab:0,identifier:r,id:n,challenge:{subject:t,task_pass:c,difficulty:a,score:s,exec_time:i},challenge_tag:l}).then(function(e){u.props.showSnackbar(e.data.messages),1===e.data.status&&(window.location.href="/shixuns/"+r+"/challenges/"+n+"/tab=2",u.setState({setopen:!0,editPracticesendtype:!1,tab2url:"/shixuns/"+r+"/challenges/"+n+"/tab=2",tab3url:"/shixuns/"+r+"/challenges/"+n+"/tab=3"}))}).catch(function(e){console.log(e)}):u.setState({shixunExec_timeType:!1}))},u.onshixunsmarks=function(){u.setState({marktype:!0})},u.onshixunsmarkss=function(){u.setState({marktype:!1})},u.setexec_time=function(e){u.setState({exec_time:e.target.value})},u.exercisememoMDRef=w.a.createRef(),u.state={choice_url:void 0,practice_url:void 0,go_back_url:void 0,task_pass_default:void 0,submit_url:void 0,shixunCreatePracticeGroup:1,optionsums:[100,200],activetype:0,setopen:!1,shixunCreatePractice:void 0,onshixunsmarkvalue:100,shixunsskillvalue:void 0,shixunsskillvaluelist:[],tab2url:"",tab3url:"",prev_challenge:void 0,next_challenge:void 0,power:!1,shixunCreatePracticetype:!1,shixunsskillvaluelisttype:!1,marktype:!1,editPracticesendtype:!1,CreatePracticesendtype:!1,exec_time:20,shixunExec_timeType:!1},u}t.default=b}}); |