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.
educoder/public/react/dist/static/js/171.f50887f5.chunk.js

1 line
16 KiB

5 years ago
(this.webpackJsonph5=this.webpackJsonph5||[]).push([[171],{2227:function(e,t,a){"use strict";a.r(t),a(260);var s=a(92),n=(a(103),a(47)),l=(a(470),a(462)),r=a(8),o=a(7),i=a(10),c=a(9),u=a(11),m=a(0),p=a.n(m),d=(a(265),a(544),a(781),a(49)),f=a.n(d),y=a(28),_=a(93),b=a(550),q=a(6),E=a.n(q),v={1:"\u5355\u9009\u9898",2:"\u591a\u9009\u9898",3:"\u4e3b\u89c2\u9898"},w={1:"\u672a\u53d1\u5e03",2:"\u63d0\u4ea4\u4e2d",3:"\u5df2\u622a\u6b62"},h=function(e){function t(e){var a;return Object(r.a)(this,t),(a=Object(i.a)(this,Object(c.a)(t).call(this,e))).handleScroll=function(){230<parseInt(window.scrollY)?a.setState({questionPanelFixed:!0}):a.setState({questionPanelFixed:!1})},a.scrollToAnchor=function(e){var t="Anchor_"+e;if(e){var a=document.getElementById(t);a&&a.scrollIntoView()}},a.getInfo=function(){a.setState({courseName:a.props.current_user.course_name});var e=a.props.match.params.pollId,t=a.props.match.params.login,s="/polls/".concat(e,"/start_answer.json?login=").concat(t);E.a.get(s).then((function(e){if(200==e.status){a.setState({poll:e.data.poll,question_answered:e.data.question_answered,question_types:e.data.question_types,questions:e.data.questions});for(var t=[],s=0;s<e.data.questions.length;s++)t.push({id:e.data.questions[s].question.id,text:e.data.questions[s].question.poll_vote_texts||"",is_necessary:e.data.questions[s].question.is_necessary,answers:e.data.questions[s].question.poll_answer_ids,answersList:e.data.questions[s].question.answers});a.setState({inputArray:t})}})).catch((function(e){}))},a.ChangeOptionSingle=function(e){var t=e.target.name,s=Object.assign({},a.state.inputArray[parseInt(t[1])]),n=e.target.value,l=s.answersList.filter((function(e){return e.answer_id==n}));a.postAnswer(t[0],n,"\u5176\u4ed6"==l[0].answer_text?s.text:"",t[1])},a.ChangeOptionMuntil=function(e,t,s){var n=Object.assign({},a.state.inputArray[parseInt(s)]),l=0;e.forEach((function(e){"\u5176\u4ed6"==n.answersList.filter((function(t){return t.answer_id==e}))[0].answer_text&&l++})),a.postAnswer(t,e,0<l?n.text:"",s)},a.postAnswer=function(e,t,s,n){var l="/poll_questions/".concat(e,"/poll_votes.json");E.a.post(l,{poll_answer_id:t,vote_text:s}).then((function(e){if(e){var s=Object.assign({},a.state.question_answered[parseInt(n)]);s.ques_status=e.data.poll_vote.question_status;var l=a.state.question_answered;l[parseInt(n)]=s;var r=Object.assign({},a.state.inputArray[parseInt(n)]);r.answers=t;var o=a.state.inputArray;o[parseInt(n)]=r,a.setState({question_answered:l,inputArray:o})}})).catch((function(e){}))},a.blurTxt=function(e){var t=parseInt(e.target.name),s=Object.assign({},a.state.inputArray[t]);s.text=e.target.value;var n=a.state.inputArray;n[t]=s,a.setState({inputArray:n})},a.saveInputAndAnswer=function(e,t,s,n,l){var r=Object.assign({},a.state.inputArray[parseInt(n)]),o=r.answers,i=!0;o.length?(i=-1<o.indexOf(t),o=1==l?o[0]:o):i=o==t,o&&(0<o.length||""!=o)&&a.postAnswer(s,o,i?r.text:"",n)},a.commitText=function(e,t){var s=Object.assign({},a.state.inputArray[e]).text,n="/poll_questions/"+t+"/poll_votes.json?",l=Object.assign({},a.state.question_answered[e]);l.ques_status=s?1:0;var r=a.state.question_answered;r[e]=l,a.setState({question_answered:r}),null!=s&&E.a.post(n,{vote_text:s}).then((function(t){if(200==t.status){var s=Object.assign({},a.state.question_answered[e]);s.ques_status=t.data.poll_vote.question_status;var n=a.state.question_answered;n[e]=s,a.setState({question_answered:n})}})).catch((function(e){}))},a.submitPoll=function(){for(var e=a.state,t=e.inputArray,s=e.question_answered,n=0,l=0,r=0;r<s.length;r++)0==s[r].ques_status&&(1==t[r].is_necessary?n++:l++);0<n?a.setState({modalsType:!0,modalsTopval:"\u6709 "+n+" \u9898\u5fc5\u7b54\u9898\u672a\u7b54\uff0c\u65e0\u6cd5\u63d0\u4ea4 ",modalsBottomval:"\u8bf7\u5b8c\u6210\u5168\u90e8\u5fc5\u7b54\u9898\u540e\u518d\u63d0\u4ea4",loadtype:!0,modalSave:a.cancelSubmit}):0<=l&&a.setState({modalsType:!0,modalsTopval:0<l?"\u6709 "+l+" \u9898\u672a\u7b54":"",modalsBottomval:"\u63d0\u4ea4\u540e\u65e0\u6cd5\u518d\u4fee\u6539\u7b54\u9898\uff0c\u662f\u5426\u786e\u8ba4\u63d0\u4ea4\uff1f",loadt