You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
8.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

webpackJsonp([235],{3716:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(990),s=(a.n(n),a(991)),f=a.n(s),l=a(65),r=(a.n(l),a(66)),g=a.n(r),c=a(162),o=(a.n(c),a(161)),v=a.n(o),i=a(166),m=(a.n(i),a(165)),u=a.n(m),p=a(287),h=(a.n(p),a(283)),d=a.n(h),b=a(0),w=a.n(b),E=a(45),y=a(5),_=a(12),x=a.n(_),k=a(335),N=(a.n(k),a(298)),S=function(e,t,a){return t&&O(e.prototype,t),a&&O(e,a),e};function O(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object(y.Q)(),Object(y.Q)("/editormd/lib/");var j=window.$,C=(d.a.Option,u.a.Group,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)}(I,b.Component),S(I,[{key:"componentDidMount",value:function(){var n=this,s=this.props.match.params.shixunId,e=this.props.match.params.checkpointId,l="/shixuns/"+s+"/challenges/newquestion",r="/shixuns/"+s+"/challenges/new",c="/shixuns/"+s+"/challenges";this.setState({shixunId:s,checkpointId:e});var t="/shixuns/"+s+"/challenges/"+e+"/edit.json?tab=2";x.a.get(t).then(function(e){var t=e.data.prev_challenge,a=e.data.next_challenge;null!=t&&(t=0===t.st?"/shixuns/"+s+"/challenges/"+t.id+"/editcheckpoint":"/shixuns/"+s+"/challenges/"+t.id+"/editquestion"),null!=a&&(a=0===a.st?"/shixuns/"+s+"/challenges/"+a.id+"/editcheckpoint":"/shixuns/"+s+"/challenges/"+a.id+"/editquestion"),n.setState({answer:e.data.answer,power:e.data.power,choice_url:l,practice_url:r,go_back_url:c,position:e.data.position,prev_challenge:t,next_challenge:a}),!1===e.data.power&&n.props.showSnackbar("没有权限修改")}).catch(function(e){console.log(e)});var a="/shixuns/"+s+"/challenges/"+e+"/answer.json";x.a.get(a).then(function(e){401===e.data.status||e.data&&n.setState({answers:e.data})})}},{key:"render",value:function(){var a=this,e=this.state,t=e.choice_url,n=e.practice_url,s=e.go_back_url,l=e.position,r=(e.task_pass_default,e.submit_url,e.shixunId),c=e.checkpointId,o=e.power,i=e.prev_challenge,m=e.next_challenge,u=e.answers,p="/shixuns/"+r+"/challenges/"+c+"/editcheckpoint",h="/shixuns/"+r+"/challenges/"+c+"/tab=2",d="/shixuns/"+r+"/challenges/"+c+"/tab=3";return w.a.createElement(w.a.Fragment,null,w.a.createElement("div",{className:"educontent mt30 mb30 tpmAnswer"},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(y.M)("images/educoder/icon/code.svg"),"data-tip-down":"实训任务",className:"fl mt2 ml2"})),w.a.createElement("span",{className:"font-16 task-hide fl TPMtaskName"},"第",l,"关"),w.a.createElement(E.b,{to:void 0===s?"":s,className:"color-grey-6 fr font-15 mt3"},"返回"),void 0===i?"":w.a.createElement("a",{href:i,className:"fr color-blue mr15 mt4"},"上一关"),void 0===m?"":w.a.createElement("a",{href:m,className:"fr color-blue mr15 mt4"},"下一关"),w.a.createElement(E.b,{to:void 0===n?"":n,className:"fr color-blue mr15 mt4",style:{display:2===this.props.status||1===this.props.status?"none":"block"},"data-tip-down":"新增代码编辑类型的任务"},"+ 实践类型"),w.a.createElement(E.b,{to:void 0===t?"":t,className:"fr color-blue mr15 mt4",style:{display: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",null,w.a.createElement(E.b,{to:p},"本关任务")),w.a.createElement("li",null,w.a.createElement(E.b,{to:h},"评测设置")),w.a.createElement("li",{className:"active"},w.a.createElement(E.b,{to:d},"参考答案"))),w.a.createElement("div",{className:"edu-back-white mb10 clearfix"},w.a.createElement("div",{className:"padding30-20"},w.a.createElement("p",{className:" font-12",style:{paddingBottom:"5px",color:"#666666"}},"可以将参考答案分级设置,让学员自行选择级别,每级查看后按照比例扣分值(学员已完成任务再查看,则不影响原因已获得的成绩)"),w.a.createElement("p",{className:" font-12 ",style:{maxWidth:"782px",color:"#999999"}},"示例级别1扣减分值占比25%级别2扣减分值占比35%级别3扣减分值占比40%则学员选择查看级别1的答案将被扣减25%的分值; 选择查看级别2的答案将被扣减60%的分值选择查看级别3的答案将被扣减100%的分值。"),w.a.createElement("style",null,"\n .tpmAnswer .ant-input { width: 230px }\n .tpmAnswer .score.ant-input-number { width: 62px; }\n .levelSection { margin-top: 16px }\n "),u.map(function(e,t){return w.a.createElement("div",{className:"levelSection",id:"levelSection"+t,style:{clear:"both"}},w.a.createElement("span",{className:"mr4 color-orange pt10"},"*"),w.a.createElement("p",{className:"color-grey-6 font-16 mb30 mt10",style:{display:"inline"}},"级别",t+1),w.a.createElement(v.a,{title:"删除"},w.a.createElement("a",{className:"fr sample_icon_remove mr30 mt8",onClick:function(){return a.delanswers(t)}},w.a.createElement("i",{className:"fa fa-times-circle color-grey-c font-16 fl"}))),w.a.createElement("div",{className:" color-grey-6 font-16",style:{marginLeft:"9px",margin:"8px 9px"}},w.a.createElement("div",{className:" "},w.a.createElement("span",null,"名称:"),w.a.createElement(g.a,{value:e.name,onChange:function(e){return a.onNameChange(e,t)}}),w.a.createElement("span",{style:{marginLeft:"20px"}},"扣减分值占比:"),w.a.createElement(f.a,{className:"score",step:1,min:1,max:100,defaultValue:e.score,onChange:function(e){return a.onScoreChange(e,t)}}),"%"),w.a.createElement("div",{className:"mt10"},w.a.createElement("span",null,"参考答案:"),w.a.createElement(N.a,{ref:"md"+t,mdID:t,initValue:e.contents,onChange:function(e){return a.answerOnChange(e,t)}}))))}),w.a.createElement("div",{className:"clearfix mt20",style:{display:4<this.props.identity||void 0===this.props.identity||!1===o?"none":"block"}},w.a.createElement("a",{href:"javascript:void(0)",className:"defalutCancelbtn fl",onClick:this.addAnswer},"新增")))),w.a.createElement("div",{className:"clearfix mt20",style:{display:4<this.props.identity||void 0===this.props.identity||!1===o?"none":"block"}},w.a.createElement("a",{className:"defalutSubmitbtn fl mr20",onClick:this.challenge_answer_submit},"提交"),w.a.createElement("a",{href:"/shixuns/"+r+"/challenges",className:"defalutCancelbtn fl"},"取消"))))}}]),I);function I(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,I);var r=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,(I.__proto__||Object.getPrototypeOf(I)).call(this,e));return r.challenge_answer_submit=function(){var e=r.state.answers.slice(0);console.log(e);var s=!0,l=0;if(e.forEach(function(e,t){if(s){var a="#levelSection"+t,n=r.refs["md"+t].getValue().trim();e.contents=n,e.name=e.name.trim(),l+=e.score,delete e.id,e.name?n||(r.props.showSnackbar("请先填写参考答案内容"),s=!1):(r.props.showSnackbar("请先填写参考答案名称"),s=!1),s||j("html, body").animate({scrollTop:j(a).offset().top-100})}}),s)if(0==e.length||100==l){var t=r.props.match.params.shixunId,a=r.state.checkpointId,n="/shixuns/"+t+"/challenges/"+a+"/crud_answer.json";x.a.post(n,{challenge_answer:e}).then(function(e){e.data&&(e.data.message&&r.props.showSnackbar(e.data.message),1==e.data.status&&(window.location.href="/shixuns/"+t+"/challenges"))}).catch(function(e){console.log(e)})}else r.props.showSnackbar("请先保证占比和为100%")},r.onNameChange=function(e,t){var a=Object.assign({},r.state.answers[t]);a.name=e.target.value;var n=r.state.answers.slice(0);n[t]=a,r.setState({answers:n})},r.onScoreChange=function(e,t){var a=Object.assign({},r.state.answers[t]);a.score=e;var n=r.state.answers.slice(0);n[t]=a,r.setState({answers:n})},r.answerOnChange=function(e,t){if(r.state.answers[t]){var a=Object.assign({},r.state.answers[t]);a.contents=e;var n=r.state.answers.slice(0);n[t]=a,r.setState({answers:n})}},r.addAnswer=function(){var e=r.state.answers.slice(0);e.push({name:"解题思路"+(e.length+1),contents:"",score:10}),r.setState({answers:e})},r.delanswers=function(t){var a=r.state.answers;a.splice(t,1),r.setState({answers:a},function(){for(var e=t;e<a.length;e++)r.refs["md"+e].setValue(a[e].contents)})},r.state={choice_url:void 0,practice_url:void 0,go_back_url:void 0,value:1,answer:"",id:void 0,checkpointId:void 0,power:!1,prev_challenge:void 0,next_challenge:void 0,answers:[]},r}t.default=C}});