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.
NewEduCoderBuild/p__Shixuns__Detail__Challen...

1 line
31 KiB

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[166],{is8o:function(e,t,n){e.exports={flex_box_center:"flex_box_center___45jij",flex_space_between:"flex_space_between___2rBtS",flex_box_vertical_center:"flex_box_vertical_center___B3dEI",flex_box_center_end:"flex_box_center_end___1hlbx",flex_box_column:"flex_box_column___n3oa5",wrap:"wrap___2Ebga",modal:"modal___37ZgF",titleWrap:"titleWrap___dEwT4",required:"required___4a1a5",title:"title___1MHB3",colorGray:"colorGray___1tQ38",choiceWrap:"choiceWrap___2Ik_w",answer:"answer___3N5FQ",activeAnswer:"activeAnswer___3zdHK",deleteIcon:"deleteIcon___U7nIS",addIcon:"addIcon___2tuSF",editorWrap:"editorWrap___ZOK2K",htmlWrap:"htmlWrap___3X_dl",radio:"radio___wS7N0",color333:"color333___S1zDX",color999:"color999___VJwGv",questionType:"questionType___BHDve",questionChoices:"questionChoices___3YAfc"}},kvPc:function(e,t,n){"use strict";n.r(t);n("5Dmo");var r=n("3S7+"),a=(n("P2fV"),n("NJEC")),o=(n("14J3"),n("BMrR")),i=(n("jCWc"),n("kPKH")),c=(n("OaEy"),n("2fM7")),l=(n("7Kak"),n("9yH6")),s=(n("+L6B"),n("2/Rp")),u=(n("5NDa"),n("5rEg")),f=(n("miYZ"),n("tsqr")),h=n("k1fw"),p=n("9og8"),d=(n("y8nQ"),n("Vl3Y")),m=n("tJVT"),v=n("PpiC"),_=n("q1tI"),g=n.n(_),y=n("9kvl"),b=n("Ot1p"),w=n("HBuW"),x=n("oBTY"),E=(n("2qtc"),n("kLXV"),n("Ty5D")),j=(n("V0Rq"),n("9Bee")),O=n("is8o"),L=n.n(O);function N(){N=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof _?t:_,i=Object.create(o.prototype),c=new q(r||[]);return a(i,"_invoke",{value:L(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var h="suspendedStart",p="suspendedYield",d="executing",m="completed",v={};function _(){}function g(){}function y(){}var b={};s(b,i,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(C([])));x&&x!==n&&r.call(x,i)&&(b=x);var E=y.prototype=_.prototype=Object.create(b);function j(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==typeof u&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function L(t,n,r){var a=h;return function(o,i){if(a===d)throw new Error("Generator is already running");if(a===m){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=k(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===h)throw a=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=d;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?m:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=m,r.method="throw",r.arg=s.arg)}}}function k(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,k(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function q(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function C(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return g.prototype=y,a(E,"constructor",{value:y,configurable:!0}),a(y,"constructor",{value:g,configurable:!0}),g.displayName=s(y,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,s(e,l,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},j(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new O(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(E),s(E,l,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=C,q.prototype={constructor:q,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(I),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;I(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:C(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var k=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],S=function(e,t){e.problemset,e.globalSetting,e.loading,e.dispatch,e.onRef;var n=e.editData,a=(Object(v["a"])(e,["problemset","globalSetting","loading","dispatch","onRef","editData"]),Object(_["useState"])([])),c=Object(m["a"])(a,2),l=c[0],s=c[1],u=Object(_["useState"])(),h=Object(m["a"])(u,2),d=h[0],y=h[1],w=Object(_["useState"])([]),O=Object(m["a"])(w,2),S=O[0],I=O[1],q=Object(_["useState"])(""),C=Object(m["a"])(q,2),W=C[0],F=C[1],G=Object(_["useState"])(5),P=Object(m["a"])(G,2),T=(P[0],P[1]),B=Object(_["useState"])(!1),D=Object(m["a"])(B,2),V=D[0],A=D[1];Object(E["m"])();Object(_["useEffect"])((function(){s(["","","",""])}),[]),Object(_["useEffect"])((function(){var e,t;if(null===n||void 0===n?void 0:n.challenge_id){F(null===n||void 0===n?void 0:n.subject),T(parseInt(null===n||void 0===n?void 0:n.question_score)),s(null===n||void 0===n||null===(e=n.choose_contents)||void 0===e?void 0:e.map((function(e){return e.option_name})));var r=[];null===n||void 0===n||null===(t=n.standard_answer)||void 0===t||t.split("").map((function(e,t){r.push(k.indexOf(e))})),I(r)}else A(!0)}),[n]),Object(_["useImperativeHandle"])(t,(function(){return{onSave:z,onReset:R,isEdit:V}}));var R=function(){s(["","","",""]),F(""),I([])},z=function(){var e=Object(p["a"])(N().mark((function e(){var t,n;return N().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(W){e.next=3;break}return f["b"].info("\u8bf7\u60a8\u8f93\u5165\u9898\u76ee"),e.abrupt("return",!1);case 3:if(t=l.findIndex((function(e){return!e})),!(t>-1)){e.next=7;break}return f["b"].info("\u8bf7\u5148\u8f93\u5165 ".concat(k[t]," \u9009\u9879\u7684\u5185\u5bb9")),e.abrupt("return",!1);case 7:if(S.length){e.next=10;break}return f["b"].info("\u8bf7\u8bbe\u7f6e\u672c\u9898\u7684\u6b63\u786e\u7b54\u6848\uff0c\u70b9\u51fb\u9009\u9879A/B...\u5373\u53ef\u5b8c\u6210\u8bbe\u7f6e"),e.abrupt("return",!1);case 10:if(!(S.length<1)){e.next=13;break}return f["b"].info("\u8bf7\u9009\u62e9\u7b54\u6848"),e.abrupt("return",!1);case 13:return n=l.map((function(e,t){return{choice_text:e,is_answer:!!S.includes(t)}})),e.abrupt("return",{subject:W,question:{cnt:n.map((function(e){return e.choice_text}))},choice:{answer:n.map((function(e){return e.is_answer}))}});case 15:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),H=function(){var e;return g.a.createElement("aside",null,g.a.createElement("p",{className:L.a.titleWrap},g.a.createElement("span",{className:L.a.required},"*"),g.a.createElement("span",{className:L.a.title},"\u9898\u5e72\uff1a")),g.a.createElement(b["a"],{id:"single-question-title",watch:!0,height:155,placeholder:"\u8bf7\u60a8\u8f93\u5165\u9898\u5e72",defaultValue:W,onChange:function(e){return F(e)}}),g.a.createElement("p",{className:L.a.titleWrap},g.a.createElement("span",{className:L.a.required},"*"),g.a.createElement("span",{className:L.a.title},"\u7b54\u6848\u9009\u9879\uff1a",g.a.createElement("span",{className:L.a.colorGray},"\u70b9\u51fb\u9009\u9879\u53ef\u8bbe\u7f6e\u6b63\u786e\u7b54\u6848"))),l.map((function(e,t){return g.a.createElement("div",{className:L.a.choiceWrap,key:t},g.a.createElement(r["a"],{title:"\u70b9\u51fb\u8bbe\u7f6e\u4e3a\u6807\u51c6\u7b54\u6848",placement:"left"},g.a.createElement("div",{className:"".concat(L.a.answer," ").concat(S.includes(t)?L.a.activeAnswer:""),onClick:function(){S.includes(t)?I(S.filter((function(e){return e!==t}))):I([].concat(Object(x["a"])(S),[t]))}},k[t])),g.a.createElement("div",{className:L.a.editorWrap},d===t?g.a.createElement(b["a"],{id:"single-question-option-".concat(t),watch:!0,isFocus:!0,height:155,placeholder:"\u8bf7\u60a8\u8f93\u5165\u9009\u9879",defaultValue:e,onChange:function(e){l[t]=e,s(l)}}):g.a.createElement("div",{className:L.a.htmlWrap,onClick:function(){return y(t)}},g.a.createElement(j["a"],{value:e}))),t>1&&g.a.createElement(r["a"],{title:"\u5220\u9664"},g.a.createElement("i",{className:"".concat(L.a.deleteIcon," iconfont icon-htmal5icon19"),onClick:function(){return s(l.filter((function(e,n){return n!==t})))}})),t<7&&t===l.length-1&&g.a.createElement(r["a"],{title:"\u65b0\u589e\u53c2\u8003\u7b54\u6848"},g.a.createElement("i",{className:"".concat(L.a.addIcon," iconfont icon-roundaddfill ml6"),onClick:function(){return s([].concat(Object(x["a"])(l),[""]))}})))})),g.a.createElement(o["a"],{className:"mt10"},g.a.createElement(i["a"],{flex:"1"},g.a.createElement("p",{className:"c-grey-999"},"\u6e29\u99a8\u63d0\u793a\uff1a\u70b9\u51fb\u9009\u9879\u8f93\u5165\u6846\u53ef\u8bbe\u7f6e\u7b54\u6848\uff1b\u9009\u4e2d\u7684\u9009\u9879\u5373\u4e3a\u6b63\u786e\u7b54\u6848\uff0c\u9009\u62e9\u591a\u4e2a\u7b54\u6848\u5373\u4e3a\u591a\u9009\u9898")),g.a.createElement(i["a"],null,"\u6807\u51c6\u7b54\u6848\uff1a",g.a.createElement("span",{className:"c-orange"},null===S||void 0===S||null===(e=S.sort((function(e,t){return e-t})))||void 0===e?void 0:e.map((function(e){return k[e]}))))))};return g.a.createElement("section",{className:L.a.wrap},H())},I=Object(y["a"])((function(e){var t=e.problemset,n=e.loading,r=e.globalSetting;return{problemset:t,globalSetting:r,loading:n.effects}}),null,null,{forwardRef:!0})(Object(_["forwardRef"])(S)),q=n("1vsH"),C=n("zEei"),W=n.n(C),F=n("CJF0"),G=n("2RCv");function P(){P=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var o=t&&t.prototype instanceof _?t:_,i=Object.create(o.prototype),c=new I(r||[]);return a(i,"_invoke",{value:L(e,n,c)}),i}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var h="suspendedStart",p="suspendedYield",d="executing",m="completed",v={};function _(){}function g(){}function y(){}var b={};s(b,i,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(q([])));x&&x!==n&&r.call(x,i)&&(b=x);var E=y.prototype=_.prototype=Object.create(b);function j(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(a,o,i,c){var l=f(e[a],e,o);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==typeof u&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,c)}),(function(e){n("throw",e,i,c)})):t.resolve(u).then((function(e){s.value=e,i(s)}),(function(e){return n("throw",e,i,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return o=o?o.then(a,a):a()}})}function L(t,n,r){var a=h;return function(o,i){if(a===d)throw new Error("Generator is already running");if(a===m){if("throw"===o)throw i;return{value:e,done:!0}}for(r.method=o,r.arg=i;;){var c=r.delegate;if(c){var l=N(c,r);if(l){if(l===v)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===h)throw a=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=d;var s=f(t,n,r);if("normal"===s.type){if(a=r.done?m:p,s.arg===v)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=m,r.method="throw",r.arg=s.arg)}}}function N(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=f(a,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function k(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function q(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,o=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return g.prototype=y,a(E,"constructor",{value:y,configurable:!0}),a(y,"constructor",{value:g,configurable:!0}),g.displayName=s(y,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,s(e,l,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},j(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,a,o){void 0===o&&(o=Promise);var i=new O(u(e,n,r,a),o);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(E),s(E,l,"Generator"),s(E,i,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=q,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(S),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return c.type="throw",c.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,v):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;S(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:q(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}var T={1:[10,20],2:[30,40,50,60],3:[70,80,90,100]},B=function(e){var t,n=e.shixunsDetail,x=e.dispatch,E=(e.loading,e.match),j=e.location,O=Object(v["a"])(e,["shixunsDetail","dispatch","loading","match","location"]),L=d["a"].useForm(),N=Object(m["a"])(L,1),k=N[0],S=Object(_["useState"])({}),C=Object(m["a"])(S,2),B=C[0],D=C[1],V=Object(_["useState"])(!1),A=Object(m["a"])(V,2),R=A[0],z=A[1],H=Object(_["useState"])(!0),J=Object(m["a"])(H,2),Y=J[0],K=J[1],Q=Object(_["useState"])(),M=Object(m["a"])(Q,2),Z=M[0],X=M[1],U=Object(_["useState"])([10,20]),$=Object(m["a"])(U,2),ee=$[0],te=$[1],ne=Object(_["useState"])(!1),re=Object(m["a"])(ne,2),ae=re[0],oe=re[1],ie=Object(_["useState"])({}),ce=Object(m["a"])(ie,2),le=ce[0],se=ce[1],ue=n.challengesEdit,fe=n.editChallengesQuestion,he=Object(_["useRef"])(),pe=function(){var e=Object(p["a"])(P().mark((function e(){var t;return P().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,x({type:"shixunsDetail/getChallengesEdit",payload:Object(h["a"])({},E.params)});case 2:t=e.sent,k.setFieldsValue(Object(h["a"])({},t));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),de=function(){var e=Object(p["a"])(P().mark((function e(){var t;return P().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!E.params.questionId){e.next=7;break}return e.next=3,x({type:"shixunsDetail/getEditChallengesQuestion",payload:Object(h["a"])({},E.params)});case 3:t=e.sent,k.setFieldsValue({challenge_tag:t.tags,difficult:t.difficult,score:t.score,answer:t.answer}),te(T[t.difficult]),se(t);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Object(_["useEffect"])((function(){pe(),E.params.questionId&&(X(!0),de(),z(!0))}),[j.pathname]);var me=function(){var e=Object(p["a"])(P().mark((function e(){var t,n,r;return P().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n="",Object(h["a"])({},B),e.next=4,he.current.onSave();case 4:return r=e.sent,null===(t=r.choice)||void 0===t||t.answer.map((function(e,t){e&&(n+=q["k"][t])})),e.abrupt("return",{challenge_choose:{subject:r.subject,answer:B.task_pass,standard_answer:n,score:B.score,difficult:B.difficult},challenge_tag:B.challenge_tag,question:r.question,choice:r.choice});case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ve=function(e){var t=T[e],n=null===t||void 0===t?void 0:t[0];te(t),k.setFieldsValue({score:n}),D(Object(h["a"])(Object(h["a"])({},k.getFieldsValue()),{score:n}))},_e=function(e,t){D(Object(h["a"])({},k.getFieldsValue())),"difficult"in e&&ve(e.difficult)},ge=function(){var e=Object(p["a"])(P().mark((function e(){var t;return P().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.t0=w["t"],e.t1=h["a"],e.t2=h["a"],e.t3={},e.next=6,me();case 6:return e.t4=e.sent,e.t5=(0,e.t2)(e.t3,e.t4),e.t6=E.params,e.t7=(0,e.t1)(e.t5,e.t6),e.next=12,(0,e.t0)(e.t7);case 12:t=e.sent,1===(null===t||void 0===t?void 0:t.status)&&f["b"].success("\u5220\u9664\u6210\u529f"),O.history.replace("/shixuns/".concat(E.params.id,"/challenges/").concat(E.params.challengesId,"/editquestion"));case 15:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ye=function(){var e=Object(p["a"])(P().mark((function e(t){var n,r,a,o;return P().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(n=Object(h["a"])({},B),oe(!0),Y){e.next=20;break}return e.t0=w["c"],e.t1=h["a"],e.t2=h["a"],e.t3={},e.next=9,me();case 9:return e.t4=e.sent,e.t5=(0,e.t2)(e.t3,e.t4),e.t6=E.params,e.t7=(0,e.t1)(e.t5,e.t6),e.next=15,(0,e.t0)(e.t7);case 15:r=e.sent,oe(!1),r.challenge_choose_id&&(f["b"].success("\u64cd\u4f5c\u6210\u529f"),O.history.replace("/shixuns/".concat(E.params.id,"/challenges/").concat(E.params.challengesId,"/editquestion/").concat(r.challenge_choose_id))),e.next=45;break;case 20:if(!E.params.questionId){e.next=38;break}return e.t8=w["Gb"],e.t9=h["a"],e.t10=h["a"],e.t11={},e.next=27,me();case 27:return e.t12=e.sent,e.t13=(0,e.t10)(e.t11,e.t12),e.t14=E.params,e.t15=(0,e.t9)(e.t13,e.t14),e.next=33,(0,e.t8)(e.t15);case 33:a=e.sent,oe(!1),a.challenge_choose_id&&f["b"].success("\u64cd\u4f5c\u6210\u529f"),e.next=45;break;case 38:return n["identifier"]=E.params.id,n["st"]=1,e.next=42,Object(w["Fb"])(Object(h["a"])(Object(h["a"])({},n),E.params));case 42:o=e.sent,oe(!1),o.challenge_id&&f["b"].success("\u64cd\u4f5c\u6210\u529f");case 45:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),be=function(){var e;return g.a.createElement("div",null,g.a.createElement("div",{className:W.a.fieldWrap},g.a.createElement(d["a"].Item,{name:"subject",label:"\u4efb\u52a1\u540d\u79f0:",rules:[{required:!0,message:"\u8bf7\u8f93\u5165\u4efb\u52a1\u540d\u79f0"}]},g.a.createElement(u["a"],{maxLength:60,suffix:"".concat((null===(e=B.subject)||void 0===e?void 0:e.length)||0,"/60"),placeholder:"\u4f8b\u5982\uff1a\u4ecePython\u7a0b\u5e8f\u8bbe\u8ba1-\u5165\u95e8\u7cbe\u901a"}))),g.a.createElement("div",{className:W.a.mdWrap},g.a.createElement(d["a"].Item,{name:"task_pass",label:"\u8fc7\u5173\u4efb\u52a1:",rules:[{required:!0,message:"\u8bf7\u8f93\u5165\u4f5c\u4e1a\u7684\u7b80\u4ecb"},{max:35e3,message:"\u4f5c\u4e1a\u7b80\u4ecb\u6700\u5927\u9650\u52365000\u4e2a\u5b57\u7b26"}]},g.a.createElement(b["a"],{watch:!0,defaultValue:ue.task_pass}))),g.a.createElement("div",{className:W.a.backgroundFa},g.a.createElement("div",{className:"pt40 mb30"},g.a.createElement(d["a"].Item,null,g.a.createElement(s["a"],{size:"large",type:"primary",className:"".concat(W.a.button," mr20"),htmlType:"submit",loading:ae},"\u63d0\u4ea4"),g.a.createElement(s["a"],{size:"large",type:"primary",ghost:!0,className:W.a.button,onClick:function(){return y["c"].push("/shixuns/".concat(E.params.id,"/challenges"))}},"\u53d6\u6d88")))))},we=function(){var e,t;return g.a.createElement("div",null,g.a.createElement("div",{className:"bg-white"},g.a.createElement(I,{ref:he,editData:le})),g.a.createElement("div",{className:W.a.mdWrap},g.a.createElement(d["a"].Item,{name:"task_pass",label:"\u53c2\u8003\u7b54\u6848:",rules:[{required:!0,message:"\u8bf7\u8f93\u5165\u4f5c\u4e1a\u7684\u7b80\u4ecb"},{max:35e3,message:"\u4f5c\u4e1a\u7b80\u4ecb\u6700\u5927\u9650\u52365000\u4e2a\u5b57\u7b26"}]},g.a.createElement(b["a"],{watch:!0,defaultValue:Y?fe.answer:""})),g.a.createElement(d["a"].Item,{name:"difficult",label:"\u96be\u5ea6\u7cfb\u6570:",rules:[{required:!0,message:"\u8bf7\u9009\u62e9\u96be\u5ea6\u7cfb\u6570"}]},g.a.createElement(l["a"].Group,{disabled:2===(null===(e=n.detail)||void 0===e?void 0:e.shixun_status)},g.a.createElement(l["a"],{value:1},"\u7b80\u5355"),g.a.createElement(l["a"],{value:2},"\u4e2d\u7b49"),g.a.createElement(l["a"],{value:3},"\u56f0\u96be"))),g.a.createElement(o["a"],null,g.a.createElement(i["a"],null,g.a.createElement(d["a"].Item,{name:"score",label:"\u5956\u52b1\u7ecf\u9a8c\u503c:",rules:[{required:!0,message:"\u8bf7\u9009\u62e9\u5956\u52b1\u7ecf\u9a8c\u503c"}]},g.a.createElement(c["a"],{disabled:2===(null===(t=n.detail)||void 0===t?void 0:t.shixun_status)},ee.map((function(e){return g.a.createElement(c["a"].Option,{key:e,value:e},e)}))))),g.a.createElement(i["a"],{flex:1},g.a.createElement("div",{className:"font12 c-light-black ml10 mt20"},"\u5982\u679c\u5b66\u5458\u7b54\u9898\u9519\u8bef\uff0c\u5219\u4e0d\u80fd\u5f97\u5230\u76f8\u5e94\u7684\u7ecf\u9a8c\u503c",g.a.createElement("br",null),"\u5982\u679c\u5b66\u5458\u6210\u529f\u5f97\u5230\u7ecf\u9a8c\u503c\uff0c\u90a3\u4e48\u5c06\u540c\u65f6\u83b7\u5f97\u7b49\u503c\u7684\u91d1\u5e01\u5956\u52b1\uff0c\u5982\uff1a+10\u7ecf\u9a8c\u503c\u3001+10\u91d1\u5e01"))),g.a.createElement(d["a"].Item,{name:"challenge_tag",label:g.a.createElement("div",null,"\u6280\u80fd\u6807\u7b7e ",g.a.createElement("span",{className:"pl20 font12 c-light-black"},"\u5b66\u5458\u7b54\u9898\u6b63\u786e\u5c06\u83b7\u5f97\u6280\u80fd\uff0c\u5426\u5219\u4e0d\u80fd\u83b7\u5f97\u6280\u80fd\uff08\u56de\u8f66\u6dfb\u52a0\u6807\u7b7e\uff09")),rules:[{required:!0,message:"\u8bf7\u9009\u62e9\u6280\u80fd\u6807\u7b7e"}]},g.a.createElement(G["a"],{placeholder:"\u6dfb\u52a0\u6807\u7b7e"}))),g.a.createElement("div",{className:W.a.backgroundFa},g.a.createElement(o["a"],{className:"pt40 mb30"},g.a.createElement(i["a"],{flex:1},g.a.createElement(d["a"].Item,null,g.a.createElement(s["a"],{size:"large",type:"primary",className:"".concat(W.a.button," mr20"),htmlType:"submit",loading:ae},"\u63d0\u4ea4"),g.a.createElement(s["a"],{size:"large",type:"primary",ghost:!0,className:W.a.button,onClick:function(){return y["c"].push("/shixuns/".concat(E.params.id,"/challenges"))}},"\u53d6\u6d88"))),g.a.createElement(i["a"],null,Z&&g.a.createElement(s["a"],{size:"large",ghost:!0,className:"".concat(W.a.button," ").concat(W.a.deleteButton),onClick:ge},"\u5220\u9664")))))};return g.a.createElement("section",{className:W.a.bg},g.a.createElement(F["a"],{data:ue,title:"\u9009\u62e9\u9898"}),g.a.createElement(d["a"],{form:k,className:W.a.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:_e,onFinish:ye,initialValues:{difficult:1,score:10}},g.a.createElement("aside",{className:["bg-white",W.a.navBar].join(" ")},g.a.createElement(a["a"],{title:"\u5207\u6362\u524d\u8bf7\u786e\u8ba4\u5f53\u524d\u9009\u62e9\u9898\u5df2\u63d0\u4ea4\uff0c\u5426\u5219\u4e0d\u4f1a\u4fdd\u5b58\u4f60\u5f53\u524d\u6240\u6709\u8f93\u5165\uff01",onConfirm:function(){y["c"].replace("/shixuns/".concat(E.params.id,"/challenges/").concat(E.params.challengesId,"/editquestion"))}},g.a.createElement("strong",{className:"current"},"\u672c\u5173\u4efb\u52a1")),null===ue||void 0===ue||null===(t=ue.chooses)||void 0===t?void 0:t.map((function(e,t){return g.a.createElement(a["a"],{title:"\u5207\u6362\u524d\u8bf7\u786e\u8ba4\u5f53\u524d\u9009\u62e9\u9898\u5df2\u63d0\u4ea4\uff0c\u5426\u5219\u4e0d\u4f1a\u4fdd\u5b58\u4f60\u5f53\u524d\u6240\u6709\u8f93\u5165\uff01",onConfirm:function(){y["c"].replace("/shixuns/".concat(E.params.id,"/challenges/").concat(E.params.challengesId,"/editquestion/").concat(e.choose_id))}},g.a.createElement("strong",{className:"current ".concat(E.params.questionId==e.choose_id&&Y?W.a.actived:"")},1===e.type?"\u5355\u9009\u9898":"\u591a\u9009\u9898"))})),Y&&g.a.createElement(a["a"],{title:"\u5207\u6362\u524d\u8bf7\u786e\u8ba4\u5f53\u524d\u9009\u62e9\u9898\u5df2\u63d0\u4ea4\uff0c\u5426\u5219\u4e0d\u4f1a\u4fdd\u5b58\u4f60\u5f53\u524d\u6240\u6709\u8f93\u5165\uff01",onConfirm:function(){z(!0),K(!1),se({}),he.current&&he.current.onReset(),k.resetFields()}},g.a.createElement(r["a"],{title:"\u65b0\u589e\u9009\u62e9\u9898"},g.a.createElement("span",{className:W.a.addButton,onClick:function(){}},"+"))),!Y&&g.a.createElement("strong",{className:W.a.actived},"\u9009\u62e9\u9898")),!R&&be(),R&&we()))};t["default"]=Object(y["a"])((function(e){var t=e.shixunsDetail,n=e.newCourse,r=e.loading,a=e.globalSetting;return{shixunsDetail:t,newCourse:n,globalSetting:a,loading:r.effects}}))(B)},zEei:function(e,t,n){e.exports={flex_box_center:"flex_box_center___3trsE",flex_space_between:"flex_space_between___vYNfG",flex_box_vertical_center:"flex_box_vertical_center___267W4",flex_box_center_end:"flex_box_center_end___35F4i",flex_box_column:"flex_box_column___1cLWS",bg:"bg___13rUr",flexRow:"flexRow___geim6",flexJustifyCenter:"flexJustifyCenter___2SLQ2",flexAlignEnd:"flexAlignEnd___2-3OH",flexAlignCenter:"flexAlignCenter___2PK_9",flexColumn:"flexColumn___pc_D1",formWrap:"formWrap___3ozw6",titleWrap:"titleWrap___3JSLu",fieldWrap:"fieldWrap___1M8-z",mdWrap:"mdWrap___3iPl2",backgroundFa:"backgroundFa___2Wd1f",button:"button___3ie7q",icons:"icons___-WSHu",addButton:"addButton___1qx7n",navBar:"navBar___xDlWA",actived:"actived___dZNDy",deleteButton:"deleteButton___3Ethm"}}}]);