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__Paperlibrary__Random__Ad...

2 lines
29 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[79],{IoUt:function(K,B,s){K.exports={flex_box_center:"flex_box_center___3N1vU",flex_space_between:"flex_space_between___A7Vod",flex_box_vertical_center:"flex_box_vertical_center___34bDS",flex_box_center_end:"flex_box_center_end___3_uG-",flex_box_column:"flex_box_column___1D2by",wrap:"wrap___3HjzC",contentWrap:"contentWrap___DSAvO",tabsWrap:"tabsWrap___4HtM9",searchWrap:"searchWrap___2Zt2F",searchContent:"searchContent___3NqTR",search:"search___pLAYU",buttonWrap:"buttonWrap___2X_Df",selectBar:"selectBar___3eSji",tableWrap:"tableWrap___wwRLZ",paginationWrap:"paginationWrap___3xt0C",modal:"modal___1KOAK",gap:"gap___2B8M7",checkbox:"checkbox___dUmix",maxHeiTag:"maxHeiTag___1XHFp",buttongroup:"buttongroup___1nTQQ"}},N5Ab:function(K,B,s){K.exports={flex_box_center:"flex_box_center___1hJpS",flex_space_between:"flex_space_between___3fslx",flex_box_vertical_center:"flex_box_vertical_center___2KmoI",flex_box_center_end:"flex_box_center_end___1l8U5",flex_box_column:"flex_box_column___9pIkv",formItem:"formItem___1YUoJ"}},ueiT:function(K,B,s){"use strict";s.r(B),s.d(B,"questionType",function(){return J}),s.d(B,"difficultType",function(){return ye});var ke=s("y8nQ"),F=s("Vl3Y"),We=s("IzEo"),ue=s("bx4M"),Je=s("T2oS"),Re=s("W9HT"),He=s("/zsF"),le=s("PArb"),ze=s("sPJy"),ee=s("bE4q"),$e=s("+L6B"),S=s("2/Rp"),Ue=s("WmNS"),Y=s.n(Ue),de=s("PpiC"),te=s("9og8"),Qe=s("miYZ"),G=s("tsqr"),ce=s("jrin"),A=s("k1fw"),X=s("fWQN"),V=s("mtLc"),k=s("yKVA"),W=s("879j"),Ke=s("FJo9"),me=s("L41K"),Le=s("q1tI"),e=s.n(Le),Ye=s("qVdP"),xe=s("jsC+"),Ze=s("7Kak"),N=s("9yH6"),qe=s("giR+"),ne=s("fyUT"),ae=s("oBTY"),et=s("lUTK"),Z=s("BvKs"),tt=s("5NDa"),_e=s("5rEg"),pe=s("2BaD"),fe=s("55Ip"),je=function(){return e.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",e.a.createElement(fe.Link,{to:"/problemset",target:"_blank",style:{marginLeft:10,color:"#1890FF"}},"\u73B0\u5728\u5C31\u53BB"))},Ee=je,I=s("ErOA"),Pe=s("IoUt"),he=s.n(Pe);function ie(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ie=function(){return U};var U={},x=Object.prototype,h=x.hasOwnProperty,r=typeof Symbol=="function"?Symbol:{},t=r.iterator||"@@iterator",b=r.asyncIterator||"@@asyncIterator",u=r.toStringTag||"@@toStringTag";function i(a,n,d){return Object.defineProperty(a,n,{value:d,enumerable:!0,configurable:!0,writable:!0}),a[n]}try{i({},"")}catch(a){i=function(d,m,y){return d[m]=y}}function l(a,n,d,m){var y=n&&n.prototype instanceof C?n:C,v=Object.create(y.prototype),j=new z(m||[]);return v._invoke=function(M,T,R){var O="suspendedStart";return function(w,ge){if(O==="executing")throw new Error("Generator is already running");if(O==="completed"){if(w==="throw")throw ge;return ve()}for(R.method=w,R.arg=ge;;){var Ce=R.delegate;if(Ce){var se=q(Ce,R);if(se){if(se===c)continue;return se}}if(R.method==="next")R.sent=R._sent=R.arg;else if(R.method==="throw"){if(O==="suspendedStart")throw O="completed",R.arg;R.dispatchException(R.arg)}else R.method==="return"&&R.abrupt("return",R.arg);O="executing";var Q=p(M,T,R);if(Q.type==="normal"){if(O=R.done?"completed":"suspendedYield",Q.arg===c)continue;return{value:Q.arg,done:R.done}}Q.type==="throw"&&(O="completed",R.method="throw",R.arg=Q.arg)}}}(a,d,j),v}function p(a,n,d){try{return{type:"normal",arg:a.call(n,d)}}catch(m){return{type:"throw",arg:m}}}U.wrap=l;var c={};function C(){}function g(){}function E(){}var o={};i(o,t,function(){return this});var _=Object.getPrototypeOf,f=_&&_(_($([])));f&&f!==x&&h.call(f,t)&&(o=f);var L=E.prototype=C.prototype=Object.create(o);function P(a){["next","throw","return"].forEach(function(n){i(a,n,function(d){return this._invoke(n,d)})})}function D(a,n){function d(y,v,j,M){var T=p(a[y],a,v);if(T.type!=="throw"){var R=T.arg,O=R.value;return O&&typeof O=="object"&&h.call(O,"__await")?n.resolve(O.__await).then(function(w){d("next",w,j,M)},function(w){d("throw",w,j,M)}):n.resolve(O).then(function(w){R.value=w,j(R)},function(w){return d("throw",w,j,M)})}M(T.arg)}var m;this._invoke=function(y,v){function j(){return new n(function(M,T){d(y,v,M,T)})}return m=m?m.then(j,j):j()}}function q(a,n){var d=a.iterator[n.method];if(d===void 0){if(n.delegate=null,n.method==="throw"){if(a.iterator.return&&(n.method="return",n.arg=void 0,q(a,n),n.method==="throw"))return c;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}var m=p(d,a.iterator,n.arg);if(m.type==="throw")return n.method="throw",n.arg=m.arg,n.delegate=null,c;var y=m.arg;return y?y.done?(n[a.resultName]=y.value,n.next=a.nextLoc,n.method!=="return"&&(n.method="next",n.arg=void 0),n.delegate=null,c):y:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,c)}function re(a){var n={tryLoc:a[0]};1 in a&&(n.catchLoc=a[1]),2 in a&&(n.finallyLoc=a[2],n.afterLoc=a[3]),this.tryEntries.push(n)}function H(a){var n=a.completion||{};n.type="normal",delete n.arg,a.completion=n}function z(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(re,this),this.reset(!0)}function $(a){if(a){var n=a[t];if(n)return n.call(a);if(typeof a.next=="function")return a;if(!isNaN(a.length)){var d=-1,m=function y(){for(;++d<a.length;)if(h.call(a,d))return y.value=a[d],y.done=!1,y;return y.value=void 0,y.done=!0,y};return m.next=m}}return{next:ve}}function ve(){return{value:void 0,done:!0}}return g.prototype=E,i(L,"constructor",E),i(E,"constructor",g),g.displayName=i(E,u,"GeneratorFunction"),U.isGeneratorFunction=function(a){var n=typeof a=="function"&&a.constructor;return!!n&&(n===g||(n.displayName||n.name)==="GeneratorFunction")},U.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,E):(a.__proto__=E,i(a,u,"GeneratorFunction")),a.prototype=Object.create(L),a},U.awrap=function(a){return{__await:a}},P(D.prototype),i(D.prototype,b,function(){return this}),U.AsyncIterator=D,U.async=function(a,n,d,m,y){y===void 0&&(y=Promise);var v=new D(l(a,n,d,m),y);return U.isGeneratorFunction(n)?v:v.next().then(function(j){return j.done?j.value:v.next()})},P(L),i(L,u,"Generator"),i(L,t,function(){return this}),i(L,"toString",function(){return"[object Generator]"}),U.keys=function(a){var n=[];for(var d in a)n.push(d);return n.reverse(),function m(){for(;n.length;){var y=n.pop();if(y in a)return m.value=y,m.done=!1,m}return m.done=!0,m}},U.values=$,z.prototype={constructor:z,reset:function(n){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(H),!n)for(var d in this)d.charAt(0)==="t"&&h.call(this,d)&&!isNaN(+d.slice(1))&&(this[d]=void 0)},stop:function(){this.done=!0;var n=this.tryEntries[0].completion;if(n.type==="throw")throw n.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var d=this;function m(R,O){return j.type="throw",j.arg=n,d.next=R,O&&(d.method="next",d.arg=void 0),!!O}for(var y=this.tryEntries.length-1;y>=0;--y){var v=this.tryEntries[y],j=v.completion;if(v.tryLoc==="root")return m("end");if(v.tryLoc<=this.prev){var M=h.call(v,"catchLoc"),T=h.call(v,"finallyLoc");if(M&&T){if(this.prev<v.catchLoc)return m(v.catchLoc,!0);if(this.prev<v.finallyLoc)return m(v.finallyLoc)}else if(M){if(this.prev<v.catchLoc)return m(v.catchLoc,!0)}else{if(!T)throw new Error("try statement without catch or finally");if(this.prev<v.finallyLoc)return m(v.finallyLoc)}}}},abrupt:function(n,d){for(var m=this.tryEntries.length-1;m>=0;--m){var y=this.tryEntries[m];if(y.tryLoc<=this.prev&&h.call(y,"finallyLoc")&&this.prev<y.finallyLoc){var v=y;break}}v&&(n==="break"||n==="continue")&&v.tryLoc<=d&&d<=v.finallyLoc&&(v=null);var j=v?v.completion:{};return j.type=n,j.arg=d,v?(this.method="next",this.next=v.finallyLoc,c):this.complete(j)},complete:function(n,d){if(n.type==="throw")throw n.arg;return n.type==="break"||n.type==="continue"?this.next=n.arg:n.type==="return"?(this.rval=this.arg=n.arg,this.method="return",this.next="end"):n.type==="normal"&&d&&(this.next=d),c},finish:function(n){for(var d=this.tryEntries.length-1;d>=0;--d){var m=this.tryEntries[d];if(m.finallyLoc===n)return this.complete(m.completion,m.afterLoc),H(m),c}},catch:function(n){for(var d=this.tryEntries.length-1;d>=0;--d){var m=this.tryEntries[d];if(m.tryLoc===n){var y=m.completion;if(y.type==="throw"){var v=y.arg;H(m)}return v}}throw new Error("illegal catch attempt")},delegateYield:function(n,d,m){return this.delegate={iterator:$(n),resultName:d,nextLoc:m},this.method==="next"&&(this.arg=void 0),c}},U}var De=_e.a.TextArea,Oe=Z.a.SubMenu,oe=function(x){return!x||Number.isNaN(Number(x))?"":Math.ceil(x)},Ae=function(U){Object(k.a)(h,U);var x=Object(W.a)(h);function h(){var r;Object(X.a)(this,h);for(var t=arguments.length,b=new Array(t),u=0;u<t;u++)b[u]=arguments[u];return r=x.call.apply(x,[this].concat(b)),r.state={titleLen:0,subDisciplinesList:[],allGroupList:[],selectGroupList:[]},r.subDisciplinesAdd=function(i){var l=r.props.form.getFieldValue("subDisciplines")||[];if(l.filter(function(c){return i.id===c.id}).length>0)G.b.error("\u60A8\u5DF2\u7ECF\u9009\u62E9\u8FC7\u6B64\u65B9\u5411\uFF01");else{var p=[].concat(Object(ae.a)(l),[i]);r.props.form.setFieldsValue({subDisciplines:p}),r.setState({subDisciplinesList:p})}},r.disciplinesRemove=function(i){var l=r.props.form.getFieldValue("subDisciplines")||[],p=l.filter(function(c){return c.id!==i.id});r.props.form.setFieldsValue({subDisciplines:p}),r.setState({subDisciplinesList:p})},r.handleSourceRadioChange=function(i){r.props.getdisciplines(i.target.value);var l=[];r.props.form.setFieldsValue({subDisciplines:l}),r.setState({subDisciplinesList:l})},r.handleGetGroupByDisciplines=Object(te.a)(ie().mark(function i(){var l,p,c,C,g,E,o,_=arguments;return ie().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:return l=_.length>0&&_[0]!==void 0?_[0]:[],console.log("xjx disciplines: ",l),p=r.state.selectGroupList,L.next=5,Object(I.a)("/api/item_banks_groups/mine.json",{method:"get"});case 5:c=L.sent,C=(c==null?void 0:c.item_banks_groups)||[],g=Object(ae.a)(new Set(C.map(function(P){return P.id}))),C=C.filter(function(P){return g.includes(P.id)}),r.setState({allGroupList:C}),E=C.map(function(P){return P.id}),o=p.filter(function(P){return E.includes(P.id)}),r.props.form.setFieldsValue({group_ids:o}),r.setState({selectGroupList:o});case 14:case"end":return L.stop()}},i)})),r.addGroup=function(i){var l=r.props.form.getFieldValue("group_ids")||[];if(l.find(function(c){return c.id===i.id})){G.b.error("\u60A8\u5DF2\u7ECF\u9009\u62E9\u8FC7\u6B64\u5206\u7EC4\uFF01");return}var p=[].concat(Object(ae.a)(l),[i]);r.props.form.setFieldsValue({group_ids:p}),r.setState({selectGroupList:p})},r.removeGroup=function(i){var l=r.props.form.getFieldValue("group_ids")||[],p=l.filter(function(c){return c.id!==i.id});r.props.form.setFieldsValue({group_ids:p}),r.setState({selectGroupList:p})},r}return Object(V.a)(h,[{key:"componentDidMount",value:function(){this.handleGetGroupByDisciplines()}},{key:"render",value:function(){var t=this;if(!this.props.form)return"";var b=this.props,u=b.disciplines,i=b.form,l=i.getFieldDecorator,p=i.getFieldValue,c=this.state,C=c.subDisciplinesList,g=c.allGroupList,E=c.selectGroupList;return e.a.createElement("div",null,e.a.createElement(F.a.Item,{label:"\u8BD5\u5377\u540D\u79F0:",name:"name",rules:[{required:!0,message:"\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"}]},e.a.createElement(_e.a,{style:{height:38},placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u591A60\u5B57",suffix:this.state.titleLen+"/60",onChange:function(_){t.setState({titleLen:p("name").length})},maxLength:60})),e.a.createElement(F.a.Item,{label:"\u8003\u8BD5\u65F6\u957F:",name:"time",rules:[{required:!0,message:"\u8003\u8BD5\u65F6\u957F\u4E0D\u80FD\u4E3A\u7A7A"}]},e.a.createElement("div",null,e.a.createElement(ne.a,{min:1,max:9999,placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u8003\u8BD5\u65F6\u957F",style:{width:150}}),e.a.createElement("span",{style:{marginLeft:8}},"\u5206\u949F"))),e.a.createElement(F.a.Item,{label:"\u96BE\u5EA6",name:"difficulty",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u5EA6"}]},e.a.createElement(N.a.Group,{className:he.a.buttongroup,size:"large"},e.a.createElement(N.a.Button,{style:{width:120,textAlign:"center",borderRadius:50},value:1},"\u7B80\u5355"),e.a.createElement(N.a.Button,{style:{width:120,textAlign:"center",borderRadius:50},value:2},"\u9002\u4E2D"),e.a.createElement(N.a.Button,{style:{width:120,textAlign:"center",borderRadius:50},value:3},"\u56F0\u96BE"))),e.a.createElement(F.a.Item,{label:"\u8003\u8BD5\u987B\u77E5",name:"exam_notes"},e.a.createElement(De,{rows:4,maxLength:300})),e.a.createElement(F.a.Item,{label:"\u8BD5\u9898\u6765\u6E90",name:"source",style:{width:"100%"},extra:e.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"}],initialValue:1},e.a.createElement(N.a.Group,{style:{display:"flex",width:700,justifyContent:"space-between"},onChange:function(_){t.handleSourceRadioChange(_)}},e.a.createElement(N.a,{value:1},"\u4EC5\u79C1\u6709\u9898\u5E93"),e.a.createElement(N.a,{value:0},"\u516C\u5171\u9898\u5E93+\u79C1\u6709\u9898\u5E93"))),e.a.createElement(F.a.Item,{onChange:function(){console.log(p("subDisciplines"))},label:"\u8003\u67E5\u8303\u56F4\uFF1A",name:"subDisciplines",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u8003\u67E5\u8303\u56F4"}]},e.a.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},u.map(function(o){return e.a.createElement(xe.a,{key:"disciplines"+o.id,placement:"bottomLeft",overlay:e.a.createElement("div",null,o.sub_disciplines.length>0?o.sub_disciplines.map(function(_){var f;return e.a.createElement(Z.a,{key:_.id,mode:"vertical"},e.a.createElement(Oe,{title:_.name,popupClassName:((f=_.tag_disciplines)===null||f===void 0?void 0:f.length)>10?he.a.maxHeiTag:""},Array.isArray(_.tag_disciplines)&&!!_.tag_disciplines.length?_.tag_disciplines.map(function(L,P){return e.a.createElement(Z.a.Item,{onClick:function(){t.subDisciplinesAdd(L)},key:L.id},e.a.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},e.a.createElement("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},L.name),e.a.createElement("span",null,L.type==="personal"?"\uFF08\u81EA\u7528\uFF09":"")))}):e.a.createElement(Z.a.Item,null,"\u6682\u65E0\u6570\u636E")))}):e.a.createElement(ue.a,null,"\u6682\u65E0\u6570\u636E"))},e.a.createElement(S.a,{style:{marginRight:12,marginTop:6,marginBottom:6}},o.name))}))),C.length>0?e.a.createElement("div",{style:{minHeight:150,backgroundColor:"#FAFAFA"}},e.a.createElement("div",{style:{paddingLeft:12,paddingTop:12}},"\u5DF2\u9009"),e.a.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},C.map(function(o){return e.a.createElement("div",{key:"subDisciplinesList"+o.id},e.a.createElement(S.a,{style:{margin:"12px 6px",backgroundColor:"#F6FFED"},onClick:function(){t.disciplinesRemove(o)}},o.is_default&&e.a.createElement("span",null,o.parent_name," /"),o.name,e.a.createElement(pe.a,null)))}))):null,!!g.length&&e.a.createElement(F.a.Item,{label:"\u6240\u5C5E\u5206\u7EC4\uFF1A\uFF08\u5982\u9009\u62E9\u5206\u7EC4\uFF0C\u5219\u7CFB\u7EDF\u53D6\u60A8\u9009\u4E2D\u7684\u5206\u7EC4\u548C\u8003\u67E5\u8303\u56F4\u4E2D\u7684\u9898\u7684\u5E76\u96C6\u4F5C\u4E3A\u968F\u673A\u5BF9\u8C61\u3002\uFF09",name:"group_ids"},e.a.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},g.map(function(o){return e.a.createElement(S.a,{onClick:function(){return t.addGroup(o)},style:{marginRight:12,marginTop:6,marginBottom:6}},o.name)}))),E.length>0?e.a.createElement("div",{style:{minHeight:150,backgroundColor:"#FAFAFA"}},e.a.createElement("div",{style:{paddingLeft:12,paddingTop:12}},"\u5DF2\u9009"),e.a.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},E.map(function(o){return e.a.createElement("div",{key:o.group_id},e.a.createElement(S.a,{style:{margin:"12px 6px",backgroundColor:"#F6FFED"},onClick:function(){t.removeGroup(o)}},o.name,e.a.createElement(pe.a,null)))}))):null,e.a.createElement(Ee,null))}}]),h}(e.a.Component),Me=Ae,Fe=s("N5Ab"),be=s.n(Fe),Te=function(U){Object(k.a)(h,U);var x=Object(W.a)(h);function h(){return Object(X.a)(this,h),x.apply(this,arguments)}return Object(V.a)(h,[{key:"render",value:function(){var t=this.props.form,b=t.getFieldDecorator,u=t.getFieldsValue,i=t.setFieldsValue,l=this.props.data,p=l.item_type,c=l.items_by_item_type,C=function(f){var L=f.difficult,P=f.count;return e.a.createElement("div",{style:{marginRight:10,lineHeight:"18px"}},e.a.createElement("div",{style:{fontSize:14,textAlign:"left"}},ye[L]),e.a.createElement("div",{style:{fontSize:12,color:"#999999"}},"(\u5171 ",P," \u9898\u53EF\u9009)"))},g=u(),E=Object.keys(g).filter(function(_){return _.includes("".concat(p,"-"))&&g[_]}),o=0;return E.map(function(_){return o+=g[_],null}),e.a.createElement("div",null,e.a.createElement("div",null,e.a.createElement("span",{className:"font14"},J[p]),oe(o)>0?e.a.createElement("span",{style:{color:"#999999",fontSize:12}},"\uFF08\u5DF2\u9009 ",oe(o)," \u9898\uFF09"):null),c.map(function(_){return e.a.createElement("div",{key:p+_.discipline_id+_.sub_discipline_id},e.a.createElement("div",{style:{fontSize:16,margin:"16px 0px",fontWeight:"500"}},_.discipline_name," / ",_.sub_discipline_name," ",_.tag_discipline_name&&"/".concat(_.tag_discipline_name)),e.a.createElement("div",{className:be.a.formItem},_.items_by_item_type_and_tag_discipline.map(function(f){return e.a.createElement(F.a.Item,{label:e.a.createElement(C,{count:f.items_count,difficult:f.difficulty}),extra:e.a.createElement("span",{className:be.a.questionTip},"\u9898"),name:"count-".concat(p,"-").concat(_.sub_discipline_id,"-").concat(f.difficulty,"-").concat(_.tag_discipline_id),colon:!1,style:{width:"30%"},initialValue:0,key:"".concat(p,"-").concat(_.sub_discipline_id,"-").concat(f.difficulty)},e.a.createElement(ne.a,{min:0,max:f.items_count,formatter:oe}))})))}))}}]),h}(e.a.Component),we=Te,nt=[{item_type:"MULTIPLE",items_by_item_type:[{sub_discipline_id:12,sub_discipline_name:"Java\u7A0B\u5E8F\u8BBE\u8BA1",discipline_id:7,discipline_name:"\u7A0B\u5E8F\u8BBE\u8BA1\u8BED\u8A00",items_by_item_type_and_sub_discipline:[{difficulty:1,items_count:3}]}]},{item_type:"SINGLE",items_by_item_type:[{sub_discipline_id:12,sub_discipline_name:"Java\u7A0B\u5E8F\u8BBE\u8BA1",discipline_id:7,discipline_name:"\u7A0B\u5E8F\u8BBE\u8BA1\u8BED\u8A00",items_by_item_type_and_sub_discipline:[{difficulty:1,items_count:10}]}]},{item_type:"JUDGMENT",items_by_item_type:[{sub_discipline_id:12,sub_discipline_name:"Java\u7A0B\u5E8F\u8BBE\u8BA1",discipline_id:7,discipline_name:"\u7A0B\u5E8F\u8BBE\u8BA1\u8BED\u8A00",items_by_item_type_and_sub_discipline:[{difficulty:1,items_count:2}]}]},{item_type:"PROGRAM",items_by_item_type:[{sub_discipline_id:13,sub_discipline_name:"\u4FE1\u53F7\u4E0E\u7CFB\u7EDF",discipline_id:8,discipline_name:"\u7535\u5B50\u6280\u672F",items_by_item_type_and_sub_discipline:[{difficulty:1,items_count:1}]},{sub_discipline_id:12,sub_discipline_name:"Java\u7A0B\u5E8F\u8BBE\u8BA1",discipline_id:7,discipline_name:"\u7A0B\u5E8F\u8BBE\u8BA1\u8BED\u8A00",items_by_item_type_and_sub_discipline:[{difficulty:1,items_count:4}]},{sub_discipline_id:26,sub_discipline_name:"Python\u7A0B\u5E8F\u8BBE\u8BA1",discipline_id:7,discipline_name:"\u7A0B\u5E8F\u8BBE\u8BA1\u8BED\u8A00",items_by_item_type_and_sub_discipline:[{difficulty:1,items_count:1}]},{sub_discipline_id:23,sub_discipline_name:"Java\u7A0B\u5E8F\u8BBE\u8BA1",discipline_id:7,discipline_name:"\u7A0B\u5E8F\u8BBE\u8BA1\u8BED\u8A00",items_by_item_type_and_sub_discipline:[{difficulty:1,items_count:1}]}]}],Se=function(U){Object(k.a)(h,U);var x=Object(W.a)(h);function h(r){var t;return Object(X.a)(this,h),t=x.call(this,r),t.state={},t}return Object(V.a)(h,[{key:"render",value:function(){var t=this.props.form,b=this.props.optinalData;return e.a.createElement("div",null,b.map(function(u,i){return e.a.createElement("div",{key:u.item_type},e.a.createElement(we,{form:t,data:u}),i===b.length-1?null:e.a.createElement(le.a,null))}),e.a.createElement(Ee,null))}}]),h}(e.a.Component),Ne=Se,Be=function(x){var h=x.title,r=x.score,t=x.totalCount;return e.a.createElement("div",null,h,":",r&&r>0?e.a.createElement("span",{style:{marginLeft:4,color:"#999",fontSize:12}},"(\u5171 ",r," \u5206)"):null)},Ge=function(U){Object(k.a)(h,U);var x=Object(W.a)(h);function h(r){var t;return Object(X.a)(this,h),t=x.call(this,r),t.state={},t}return Object(V.a)(h,[{key:"render",value:function(){if(!this.props.form)return"";var t=this.props.form,b=t.getFieldDecorator,u=t.getFieldsValue,i=Object.keys(J),l=u(),p=0;return e.a.createElement("div",null,i.map(function(c){var C=Object.keys(l).filter(function(o){return o.includes("".concat(c,"-"))&&l[o]}),g=0,E=0;return C.map(function(o){return g+=l[o],E=g*l["score-".concat(c)],null}),p+=E,C.length>0?e.a.createElement(F.a.Item,{label:e.a.createElement(Be,{title:J[c],score:E,totalCount:g}),name:"score-".concat(c),colon:!1,key:J[c],rules:[{required:!0,message:"\u5206\u6570\u4E0D\u80FD\u4E3A\u7A7A"}]},e.a.createElement("div",null,e.a.createElement(ne.a,{min:1,max:100,placeholder:"\u8BF7\u8F93\u5165\u8BD5\u9898\u5206\u6570\u8BBE\u7F6E",style:{width:150}}),e.a.createElement("span",{style:{marginLeft:8}},"\u5206/\u9898"))):null}),p&&p>0?e.a.createElement("div",{style:{marginTop:16}},"\u5F53\u524D\u672C\u5377\u603B\u5206",e.a.createElement("span",{style:{color:"#1890FF"}}," ",p," "),"\u5206"):null)}}]),h}(e.a.Component),Ie=Ge,Xe=me.a.Step,J={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"},ye={1:"\u7B80\u5355",2:"\u9002\u4E2D",3:"\u56F0\u96BE"},Ve=function(U){Object(k.a)(h,U);var x=Object(W.a)(h);function h(r){var t;return Object(X.a)(this,h),t=x.call(this,r),t.getPaperData=function(){var b=window.location.href.split("/").pop();t.setState({loading:!0}),Object(I.a)("/examination_banks/".concat(b,"/edit_random_exam.json")).then(function(u){if(t.setState({loading:!1}),u.status===200){var i=u.data,l=i.contents,p=i.examination_bank,c=i.score_settings,C=i.all_sub_disciplines,g={},E={};l.map(function(f){return g=Object(A.a)(Object(A.a)({},g),{},Object(ce.a)({},"count-".concat(f.item_type,"-").concat(f.sub_discipline_id,"-").concat(f.difficulty,"-").concat(f.tag_discipline_id),f.quanlity)),null}),c.map(function(f){return E=Object(A.a)(Object(A.a)({},E),{},Object(ce.a)({},"score-".concat(f.item_type),f.score)),null});var o=Object(A.a)(Object(A.a)({},p),{},{subDisciplines:C.map(function(f){return{id:f.sub_discipline_id,name:f.sub_discipline_name}}),group_ids:groups});t.state.form.setFieldsValue(o),t.setState({formValue:o}),t.setState({countData:g,scoreData:E});var _=p.source;t.getdisciplines(_)}else G.b.error("\u83B7\u53D6\u8BD5\u5377\u4FE1\u606F\u9519\u8BEF")})},t.getdisciplines=function(){var b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,u="/api/disciplines.json";Object(I.a)(u,{params:{source:"question",public:b}}).then(function(i){(i==null?void 0:i.disciplines)&&t.setState({disciplines:i.disciplines})}).catch(function(i){console.log(i)})},t.getQuestionNumbers=function(){var b;t.setState({loading:!0});var u=t.state.form.getFieldValue("subDisciplines").map(function(l){return l.id}),i=t.state.form.getFieldValue("source");Object(I.a)("/api/examination_intelligent_settings/optional_items.json",{method:"post",body:{tag_discipline_ids:u,group_ids:(b=t.state.form.getFieldValue("group_ids"))===null||b===void 0?void 0:b.map(function(l){return l.id}),source:i===1?0:2}}).then(function(l){t.setState({loading:!1}),l.contents&&(t.setState({optinalData:l.contents}),t.state.form.setFieldsValue(Object(A.a)({},t.state.countData)))})},t.next=Object(te.a)(Y.a.mark(function b(){var u,i,l,p,c,C,g,E,o;return Y.a.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:if(u=t.state.current+1,console.log(t.form,t.refs.form.getFieldValue()),!(t.state.current===0)){f.next=9;break}return f.next=5,t.state.form.validateFields(["name","time","difficulty","source","subDisciplines"]);case 5:t.setState({current:u}),t.getQuestionNumbers(),f.next=10;break;case 9:t.state.current===1&&t.idEdit?(t.state.form.setFieldsValue(Object(A.a)({},t.state.scoreData)),t.setState({current:u})):t.state.current===1&&(i=0,l=t.state.form.getFieldsValue(),p=l.name,c=l.difficulty,C=l.time,g=l.source,E=l.subDisciplines,o=Object(de.a)(l,["name","difficulty","time","source","subDisciplines"]),Object.keys(o).forEach(function(L){o[L]>0&&++i}),i===0?G.b.error("\u8BF7\u586B\u5199\u9898\u578B\u6570\u91CF"):t.setState({current:u}));case 10:case"end":return f.stop()}},b)})),t.prev=function(){var b=t.state.current-1;t.setState({current:b})},t.submit=Object(te.a)(Y.a.mark(function b(){var u,i,l,p,c,C,g,E,o,_,f;return Y.a.wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return P.next=2,t.state.form.validateFields();case 2:u=t.state.form.getFieldsValue(),console.log("data:===> ",u),i=u.exam_notes,l=u.group_ids,p=u.name,c=u.difficulty,C=u.time,g=u.source,E=Object(de.a)(u,["exam_notes","group_ids","name","difficulty","time","source"]),console.log("others: ",E),o=[],_=[],Object.keys(E).map(function(D){if(D.includes("count")){var q=D.split("-")[1],re=D.split("-")[2],H=D.split("-")[3],z=D.split("-")[4];u[D]!==0&&_.push({item_type:q,difficulty:H,sub_discipline_id:re,items_count:u[D],tag_discipline_id:z})}else if(D.includes("score")){var $=D.split("-")[1];o.push({item_type:$,score:u[D]})}return null}),f={name:p,difficulty:c,time:C,source:g,score_settings:o,contents:_,exam_notes:i,group_ids:l==null?void 0:l.map(function(D){return D.id}),sub_discipline_id:0},t.idEdit?t.updatePaper(f):t.createPaper(f);case 11:case"end":return P.stop()}},b)})),t.createPaper=function(b){t.setState({loading:!0}),Object(I.a)("/api/examination_banks/create_random_exam.json",{method:"post",body:Object(A.a)({},b)}).then(function(u){t.setState({loading:!1}),u.status===0&&(G.b.success("\u521B\u5EFA\u6210\u529F"),t.props.history.push("/paperlibrary"))})},t.updatePaper=function(b){t.setState({loading:!0});var u=window.location.href.split("/").pop();I.a.post("/examination_banks/".concat(u,"/update_random_exam.json"),{method:"post",body:Object(A.a)({},b)}).then(function(i){t.setState({loading:!1}),i.status===0&&(G.b.success("\u7F16\u8F91\u6210\u529F"),t.props.history.push("/paperlibrary"))})},t.confirm=function(b){window.confirm("\u786E\u5B9A\u79BB\u5F00\u6B64\u9875\u9762\u5417?\u6B64\u9875\u6570\u636E\u53EF\u80FD\u4F1A\u4E22\u5931")&&(b?t.props.history.push(b):t.props.history.push("/paperlibrary"))},t.state={current:0,disciplines:[],loading:!1,optinalData:[],countData:{},scoreData:{},formValue:{}},t}return Object(V.a)(h,[{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(t){var b="\u786E\u5B9A\u79BB\u5F00\u6B64\u9875\u9762\u5417?\u6B64\u9875\u6570\u636E\u53EF\u80FD\u4F1A\u4E22\u5931";return(t||window.event).returnValue=b,b}},{key:"render",value:function(){var t=this,b=this.state,u=b.current,i=b.disciplines,l=e.a.createElement(S.a,{onClick:function(){t.confirm()},style:{marginRight:16}},"\u8FD4\u56DE"),p=e.a.createElement(S.a,{type:"primary",onClick:function(){return t.next()}},"\u4E0B\u4E00\u6B65"),c=e.a.createElement(S.a,{onClick:function(){return t.prev()},style:{marginRight:16}},"\u4E0A\u4E00\u6B65"),C=e.a.createElement(S.a,{onClick:function(){return t.submit()},type:"primary"},"\u5B8C\u6210\u7EC4\u5377"),g=[{title:"\u57FA\u672C\u4FE1\u606F",content:e.a.createElement(Me,{formValue:this.state.formValue,disciplines:i,getdisciplines:this.getdisciplines,form:this.state.form})},{title:"\u9898\u578B\u6570\u91CF",content:e.a.createElement(Ne,{form:this.state.form,optinalData:this.state.optinalData})},{title:"\u8D4B\u5206\u8BBE\u7F6E",content:e.a.createElement(Ie,{form:this.state.form})}];return e.a.createElement("div",{style:{width:1200,margin:"0px auto"}},e.a.createElement(ee.a,{separator:">",style:{padding:"12px 0px"}},e.a.createElement(ee.a.Item,null,e.a.createElement(fe.Link,{to:"/paperlibrary",onClick:function(o){o.preventDefault(),t.confirm("/paperlibrary")}},"\u8BD5\u5377\u5E93")),e.a.createElement(ee.a.Item,null,"\u968F\u673A\u7EC4\u5377")),e.a.createElement(F.a,{from:this.state.form,onValuesChange:function(){return t.setState({formValue:Object(A.a)({},t.state.form.getFieldsValue())})},ref:"form",name:"basic",layout:"vertical"},e.a.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},e.a.createElement("span",{style:{fontSize:20,fontWeight:600}},"\u968F\u673A\u7EC4\u5377")),e.a.createElement(ue.a,{style:{marginTop:12}},e.a.createElement("div",{style:{display:"flex",justifyContent:"center",padding:20}},e.a.createElement(me.a,{current:u,style:{width:780}},g.map(function(E){return e.a.createElement(Xe,{key:E.title,title:E.title})}))),e.a.createElement(le.a,null),e.a.createElement(Re.a,{spinning:this.state.loading},g.map(function(E,o){return e.a.createElement("div",{style:{display:o===u?"block":"none"},key:o,className:"pl20 pr20"},E.content)}))),e.a.createElement("div",{style:{display:"flex",marginBottom:200,marginTop:12,justifyContent:"center"}},e.a.createElement("span",{style:{fontSize:20,fontWeight:600}}),e.a.createElement("span",null,u===0?l:c,u===g.length-1?C:p))))}}]),h}(e.a.Component),at=B.default=Ve}}]);