forgeplus/public/react/build/static/js/274.e27dcfa8.chunk.js

53 lines
19 KiB
JavaScript

webpackJsonp([274],{
/***/ 4503:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_antd_lib_input_number_style_css__ = __webpack_require__(1147);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_antd_lib_input_number_style_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_antd_lib_input_number_style_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_antd_lib_input_number__ = __webpack_require__(1148);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_antd_lib_input_number___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_antd_lib_input_number__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_antd_lib_input_style_css__ = __webpack_require__(57);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_antd_lib_input_style_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_antd_lib_input_style_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_antd_lib_input__ = __webpack_require__(58);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_antd_lib_input___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_antd_lib_input__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_antd_lib_tooltip_style_css__ = __webpack_require__(173);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_antd_lib_tooltip_style_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_antd_lib_tooltip_style_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_antd_lib_tooltip__ = __webpack_require__(172);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_antd_lib_tooltip___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_antd_lib_tooltip__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_antd_lib_button_style_css__ = __webpack_require__(89);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_antd_lib_button_style_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_antd_lib_button_style_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_antd_lib_button__ = __webpack_require__(75);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_antd_lib_button___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_antd_lib_button__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_react__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_react_router_dom__ = __webpack_require__(48);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_axios__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_axios___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_10_axios__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__TPMMDEditor__ = __webpack_require__(320);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__modals_Bottomsubmit__ = __webpack_require__(1612);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__css_TPMchallengesnew_css__ = __webpack_require__(361);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__css_TPMchallengesnew_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_13__css_TPMchallengesnew_css__);
var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}var $=window.$;var TPManswer=function(_Component){_inherits(TPManswer,_Component);function TPManswer(props){_classCallCheck(this,TPManswer);var _this=_possibleConstructorReturn(this,(TPManswer.__proto__||Object.getPrototypeOf(TPManswer)).call(this,props));_this.challenge_answer_submit=function(){// `levelSection${index}`
// this.refs.md0
var answers=_this.state.answers;var answersParams=answers.slice(0);// console.log(answersParams)
var isValidate=true;var totalScore=0;answersParams.forEach(function(item,index){if(!isValidate){return;}var sectionId='#levelSection'+index;var mdContnet=_this.refs['md'+index].getValue().trim();;item.contents=mdContnet;item.name=item.name.trim();totalScore+=item.score;delete item.id;if(!item.name){_this.props.showNotification("请先填写参考答案名称");isValidate=false;}else if(!mdContnet){_this.props.showNotification("请先填写参考答案内容");isValidate=false;}if(!isValidate){$("html, body").animate({scrollTop:$(''+sectionId).offset().top-100});}});if(!isValidate){return;}if(answersParams.length!=0&&totalScore!=100){_this.props.showNotification("请先保证占比和为100%");return;}var id=_this.props.match.params.shixunId;var checkpointId=_this.state.checkpointId;var url='/shixuns/'+id+'/challenges/'+checkpointId+'/crud_answer.json';__WEBPACK_IMPORTED_MODULE_10_axios___default.a.post(url,{challenge_answer:answersParams}).then(function(response){if(response.data){if(response.data.message){_this.props.showNotification(response.data.message);}if(response.data.status==1){window.location.href='/shixuns/'+id+'/challenges';// $("html").animate({ scrollTop: 0 })
}}}).catch(function(error){console.log(error);});};_this.onNameChange=function(e,index){var newAnswer=Object.assign({},_this.state.answers[index]);newAnswer.name=e.target.value;var newAnswers=_this.state.answers.slice(0);newAnswers[index]=newAnswer;_this.setState({answers:newAnswers});};_this.onScoreChange=function(val,index){var newAnswer=Object.assign({},_this.state.answers[index]);newAnswer.score=val;var newAnswers=_this.state.answers.slice(0);newAnswers[index]=newAnswer;_this.setState({answers:newAnswers});};_this.answerOnChange=function(val,index){if(!_this.state.answers[index]){// 1、2、3删除2会走到这里
return;}var newAnswer=Object.assign({},_this.state.answers[index]);newAnswer.contents=val;var newAnswers=_this.state.answers.slice(0);newAnswers[index]=newAnswer;_this.setState({answers:newAnswers});};_this.addAnswer=function(){var newAnswers=_this.state.answers.slice(0);newAnswers.push({"name":'\u89E3\u9898\u601D\u8DEF'+(newAnswers.length+1),"contents":"","score":10});_this.setState({answers:newAnswers});};_this.delanswers=function(index){var answers=_this.state.answers;var newanswers=answers;newanswers.splice(index,1);_this.setState({answers:newanswers},function(){for(var i=index;i<newanswers.length;i++){_this.refs['md'+i].setValue(newanswers[i].contents);}});};_this.gotocheckpoint=function(url){_this.props.history.replace(url);};_this.state={choice_url:undefined,practice_url:undefined,go_back_url:undefined,value:1,answer:"",id:undefined,checkpointId:undefined,power:false,prev_challenge:undefined,next_challenge:undefined,answers:[]//testAnswers
};return _this;}_createClass(TPManswer,[{key:'componentDidMount',value:function componentDidMount(){var _this2=this;var id=this.props.match.params.shixunId;var checkpointId=this.props.match.params.checkpointId;var newchoice_url="/shixuns/"+id+"/challenges/newquestion";var newpractice_url="/shixuns/"+id+"/challenges/new";var newgo_back_url="/shixuns/"+id+"/challenges";this.setState({shixunId:id,checkpointId:checkpointId});var url="/shixuns/"+id+"/challenges/"+checkpointId+"/edit.json?tab=2";__WEBPACK_IMPORTED_MODULE_10_axios___default.a.get(url).then(function(response){var newprev_challenge=response.data.prev_challenge;var 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";}}_this2.setState({answer:response.data.answer,power:response.data.power,choice_url:newchoice_url,// 导航中的新建选择题url
practice_url:newpractice_url,//string 导航中新建实践题url
go_back_url:newgo_back_url,//string 导航中的返回url
position:response.data.position,//int 关卡位置,导航栏中的第几关
prev_challenge:newprev_challenge,next_challenge:next_challenge,responsedata:response.data});if(response.data.power===false){_this2.props.showNotification("没有权限修改");}// if(response.data.answer===undefined||response.data.answer===null){
// this.answerMD("", "answerMD");
// }else{
// this.answerMD(response.data.answer, "answerMD");
// }
}).catch(function(error){console.log(error);});var urlAnswer='/shixuns/'+id+'/challenges/'+checkpointId+'/answer.json';__WEBPACK_IMPORTED_MODULE_10_axios___default.a.get(urlAnswer).then(function(response){if(response.data.status===401){}else if(response.data){_this2.setState({answers:response.data});}});}},{key:'render',value:function render(){var _this3=this;var _state=this.state,choice_url=_state.choice_url,practice_url=_state.practice_url,responsedata=_state.responsedata,position=_state.position,task_pass_default=_state.task_pass_default,submit_url=_state.submit_url,shixunId=_state.shixunId,checkpointId=_state.checkpointId,power=_state.power,prev_challenge=_state.prev_challenge,next_challenge=_state.next_challenge,answers=_state.answers;var tab1url="/shixuns/"+shixunId+"/challenges/"+checkpointId+"/editcheckpoint";var tab2url="/shixuns/"+shixunId+"/challenges/"+checkpointId+"/tab=2";var tab3url="/shixuns/"+shixunId+"/challenges/"+checkpointId+"/tab=3";// console.log(this.props)
return __WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_8_react___default.a.Fragment,null,__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:'educontent mt30 mb30 tpmAnswer'},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:'TPMchallengesnewtitles edu-back-white clearfix borderbottomf4'},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('span',{className:'font-16 task-hide fl TPMtaskName'},'\u7B2C',position,'\u5173\uFF1A',responsedata&&responsedata.st===0?"实践题":responsedata&&responsedata.st===1?"选择题":""),this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"":__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('a',{href:practice_url===undefined?"":practice_url,className:'fr ml15 mt13'},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_7_antd_lib_button___default.a,{type:'primary',className:'edu-default-btn edu-greenback-btn '},'\u65B0\u589E\u5B9E\u8DF5\u4EFB\u52A1')),this.props.identity>4||this.props.identity===undefined||this.props.status===2||this.props.status===1?"":__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_9_react_router_dom__["b" /* Link */],{to:choice_url===undefined?"":choice_url,className:'fr ml15 mt13'},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_7_antd_lib_button___default.a,{type:'primary',className:'edu-default-btn edu-greenback-btn mr5'},'\u65B0\u589E\u9009\u62E9\u9898\u4EFB\u52A1')),next_challenge===undefined?"":__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_7_antd_lib_button___default.a,{type:'primary',ghost:true,onClick:function onClick(){return _this3.gotocheckpoint(next_challenge);},className:'edu-default-btn edu-greenback-btn mr5 fr ml15 mt13'},'\u4E0B\u4E00\u5173'),prev_challenge===undefined?"":__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_7_antd_lib_button___default.a,{type:'primary',ghost:true,onClick:function onClick(){return _this3.gotocheckpoint(prev_challenge);},className:'edu-default-btn edu-greenback-btn mr5 fr ml15 mt13'},'\u4E0A\u4E00\u5173')),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:'challenge_nav clearfix edu-back-white'},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('li',null,__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_9_react_router_dom__["b" /* Link */],{to:tab1url},'1\u3001\u672C\u5173\u4EFB\u52A1 ')),tab2url===""?"":__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('li',null,' > '),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('li',null,__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_9_react_router_dom__["b" /* Link */],{to:tab2url},'2\u3001\u8BC4\u6D4B\u8BBE\u7F6E')),tab3url===""?"":__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('li',null,' > '),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('li',{className:'active'},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_9_react_router_dom__["b" /* Link */],{to:tab3url,className:"color-blue"},' 3\u3001\u53C2\u8003\u7B54\u6848'))),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:'edu-back-white mb10 clearfix'},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:'padding30-20'},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('p',{className:' font-14',style:{paddingBottom:'5px',color:'#333'}},'\u53EF\u4EE5\u5C06\u53C2\u8003\u7B54\u6848\u5206\u7EA7\u8BBE\u7F6E\uFF0C\u8BA9\u5B66\u5458\u81EA\u884C\u9009\u62E9\u7EA7\u522B\uFF0C\u6BCF\u7EA7\u67E5\u770B\u540E\u6309\u7167\u6BD4\u4F8B\u6263\u5206\u503C\uFF08\u5B66\u5458\u5DF2\u5B8C\u6210\u4EFB\u52A1\u518D\u67E5\u770B\uFF0C\u5219\u4E0D\u5F71\u54CD\u5B66\u5458\u5DF2\u83B7\u5F97\u7684\u6210\u7EE9\uFF09'),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('p',{className:' font-14 mt15 ',style:{color:'#888'}},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',null,'\u793A\u4F8B\uFF1A\u7EA7\u522B1\uFF0C\u6263\u51CF\u5206\u503C\u5360\u6BD425%\uFF1B\u7EA7\u522B2\uFF0C\u6263\u51CF\u5206\u503C\u5360\u6BD435%\uFF1B\u7EA7\u522B3\uFF0C\u6263\u51CF\u5206\u503C\u5360\u6BD440%\uFF1B'),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:"mt5 ml41"},'\u82E5\u5B66\u5458\u9009\u62E9\u67E5\u770B\u7EA7\u522B1\u7684\u7B54\u6848\uFF0C\u5C06\u88AB\u6263\u51CF25%\u7684\u5206\u503C\uFF1B\u9009\u62E9\u67E5\u770B\u7EA7\u522B2\u7684\u7B54\u6848\uFF0C\u5C06\u88AB\u6263\u51CF60%\u7684\u5206\u503C\uFF1B\u9009\u62E9\u67E5\u770B\u7EA7\u522B3\u7684\u7B54\u6848\uFF0C\u5C06\u88AB\u6263\u51CF100%\u7684\u5206\u503C\u3002')),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('style',null,'\n .tpmAnswer .ant-input { width: 230px }\n .tpmAnswer .score.ant-input-number { width: 62px; }\n .levelSection { margin-top: 16px }\n '),answers.map(function(answer,index){return __WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:'levelSection mt30',id:'levelSection'+index,style:{clear:'both'}},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('span',{className:'mr4 color-orange pt10'},'*'),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('p',{className:'color-grey-6 font-16 mb30 mt10',style:{display:"inline"}},'\u7EA7\u522B\uFF1A',index+1),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_5_antd_lib_tooltip___default.a,{title:'\u5220\u9664'},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('a',{className:'fr sample_icon_remove mr10 mt8',onClick:function onClick(){return _this3.delanswers(index);}},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('i',{className:"iconfont icon-shanchu_Hover font-16 fl"}))),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:' color-grey-6 font-16 bortopeeetpm pt20 mt20',style:{marginLeft:"9px",margin:'8px 9px'}},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:' '},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:"wind500height45"},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:"fl",style:{'width':'240px'}},'\u540D\u79F0\uFF1A'),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:"fl",style:{marginLeft:"20px"}},'\u6263\u51CF\u5206\u503C\u5360\u6BD4\uFF1A')),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:"wind500height45"},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_3_antd_lib_input___default.a,{value:answer.name,onChange:function onChange(e){return _this3.onNameChange(e,index);}}),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1_antd_lib_input_number___default.a,{className:'score',step:1,min:1,max:100,defaultValue:answer.score,style:{marginLeft:"32px"},onChange:function onChange(e){return _this3.onScoreChange(e,index);}}),' %')),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:'mt10'},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('span',null,'\u5185\u5BB9\uFF1A'),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_11__TPMMDEditor__["a" /* default */],{ref:'md'+index,mdID:index,initValue:answer.contents,onChange:function onChange(val){return _this3.answerOnChange(val,index);}}))));}),__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:'clearfix mt20',style:{display:this.props.identity>4||this.props.identity===undefined||power===false?"none":"block"}},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_7_antd_lib_button___default.a,{type:'primary',ghost:true,className:'edu-default-btn edu-greenback-btn mt20 mb20 newaddswermargin',onClick:this.addAnswer},'\u65B0\u589E\u53C2\u8003\u7B54\u6848'))))),this.props.identity>4||this.props.identity===undefined||power===false?"":__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement('div',{className:'clearfix mt20'},__WEBPACK_IMPORTED_MODULE_8_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_12__modals_Bottomsubmit__["a" /* default */],Object.assign({url:"/shixuns/"+shixunId+"/challenges",bottomvalue:"提交",onSubmits:this.challenge_answer_submit},this.props,this.state,{loadings:false}))));}}]);return TPManswer;}(__WEBPACK_IMPORTED_MODULE_8_react__["Component"]);/* harmony default export */ __webpack_exports__["default"] = (TPManswer);
/***/ })
});