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
35 KiB
1 line
35 KiB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[136],{BkJg:function(e,t,n){"use strict";n.r(t),n.d(t,"questionType",(function(){return Z})),n.d(t,"difficultType",(function(){return X}));n("y8nQ");var r=n("Vl3Y"),i=(n("IzEo"),n("bx4M")),a=(n("T2oS"),n("W9HT")),o=(n("/zsF"),n("PArb")),l=(n("sPJy"),n("bE4q")),c=(n("+L6B"),n("2/Rp")),s=n("PpiC"),u=n("9og8"),p=(n("miYZ"),n("tsqr")),f=n("jrin"),d=n("k1fw"),m=n("fWQN"),h=n("mtLc"),y=n("yKVA"),v=n("879j"),g=(n("FJo9"),n("L41K")),b=n("q1tI"),_=n.n(b),E=(n("qVdP"),n("jsC+")),w=(n("7Kak"),n("9yH6")),x=(n("14J3"),n("BMrR")),j=(n("jCWc"),n("kPKH")),L=(n("giR+"),n("fyUT")),O=n("oBTY"),k=(n("lUTK"),n("BvKs")),S=(n("5NDa"),n("5rEg")),F=n("2BaD"),D=n("55Ip"),G=function(){return _.a.createElement("div",{style:{textAlign:"right",fontSize:12,color:"#ccc",marginTop:95}},"\u5982\u8003\u5bdf\u8303\u56f4\u4e0d\u80fd\u6ee1\u8db3\u9700\u6c42\uff0c\u8bf7\u81ea\u884c\u8865\u5145\u8bd5\u9898\u5145\u5b9e\u8003\u5bdf\u8303\u56f4",_.a.createElement(D["Link"],{to:"/problemset",target:"_blank",style:{marginLeft:10,color:"#1890FF"}},"\u73b0\u5728\u5c31\u53bb"))},C=G,V=n("ErOA"),T=n("Eaj2"),N=n.n(T);function I(){I=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(S){c=function(e,t,n){return e[t]=n}}function s(e,t,n,i){var a=t&&t.prototype instanceof f?t:f,o=Object.create(a.prototype),l=new L(i||[]);return r(o,"_invoke",{value:E(e,n,l)}),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(S){return{type:"throw",arg:S}}}e.wrap=s;var p={};function f(){}function d(){}function m(){}var h={};c(h,a,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,a)&&(h=v);var g=m.prototype=f.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(r,a,o,l){var c=u(e[r],e,a);if("throw"!==c.type){var s=c.arg,p=s.value;return p&&"object"==typeof p&&n.call(p,"__await")?t.resolve(p.__await).then((function(e){i("next",e,o,l)}),(function(e){i("throw",e,o,l)})):t.resolve(p).then((function(e){s.value=e,o(s)}),(function(e){return i("throw",e,o,l)}))}l(c.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return k()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var l=w(o,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=u(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=u(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function x(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 j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:k}}function k(){return{value:void 0,done:!0}}return d.prototype=m,r(g,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:d,configurable:!0}),d.displayName=c(m,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(_.prototype),c(_.prototype,o,(function(){return this})),e.AsyncIterator=_,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new _(s(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(g),c(g,l,"Generator"),c(g,a,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var l=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(o)},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),p},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),j(n),p}},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 i=r.arg;j(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}var A=S["a"].TextArea,P=k["a"].SubMenu,B=function(e){return!e||Number.isNaN(Number(e))?"":Math.ceil(e)},R=function(e){Object(y["a"])(n,e);var t=Object(v["a"])(n);function n(){var e;Object(m["a"])(this,n);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return e=t.call.apply(t,[this].concat(i)),e.state={titleLen:0,subDisciplinesList:[],allGroupList:[],selectGroupList:[]},e.componentDidMount=function(){setTimeout(Object(u["a"])(I().mark((function t(){var n;return I().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(!e.props.form){t.next=6;break}return t.next=3,e.setState({subDisciplinesList:e.props.form.getFieldValue("subDisciplines")||[]});case 3:return t.next=5,e.setState({selectGroupList:(null===(n=e.props.form.getFieldValue("group_ids"))||void 0===n?void 0:n.map((function(e){return Object(d["a"])(Object(d["a"])({},e),{},{id:e.id})})))||[]});case 5:e.handleGetGroupByDisciplines(e.props.form.getFieldValue("subDisciplines"));case 6:case"end":return t.stop()}}),t)}))),500)},e.subDisciplinesAdd=function(t){var n=e.props.form.getFieldValue("subDisciplines")||[];if(n.filter((function(e){return t.id===e.id})).length>0)p["b"].error("\u60a8\u5df2\u7ecf\u9009\u62e9\u8fc7\u6b64\u65b9\u5411\uff01");else{var r=[].concat(Object(O["a"])(n),[t]);e.props.form.setFieldsValue({subDisciplines:r}),e.handleGetGroupByDisciplines(r),e.setState({subDisciplinesList:r})}},e.disciplinesRemove=function(t){var n=e.props.form.getFieldValue("subDisciplines")||[],r=n.filter((function(e){return e.id!==t.id}));e.props.form.setFieldsValue({subDisciplines:r}),e.setState({subDisciplinesList:r}),e.handleGetGroupByDisciplines(r)},e.handleSourceRadioChange=function(t){e.props.getdisciplines(t.target.value);var n=[];e.props.form.setFieldsValue({subDisciplines:n}),e.setState({subDisciplinesList:n}),e.handleGetGroupByDisciplines(n)},e.handleGetGroupByDisciplines=Object(u["a"])(I().mark((function t(){var n,r,i,a,o,l,c,s=arguments;return I().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return n=s.length>0&&void 0!==s[0]?s[0]:[],r=e.state.selectGroupList,t.next=4,Object(V["a"])("/api/item_banks_groups/mine.json",{method:"get",params:{sub_discipline_ids:n.map((function(e){return e.id}))}});case 4:i=t.sent,a=(null===i||void 0===i?void 0:i.item_banks_groups)||[],o=Object(O["a"])(new Set(a.map((function(e){return e.id})))),a=a.filter((function(e){return o.includes(e.id)})),e.setState({allGroupList:a}),l=a.map((function(e){return e.id})),c=r.filter((function(e){return l.includes(e.id)})),e.props.form.setFieldsValue({group_ids:c}),e.setState({selectGroupList:c});case 13:case"end":return t.stop()}}),t)}))),e.addGroup=function(t){var n=e.props.form.getFieldValue("group_ids")||[];if(n.find((function(e){return e.id===t.id})))p["b"].error("\u60a8\u5df2\u7ecf\u9009\u62e9\u8fc7\u6b64\u5206\u7ec4\uff01");else{var r=[].concat(Object(O["a"])(n),[t]);e.props.form.setFieldsValue({group_ids:r}),e.setState({selectGroupList:r})}},e.removeGroup=function(t){var n=e.props.form.getFieldValue("group_ids")||[],r=n.filter((function(e){return e.id!==t.id}));e.props.form.setFieldsValue({group_ids:r}),e.setState({selectGroupList:r})},e}return Object(h["a"])(n,[{key:"render",value:function(){var e,t=this;if(!this.props.form)return"";var n=this.props,a=n.disciplines,o=n.form,l=(o.getFieldDecorator,o.getFieldValue),s=this.state,u=s.subDisciplinesList,p=s.allGroupList,f=s.selectGroupList;return _.a.createElement("div",null,_.a.createElement(r["a"].Item,{label:"\u8bd5\u5377\u540d\u79f0:",name:"name",rules:[{required:!0,message:"\u8bd5\u5377\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a"}]},_.a.createElement(S["a"],{style:{height:38},placeholder:"\u8bf7\u8f93\u5165\u8bd5\u5377\u6807\u9898\uff0c\u6700\u591a60\u5b57",suffix:this.state.titleLen+"/60",onChange:function(e){t.setState({titleLen:l("name").length})},maxLength:60})),_.a.createElement(x["a"],{align:"middle"},_.a.createElement(j["a"],null,_.a.createElement(r["a"].Item,{label:"\u8003\u8bd5\u65f6\u957f:",name:"time",rules:[{required:!0,message:"\u8003\u8bd5\u65f6\u957f\u4e0d\u80fd\u4e3a\u7a7a"}]},_.a.createElement(L["a"],{min:1,max:9999,placeholder:"\u8bf7\u8f93\u5165\u8bd5\u5377\u8003\u8bd5\u65f6\u957f",style:{width:150}}))),_.a.createElement(j["a"],{flex:1},_.a.createElement("span",{style:{marginLeft:8,top:2,position:"relative"}},"\u5206\u949f"))),_.a.createElement(r["a"].Item,{label:"\u96be\u5ea6",name:"difficulty",rules:[{required:!0,message:"\u8bf7\u9009\u62e9\u96be\u5ea6"}]},_.a.createElement(w["a"].Group,{style:{display:"flex",width:400,justifyContent:"space-between",marginBottom:6},size:"large",buttonStyle:"solid"},_.a.createElement(w["a"].Button,{style:{width:120,textAlign:"center",borderRadius:50,overflow:"hidden"},value:1},"\u7b80\u5355"),_.a.createElement(w["a"].Button,{style:{width:120,textAlign:"center",borderRadius:50,overflow:"hidden"},value:2},"\u9002\u4e2d"),_.a.createElement(w["a"].Button,{style:{width:120,textAlign:"center",borderRadius:50,overflow:"hidden"},value:3},"\u56f0\u96be"))),_.a.createElement(r["a"].Item,{label:"\u8003\u8bd5\u987b\u77e5",name:"exam_notes"},_.a.createElement(A,{rows:4,maxLength:300})),_.a.createElement(r["a"].Item,{label:"\u8bd5\u9898\u6765\u6e90",name:"source",style:{width:"100%"},extra:_.a.createElement("span",{style:{color:"#999",position:"absolute",left:100,top:"-28px",fontSize:12}},"\uff08\u4e3a\u4fdd\u8bc1\u8003\u5bdf\u51c6\u786e\u6027\uff0c\u5efa\u8bae\u4f7f\u7528\u79c1\u6709\u9898\u5e93\uff09"),rules:[{required:!0,message:"\u8bf7\u9009\u62e9\u8bd5\u9898\u6765\u6e90"}]},_.a.createElement(w["a"].Group,{style:{display:"flex",width:700,justifyContent:"space-between"},onChange:function(e){t.handleSourceRadioChange(e)}},_.a.createElement(w["a"],{value:1},"\u4ec5\u79c1\u6709\u9898\u5e93"),_.a.createElement(w["a"],{value:0},"\u516c\u5171\u9898\u5e93+\u79c1\u6709\u9898\u5e93"))),_.a.createElement(r["a"].Item,{onChange:function(){console.log(l("subDisciplines"))},label:"\u8003\u67e5\u8303\u56f4\uff1a",name:"subDisciplines",rules:[{required:!0,message:"\u8bf7\u9009\u62e9\u8003\u67e5\u8303\u56f4"}]},_.a.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},a.map((function(e){return _.a.createElement(E["a"],{key:"disciplines"+e.id,placement:"bottomLeft",overlay:_.a.createElement("div",null,e.sub_disciplines.length>0?e.sub_disciplines.map((function(n){return _.a.createElement("div",{key:n.id},_.a.createElement(k["a"],{key:n.id,mode:"vertical"},_.a.createElement(P,{popupClassName:e.sub_disciplines.length>10?N.a.subheight:"",title:n.name},Array.isArray(n.tag_disciplines)&&n.tag_disciplines.length?n.tag_disciplines.map((function(e,n){return _.a.createElement(k["a"].Item,{onClick:function(){t.subDisciplinesAdd(e)},key:e.id},_.a.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},_.a.createElement("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},e.name),_.a.createElement("span",null,"personal"===e.type?"\uff08\u81ea\u7528\uff09":"")))})):_.a.createElement(k["a"].Item,null,"\u6682\u65e0\u6570\u636e"))))})):_.a.createElement(i["a"],null,"\u6682\u65e0\u6570\u636e"))},_.a.createElement(c["a"],{style:{marginRight:12,marginTop:6,marginBottom:6}},e.name))})))),u.length>0?_.a.createElement("div",{style:{minHeight:150,backgroundColor:"#FAFAFA"}},_.a.createElement("div",{style:{paddingLeft:12,paddingTop:12}},"\u5df2\u9009"),_.a.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},u.map((function(e){return _.a.createElement("div",{key:"subDisciplinesList"+e.id},_.a.createElement(c["a"],{style:{margin:"12px 6px",backgroundColor:"#F6FFED"},onClick:function(){t.disciplinesRemove(e)}},e.is_default&&_.a.createElement("span",null,e.parent_name," /"),e.name,_.a.createElement(F["a"],null)))})))):null,1==(null===(e=this.props.formValue)||void 0===e?void 0:e.source)&&_.a.createElement(_.a.Fragment,null,!!p.length&&_.a.createElement(r["a"].Item,{label:"\u6240\u5c5e\u5206\u7ec4\uff1a",name:"group_ids"},_.a.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},p.map((function(e){return _.a.createElement(c["a"],{onClick:function(){return t.addGroup(e)},style:{marginRight:12,marginTop:6,marginBottom:6}},e.name)})))),f.length>0?_.a.createElement("div",{style:{minHeight:150,backgroundColor:"#FAFAFA"}},_.a.createElement("div",{style:{paddingLeft:12,paddingTop:12}},"\u5df2\u9009"),_.a.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},f.map((function(e){return _.a.createElement("div",{key:e.id},_.a.createElement(c["a"],{style:{margin:"12px 6px",backgroundColor:"#F6FFED"},onClick:function(){t.removeGroup(e)}},e.name,_.a.createElement(F["a"],null)))})))):null),_.a.createElement(C,null))}}]),n}(_.a.Component),q=R,z=function(e){Object(y["a"])(n,e);var t=Object(v["a"])(n);function n(){return Object(m["a"])(this,n),t.apply(this,arguments)}return Object(h["a"])(n,[{key:"render",value:function(){var e=this.props.form,t=(e.getFieldDecorator,e.getFieldsValue),n=(e.setFieldsValue,this.props.data),i=n.item_type,a=n.items_by_item_type,o=function(e){var t=e.difficult,n=e.count;return _.a.createElement("div",{style:{marginRight:10,lineHeight:"18px"}},_.a.createElement("div",{style:{fontSize:14,textAlign:"left"}},X[t]),_.a.createElement("div",{style:{fontSize:12,color:"#999999"}},"(\u5171 ",n," \u9898\u53ef\u9009)"))},l=t(),c=Object.keys(l).filter((function(e){return e.includes("".concat(i,"-"))&&l[e]})),s=0;return c.map((function(e){return s+=l[e],null})),_.a.createElement("div",null,_.a.createElement("div",null,_.a.createElement("span",{className:"font14"},Z[i]),B(s)>0?_.a.createElement("span",{style:{color:"#999999",fontSize:12}},"\uff08\u5df2\u9009 ",B(s)," \u9898\uff09"):null),a.map((function(e){return _.a.createElement("div",{key:i+e.discipline_id+e.sub_discipline_id},_.a.createElement("div",{style:{fontSize:16,margin:"16px 0px",fontWeight:"500"}},e.discipline_name," / ",e.sub_discipline_name," ",e.tag_discipline_name&&"/".concat(e.tag_discipline_name)),_.a.createElement("div",{className:N.a.formItem},e.items_by_item_type_and_tag_discipline.map((function(t){return _.a.createElement(r["a"].Item,{label:_.a.createElement(o,{count:t.items_count,difficult:t.difficulty}),extra:_.a.createElement("span",{className:N.a.questionTip},"\u9898"),name:"count-".concat(i,"-").concat(e.sub_discipline_id,"-").concat(t.difficulty,"-").concat(e.tag_discipline_id),colon:!1,style:{width:"30%"},initialValue:0,key:"".concat(i,"-").concat(e.sub_discipline_id,"-").concat(t.difficulty)},_.a.createElement(L["a"],{min:0,max:t.items_count,formatter:B}))}))))})))}}]),n}(_.a.Component),M=z,W=function(e){Object(y["a"])(n,e);var t=Object(v["a"])(n);function n(e){var r;return Object(m["a"])(this,n),r=t.call(this,e),r.state={},r}return Object(h["a"])(n,[{key:"render",value:function(){var e=this.props.form,t=this.props.optinalData;return _.a.createElement("div",null,t.map((function(n,r){return _.a.createElement("div",{key:n.item_type},_.a.createElement(M,{form:e,data:n}),r===t.length-1?null:_.a.createElement(o["a"],null))})),_.a.createElement(C,null))}}]),n}(_.a.Component),J=W,U=function(e){var t=e.title,n=e.score;e.totalCount;return _.a.createElement("div",null,t,":",n&&n>0?_.a.createElement("span",{style:{marginLeft:4,color:"#999",fontSize:12}},"(\u5171 ",n," \u5206)"):null)},Y=function(e){Object(y["a"])(n,e);var t=Object(v["a"])(n);function n(e){var r;return Object(m["a"])(this,n),r=t.call(this,e),r.state={},r}return Object(h["a"])(n,[{key:"render",value:function(){if(!this.props.form)return"";var e=this.props.form,t=(e.getFieldDecorator,e.getFieldsValue),n=Object.keys(Z),i=t(),a=0;return _.a.createElement("div",null,n.map((function(e){var t=Object.keys(i).filter((function(t){return t.includes("".concat(e,"-"))&&i[t]})),n=0,o=0;return t.map((function(t){return n+=i[t],o=n*i["score-".concat(e)],null})),a+=o,t.length>0?_.a.createElement(x["a"],{align:"middle"},_.a.createElement(j["a"],null,_.a.createElement(r["a"].Item,{label:_.a.createElement(U,{title:Z[e],score:o,totalCount:n}),name:"score-".concat(e),colon:!1,key:Z[e],rules:[{required:!0,message:"\u5206\u6570\u4e0d\u80fd\u4e3a\u7a7a"}]},_.a.createElement(L["a"],{min:1,max:100,placeholder:"\u8bf7\u8f93\u5165\u8bd5\u9898\u5206\u6570\u8bbe\u7f6e",style:{width:150}}))),_.a.createElement(j["a"],{flex:1},_.a.createElement("span",{style:{marginLeft:8,position:"relative",top:2}},"\u5206/\u9898"))):null})),a&&a>0?_.a.createElement("div",{style:{marginTop:16}},"\u5f53\u524d\u672c\u5377\u603b\u5206",_.a.createElement("span",{style:{color:"#1890FF"}}," ",a," "),"\u5206"):null)}}]),n}(_.a.Component),H=Y;function K(){K=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(S){c=function(e,t,n){return e[t]=n}}function s(e,t,n,i){var a=t&&t.prototype instanceof f?t:f,o=Object.create(a.prototype),l=new L(i||[]);return r(o,"_invoke",{value:E(e,n,l)}),o}function u(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(S){return{type:"throw",arg:S}}}e.wrap=s;var p={};function f(){}function d(){}function m(){}var h={};c(h,a,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==t&&n.call(v,a)&&(h=v);var g=m.prototype=f.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function i(r,a,o,l){var c=u(e[r],e,a);if("throw"!==c.type){var s=c.arg,p=s.value;return p&&"object"==typeof p&&n.call(p,"__await")?t.resolve(p.__await).then((function(e){i("next",e,o,l)}),(function(e){i("throw",e,o,l)})):t.resolve(p).then((function(e){s.value=e,o(s)}),(function(e){return i("throw",e,o,l)}))}l(c.arg)}var a;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){i(e,n,t,r)}))}return a=a?a.then(r,r):r()}})}function E(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return k()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var l=w(o,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=u(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function w(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=u(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function x(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 j(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function O(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:k}}function k(){return{value:void 0,done:!0}}return d.prototype=m,r(g,"constructor",{value:m,configurable:!0}),r(m,"constructor",{value:d,configurable:!0}),d.displayName=c(m,l,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,l,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(_.prototype),c(_.prototype,o,(function(){return this})),e.AsyncIterator=_,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new _(s(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(g),c(g,l,"Generator"),c(g,a,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),e.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}},e.values=O,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(j),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var l=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(o)},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),p},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),j(n),p}},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 i=r.arg;j(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},e}var Q=g["a"].Step,Z={SINGLE:"\u5355\u9009\u9898",MULTIPLE:"\u591a\u9009\u9898",JUDGMENT:"\u5224\u65ad\u9898",COMPLETION:"\u586b\u7a7a\u9898",SUBJECTIVE:"\u7b80\u7b54\u9898",PRACTICAL:"\u5b9e\u8bad\u9898",PROGRAM:"\u7f16\u7a0b\u9898"},X={1:"\u7b80\u5355",2:"\u9002\u4e2d",3:"\u56f0\u96be"},$=function(e){Object(y["a"])(n,e);var t=Object(v["a"])(n);function n(e){var r;return Object(m["a"])(this,n),r=t.call(this,e),r.getPaperData=function(){var e=window.location.href.split("/").pop(),t=[];r.setState({loading:!0}),Object(V["a"])("/api/examination_banks/".concat(e,"/edit_random_exam.json"),{method:"get"}).then((function(e){if(r.setState({loading:!1}),null===e||void 0===e?void 0:e.contents){var n=e.contents,i=e.groups,a=e.examination_bank,o=e.score_settings,l=e.all_sub_disciplines,c=e.all_tag_disciplines,s={},u={};Array.isArray(n)&&n.map((function(e){return s=Object(d["a"])(Object(d["a"])({},s),{},Object(f["a"])({},"count-".concat(e.item_type,"-").concat(e.sub_discipline_id,"-").concat(e.difficulty,"-").concat(e.tag_discipline_id),e.quanlity)),null})),o.map((function(e){return u=Object(d["a"])(Object(d["a"])({},u),{},Object(f["a"])({},"score-".concat(e.item_type),e.score)),null})),c.map((function(e,n){l.map((function(n,r){if((null===e||void 0===e?void 0:e.sub_discipline_id)===(null===n||void 0===n?void 0:n.sub_discipline_id)){var i={id:e.tag_discipline_id,name:e.tag_discipline_name,parent_name:n.sub_discipline_name,is_default:!0};t.push(i)}}))}));var m=Object(d["a"])(Object(d["a"])({},a),{},{subDisciplines:t,group_ids:i});r.state.form.setFieldsValue(m),r.setState({formValue:m}),r.setState({countData:s,scoreData:u});var h=a.source;r.getdisciplines(h)}else p["b"].error("\u83b7\u53d6\u8bd5\u5377\u4fe1\u606f\u9519\u8bef")}))},r.getdisciplines=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t="/api/disciplines.json";Object(V["a"])(t,{params:{source:"question",public:e}}).then((function(e){(null===e||void 0===e?void 0:e.disciplines)&&r.setState({disciplines:e.disciplines})})).catch((function(e){console.log(e)}))},r.getQuestionNumbers=function(){var e;r.setState({loading:!0});var t=r.state.form.getFieldValue("subDisciplines").map((function(e){return e.id})),n=r.state.form.getFieldValue("source");Object(V["a"])("/api/examination_intelligent_settings/optional_items.json",{method:"post",body:{tag_discipline_ids:t,group_ids:null===(e=r.state.form.getFieldValue("group_ids"))||void 0===e?void 0:e.map((function(e){return e.id})),source:1===n?0:2}}).then((function(e){r.setState({loading:!1}),e.contents&&(r.setState({optinalData:e.contents}),r.state.form.setFieldsValue(Object(d["a"])({},r.state.countData)))}))},r.next=Object(u["a"])(K().mark((function e(){var t,n,i,a;return K().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t=r.state.current+1,0!==r.state.current){e.next=8;break}return e.next=4,r.state.form.validateFields(["name","time","difficulty","source","subDisciplines"]);case 4:r.setState({current:t}),r.getQuestionNumbers(),e.next=9;break;case 8:1===r.state.current&&r.idEdit?(r.state.form.setFieldsValue(Object(d["a"])({},r.state.scoreData)),r.setState({current:t})):1===r.state.current&&(n=0,i=r.state.form.getFieldsValue(),i.name,i.difficulty,i.time,i.source,i.subDisciplines,a=Object(s["a"])(i,["name","difficulty","time","source","subDisciplines"]),Object.keys(a).forEach((function(e){a[e]>0&&++n})),0===n?p["b"].error("\u8bf7\u586b\u5199\u9898\u578b\u6570\u91cf"):r.setState({current:t}));case 9:case"end":return e.stop()}}),e)}))),r.prev=function(){var e=r.state.current-1;r.setState({current:e})},r.submit=Object(u["a"])(K().mark((function e(){var t,n,i,a,o,l,c,u,p,f,d;return K().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,r.state.form.validateFields();case 2:t=r.state.form.getFieldsValue(),n=t.exam_notes,i=t.group_ids,a=t.name,o=t.difficulty,l=t.time,c=t.source,u=Object(s["a"])(t,["exam_notes","group_ids","name","difficulty","time","source"]),p=[],f=[],Object.keys(u).map((function(e){if(e.includes("count")){var n=e.split("-")[1],r=e.split("-")[2],i=e.split("-")[3],a=e.split("-")[4];0!==t[e]&&f.push({item_type:n,difficulty:i,sub_discipline_id:r,items_count:t[e],tag_discipline_id:a})}else if(e.includes("score")){var o=e.split("-")[1];p.push({item_type:o,score:t[e]})}return null})),d={name:a,difficulty:o,time:l,source:c,score_settings:p,contents:f,exam_notes:n,group_ids:null===i||void 0===i?void 0:i.map((function(e){return e.id})),sub_discipline_id:0},r.idEdit?r.updatePaper(d):r.createPaper(d);case 9:case"end":return e.stop()}}),e)}))),r.createPaper=function(e){r.setState({loading:!0}),Object(V["a"])("/api/examination_banks/create_random_exam.json",{method:"post",body:Object(d["a"])({},e)}).then((function(e){r.setState({loading:!1}),0===e.status&&(p["b"].success("\u521b\u5efa\u6210\u529f"),r.props.history.push("/paperlibrary"))}))},r.updatePaper=function(e){r.setState({loading:!0});var t=window.location.href.split("/").pop();Object(V["a"])("/api/examination_banks/".concat(t,"/update_random_exam.json"),{method:"post",body:Object(d["a"])({},e)}).then((function(e){r.setState({loading:!1}),0===e.status&&(p["b"].success("\u7f16\u8f91\u6210\u529f"),r.props.history.push("/paperlibrary"))}))},r.confirm=function(e){window.confirm("\u786e\u5b9a\u79bb\u5f00\u6b64\u9875\u9762\u5417?\u6b64\u9875\u6570\u636e\u53ef\u80fd\u4f1a\u4e22\u5931")&&(e?r.props.history.push(e):r.props.history.push("/paperlibrary"))},r.state={current:0,disciplines:[],loading:!1,optinalData:[],countData:{},scoreData:{},formValue:{}},r}return Object(h["a"])(n,[{key:"componentDidMount",value:function(){this.setState({form:this.refs.form}),window.location.href.includes("/randompaper/edit")?(this.getPaperData(),this.idEdit=!0):this.getdisciplines()}},{key:"componentWillMount",value:function(){window.addEventListener("beforeunload",this.beforeunload)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("beforeunload",this.beforeunload)}},{key:"beforeunload",value:function(e){var t="\u786e\u5b9a\u79bb\u5f00\u6b64\u9875\u9762\u5417?\u6b64\u9875\u6570\u636e\u53ef\u80fd\u4f1a\u4e22\u5931";return(e||window.event).returnValue=t,t}},{key:"render",value:function(){var e=this,t=this.state,n=t.current,s=t.disciplines,u=_.a.createElement(c["a"],{onClick:function(){e.confirm()},style:{marginRight:16}},"\u8fd4\u56de"),p=_.a.createElement(c["a"],{type:"primary",onClick:function(){return e.next()}},"\u4e0b\u4e00\u6b65"),f=_.a.createElement(c["a"],{onClick:function(){return e.prev()},style:{marginRight:16}},"\u4e0a\u4e00\u6b65"),m=_.a.createElement(c["a"],{onClick:function(){return e.submit()},type:"primary"},"\u5b8c\u6210\u7ec4\u5377"),h=[{title:"\u57fa\u672c\u4fe1\u606f",content:_.a.createElement(q,{formValue:this.state.formValue,disciplines:s,getdisciplines:this.getdisciplines,form:this.state.form})},{title:"\u9898\u578b\u6570\u91cf",content:_.a.createElement(J,{form:this.state.form,optinalData:this.state.optinalData})},{title:"\u8d4b\u5206\u8bbe\u7f6e",content:_.a.createElement(H,{form:this.state.form})}];return _.a.createElement("div",{style:{width:1200,margin:"0px auto"}},_.a.createElement(l["a"],{separator:">",style:{padding:"12px 0px"}},_.a.createElement(l["a"].Item,null,_.a.createElement(D["Link"],{to:"/paperlibrary",onClick:function(t){t.preventDefault(),e.confirm("/paperlibrary")}},"\u8bd5\u5377\u5e93")),_.a.createElement(l["a"].Item,null,"\u968f\u673a\u7ec4\u5377")),_.a.createElement(r["a"],{from:this.state.form,onValuesChange:function(){return e.setState({formValue:Object(d["a"])({},e.state.form.getFieldsValue())})},ref:"form",name:"basic",layout:"vertical",onChange:function(){e.setState({now:new Date})}},_.a.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},_.a.createElement("span",{style:{fontSize:20,fontWeight:600}},"\u968f\u673a\u7ec4\u5377")),_.a.createElement(i["a"],{style:{marginTop:12}},_.a.createElement("div",{style:{display:"flex",justifyContent:"center",padding:20}},_.a.createElement(g["a"],{current:n,style:{width:780}},h.map((function(e){return _.a.createElement(Q,{key:e.title,title:e.title})})))),_.a.createElement(o["a"],null),_.a.createElement(a["a"],{spinning:this.state.loading},h.map((function(e,t){return _.a.createElement("div",{style:{display:t===n?"block":"none"},key:t,className:"pl20 pr20"},e.content)})))),_.a.createElement("div",{style:{display:"flex",marginBottom:200,marginTop:12,justifyContent:"center"}},_.a.createElement("span",{style:{fontSize:20,fontWeight:600}}),_.a.createElement("span",null,0===n?u:f,n===h.length-1?m:p))))}}]),n}(_.a.Component);t["default"]=$},Eaj2:function(e,t,n){e.exports={flex_box_center:"flex_box_center___d7ZR0",flex_space_between:"flex_space_between___2R86v",flex_box_vertical_center:"flex_box_vertical_center___UB-3r",flex_box_center_end:"flex_box_center_end___ISZAL",flex_box_column:"flex_box_column___3fU_5",formItem:"formItem___76enf",subheight:"subheight___1YMQL"}}}]); |