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.
2 lines
22 KiB
2 lines
22 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[133],{BkJg:function(X,F,i){"use strict";i.r(F),i.d(F,"questionType",function(){return S}),i.d(F,"difficultType",function(){return q});var he=i("y8nQ"),U=i("Vl3Y"),Ue=i("IzEo"),w=i("bx4M"),Le=i("T2oS"),ee=i("W9HT"),Pe=i("/zsF"),W=i("PArb"),De=i("sPJy"),B=i("bE4q"),je=i("+L6B"),L=i("2/Rp"),te=i("WmNS"),P=i.n(te),k=i("PpiC"),N=i("9og8"),Oe=i("miYZ"),j=i("tsqr"),J=i("jrin"),y=i("k1fw"),x=i("fWQN"),C=i("mtLc"),A=i("yKVA"),T=i("879j"),Fe=i("FJo9"),$=i("L41K"),ae=i("q1tI"),e=i.n(ae),xe=i("qVdP"),ne=i("jsC+"),Ce=i("7Kak"),D=i("9yH6"),Ae=i("14J3"),z=i("BMrR"),Te=i("jCWc"),M=i("kPKH"),Se=i("giR+"),G=i("fyUT"),I=i("oBTY"),Ne=i("5NDa"),H=i("5rEg"),Q=i("2BaD"),K=i("55Ip"),ie=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(K.Link,{to:"/problemset",target:"_blank",style:{marginLeft:10,color:"#1890FF"}},"\u73B0\u5728\u5C31\u53BB"))},Y=ie,O=i("ErOA"),se=H.a.TextArea,V=function(b){return!b||Number.isNaN(Number(b))?"":Math.ceil(b)},le=function(g){Object(A.a)(_,g);var b=Object(T.a)(_);function _(){var a;Object(x.a)(this,_);for(var t=arguments.length,c=new Array(t),n=0;n<t;n++)c[n]=arguments[n];return a=b.call.apply(b,[this].concat(c)),a.state={titleLen:0,subDisciplinesList:[],allGroupList:[],selectGroupList:[]},a.componentDidMount=function(){setTimeout(Object(N.a)(P.a.mark(function l(){var s;return P.a.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:if(!a.props.form){d.next=6;break}return d.next=3,a.setState({subDisciplinesList:a.props.form.getFieldValue("subDisciplines")||[]});case 3:return d.next=5,a.setState({selectGroupList:((s=a.props.form.getFieldValue("group_ids"))===null||s===void 0?void 0:s.map(function(f){return Object(y.a)(Object(y.a)({},f),{},{group_id:f.id})}))||[]});case 5:a.handleGetGroupByDisciplines(a.props.form.getFieldValue("subDisciplines"));case 6:case"end":return d.stop()}},l)})),500)},a.subDisciplinesAdd=function(l){var s=a.props.form.getFieldValue("subDisciplines")||[];if(s.filter(function(d){return l.id===d.id}).length>0)j.b.error("\u60A8\u5DF2\u7ECF\u9009\u62E9\u8FC7\u6B64\u65B9\u5411\uFF01");else{var o=[].concat(Object(I.a)(s),[l]);a.props.form.setFieldsValue({subDisciplines:o}),a.handleGetGroupByDisciplines(o),a.setState({subDisciplinesList:o})}},a.disciplinesRemove=function(l){var s=a.props.form.getFieldValue("subDisciplines")||[],o=s.filter(function(d){return d.id!==l.id});a.props.form.setFieldsValue({subDisciplines:o}),a.setState({subDisciplinesList:o}),a.handleGetGroupByDisciplines(o)},a.handleSourceRadioChange=function(l){a.props.getdisciplines(l.target.value);var s=[];a.props.form.setFieldsValue({subDisciplines:s}),a.setState({subDisciplinesList:s}),a.handleGetGroupByDisciplines(s)},a.handleGetGroupByDisciplines=Object(N.a)(P.a.mark(function l(){var s,o,d,f,E,m,p,r=arguments;return P.a.wrap(function(R){for(;;)switch(R.prev=R.next){case 0:return s=r.length>0&&r[0]!==void 0?r[0]:[],o=a.state.selectGroupList,R.next=4,Object(O.a)("/api/item_banks_groups/item_banks_group.json",{method:"get",params:{sub_discipline_ids:s.map(function(v){return v.id})}});case 4:d=R.sent,f=(d==null?void 0:d.group)||[],E=Object(I.a)(new Set(f.map(function(v){return v.group_id}))),f=f.filter(function(v){return E.includes(v.group_id)}),a.setState({allGroupList:f}),m=f.map(function(v){return v.group_id}),p=o.filter(function(v){return m.includes(v.group_id)}),a.props.form.setFieldsValue({group_ids:p}),a.setState({selectGroupList:p});case 13:case"end":return R.stop()}},l)})),a.addGroup=function(l){var s=a.props.form.getFieldValue("group_ids")||[];if(s.find(function(d){return d.group_id===l.group_id})){j.b.error("\u60A8\u5DF2\u7ECF\u9009\u62E9\u8FC7\u6B64\u5206\u7EC4\uFF01");return}var o=[].concat(Object(I.a)(s),[l]);a.props.form.setFieldsValue({group_ids:o}),a.setState({selectGroupList:o})},a.removeGroup=function(l){var s=a.props.form.getFieldValue("group_ids")||[],o=s.filter(function(d){return d.group_id!==l.group_id});a.props.form.setFieldsValue({group_ids:o}),a.setState({selectGroupList:o})},a}return Object(C.a)(_,[{key:"render",value:function(){var t=this,c;if(!this.props.form)return"";var n=this.props,l=n.disciplines,s=n.form,o=s.getFieldDecorator,d=s.getFieldValue,f=this.state,E=f.subDisciplinesList,m=f.allGroupList,p=f.selectGroupList;return e.a.createElement("div",null,e.a.createElement(U.a.Item,{label:"\u8BD5\u5377\u540D\u79F0:",name:"name",rules:[{required:!0,message:"\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"}]},e.a.createElement(H.a,{style:{height:38},placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u591A60\u5B57",suffix:this.state.titleLen+"/60",onChange:function(u){t.setState({titleLen:d("name").length})},maxLength:60})),e.a.createElement(z.a,{align:"middle"},e.a.createElement(M.a,null,e.a.createElement(U.a.Item,{label:"\u8003\u8BD5\u65F6\u957F:",name:"time",rules:[{required:!0,message:"\u8003\u8BD5\u65F6\u957F\u4E0D\u80FD\u4E3A\u7A7A"}]},e.a.createElement(G.a,{min:1,max:9999,placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u8003\u8BD5\u65F6\u957F",style:{width:150}}))),e.a.createElement(M.a,{flex:1},e.a.createElement("span",{style:{marginLeft:8,top:2,position:"relative"}},"\u5206\u949F"))),e.a.createElement(U.a.Item,{label:"\u96BE\u5EA6",name:"difficulty",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u5EA6"}]},e.a.createElement(D.a.Group,{style:{display:"flex",width:400,justifyContent:"space-between",marginBottom:6},size:"large",buttonStyle:"solid"},e.a.createElement(D.a.Button,{style:{width:120,textAlign:"center",borderRadius:50,overflow:"hidden"},value:1},"\u7B80\u5355"),e.a.createElement(D.a.Button,{style:{width:120,textAlign:"center",borderRadius:50,overflow:"hidden"},value:2},"\u9002\u4E2D"),e.a.createElement(D.a.Button,{style:{width:120,textAlign:"center",borderRadius:50,overflow:"hidden"},value:3},"\u56F0\u96BE"))),e.a.createElement(U.a.Item,{label:"\u8003\u8BD5\u987B\u77E5",name:"exam_notes"},e.a.createElement(se,{rows:4,maxLength:300})),e.a.createElement(U.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"}]},e.a.createElement(D.a.Group,{style:{display:"flex",width:700,justifyContent:"space-between"},onChange:function(u){t.handleSourceRadioChange(u)}},e.a.createElement(D.a,{value:1},"\u4EC5\u79C1\u6709\u9898\u5E93"),e.a.createElement(D.a,{value:0},"\u516C\u5171\u9898\u5E93+\u79C1\u6709\u9898\u5E93"))),e.a.createElement(U.a.Item,{onChange:function(){console.log(d("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"}},l.map(function(r){return e.a.createElement(ne.a,{key:"disciplines"+r.id,placement:"bottomLeft",overlay:e.a.createElement(w.a,{style:{maxWidth:600,display:"flex",msFlexDirection:"row",flexWrap:"warp",justifyContent:"center"}},r.sub_disciplines.length>0?r.sub_disciplines.map(function(u){return e.a.createElement("div",{style:{display:"inline-block",margin:"6px 12px"},key:"sub_disciplines"+u.id},e.a.createElement("a",{className:"color-dark",onClick:function(){t.subDisciplinesAdd(u)}},u.name))}):"\u6682\u65E0\u6570\u636E")},e.a.createElement(L.a,{style:{marginRight:12,marginTop:6,marginBottom:6}},r.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(r){return e.a.createElement("div",{key:"subDisciplinesList"+r.id},e.a.createElement(L.a,{style:{margin:"12px 6px",backgroundColor:"#F6FFED"},onClick:function(){t.disciplinesRemove(r)}},r.name,e.a.createElement(Q.a,null)))}))):null,((c=this.props.formValue)===null||c===void 0?void 0:c.source)===1&&e.a.createElement(e.a.Fragment,null,!!m.length&&e.a.createElement(U.a.Item,{label:"\u6240\u5C5E\u5206\u7EC4\uFF1A",name:"group_ids"},e.a.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},m.map(function(r){return e.a.createElement(L.a,{onClick:function(){return t.addGroup(r)},style:{marginRight:12,marginTop:6,marginBottom:6}},r.name)}))),p.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"}},p.map(function(r){return e.a.createElement("div",{key:r.group_id},e.a.createElement(L.a,{style:{margin:"12px 6px",backgroundColor:"#F6FFED"},onClick:function(){t.removeGroup(r)}},r.name,e.a.createElement(Q.a,null)))}))):null),e.a.createElement(Y,null))}}]),_}(e.a.Component),re=le,ue=i("Eaj2"),Z=i.n(ue),oe=function(g){Object(A.a)(_,g);var b=Object(T.a)(_);function _(){return Object(x.a)(this,_),b.apply(this,arguments)}return Object(C.a)(_,[{key:"render",value:function(){var t=this.props.form,c=t.getFieldDecorator,n=t.getFieldsValue,l=t.setFieldsValue,s=this.props.data,o=s.item_type,d=s.items_by_item_type,f=function(u){var R=u.difficult,v=u.count;return e.a.createElement("div",{style:{marginRight:10,lineHeight:"18px"}},e.a.createElement("div",{style:{fontSize:14,textAlign:"left"}},q[R]),e.a.createElement("div",{style:{fontSize:12,color:"#999999"}},"(\u5171 ",v," \u9898\u53EF\u9009)"))},E=n(),m=Object.keys(E).filter(function(r){return r.includes("".concat(o,"-"))&&E[r]}),p=0;return m.map(function(r){return p+=E[r],null}),e.a.createElement("div",null,e.a.createElement("div",null,e.a.createElement("span",{className:"font14"},S[o]),V(p)>0?e.a.createElement("span",{style:{color:"#999999",fontSize:12}},"\uFF08\u5DF2\u9009 ",V(p)," \u9898\uFF09"):null),d.map(function(r){return e.a.createElement("div",{key:o+r.discipline_id+r.sub_discipline_id},e.a.createElement("div",{style:{fontSize:16,margin:"16px 0px",fontWeight:"500"}},r.discipline_name," / ",r.sub_discipline_name),e.a.createElement("div",{className:Z.a.formItem},r.items_by_item_type_and_sub_discipline.map(function(u){return e.a.createElement(U.a.Item,{label:e.a.createElement(f,{count:u.items_count,difficult:u.difficulty}),extra:e.a.createElement("span",{className:Z.a.questionTip},"\u9898"),name:"count-".concat(o,"-").concat(r.sub_discipline_id,"-").concat(u.difficulty),colon:!1,style:{width:"30%"},initialValue:0,key:"".concat(o,"-").concat(r.sub_discipline_id,"-").concat(u.difficulty)},e.a.createElement(G.a,{min:0,max:u.items_count,formatter:V}))})))}))}}]),_}(e.a.Component),de=oe,Me=[{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}]}]}],ce=function(g){Object(A.a)(_,g);var b=Object(T.a)(_);function _(a){var t;return Object(x.a)(this,_),t=b.call(this,a),t.state={},t}return Object(C.a)(_,[{key:"render",value:function(){var t=this.props.form,c=this.props.optinalData;return e.a.createElement("div",null,c.map(function(n,l){return e.a.createElement("div",{key:n.item_type},e.a.createElement(de,{form:t,data:n}),l===c.length-1?null:e.a.createElement(W.a,null))}),e.a.createElement(Y,null))}}]),_}(e.a.Component),me=ce,_e=function(b){var _=b.title,a=b.score,t=b.totalCount;return e.a.createElement("div",null,_,":",a&&a>0?e.a.createElement("span",{style:{marginLeft:4,color:"#999",fontSize:12}},"(\u5171 ",a," \u5206)"):null)},pe=function(g){Object(A.a)(_,g);var b=Object(T.a)(_);function _(a){var t;return Object(x.a)(this,_),t=b.call(this,a),t.state={},t}return Object(C.a)(_,[{key:"render",value:function(){if(!this.props.form)return"";var t=this.props.form,c=t.getFieldDecorator,n=t.getFieldsValue,l=Object.keys(S),s=n(),o=0;return e.a.createElement("div",null,l.map(function(d){var f=Object.keys(s).filter(function(p){return p.includes("".concat(d,"-"))&&s[p]}),E=0,m=0;return f.map(function(p){return E+=s[p],m=E*s["score-".concat(d)],null}),o+=m,f.length>0?e.a.createElement(z.a,{align:"middle"},e.a.createElement(M.a,null,e.a.createElement(U.a.Item,{label:e.a.createElement(_e,{title:S[d],score:m,totalCount:E}),name:"score-".concat(d),colon:!1,key:S[d],rules:[{required:!0,message:"\u5206\u6570\u4E0D\u80FD\u4E3A\u7A7A"}]},e.a.createElement(G.a,{min:1,max:100,placeholder:"\u8BF7\u8F93\u5165\u8BD5\u9898\u5206\u6570\u8BBE\u7F6E",style:{width:150}}))),e.a.createElement(M.a,{flex:1},e.a.createElement("span",{style:{marginLeft:8,position:"relative",top:2}},"\u5206/\u9898"))):null}),o&&o>0?e.a.createElement("div",{style:{marginTop:16}},"\u5F53\u524D\u672C\u5377\u603B\u5206",e.a.createElement("span",{style:{color:"#1890FF"}}," ",o," "),"\u5206"):null)}}]),_}(e.a.Component),fe=pe,Ee=$.a.Step,S={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"},q={1:"\u7B80\u5355",2:"\u9002\u4E2D",3:"\u56F0\u96BE"},be=function(g){Object(A.a)(_,g);var b=Object(T.a)(_);function _(a){var t;return Object(x.a)(this,_),t=b.call(this,a),t.getPaperData=function(){var c=window.location.href.split("/").pop();t.setState({loading:!0}),Object(O.a)("/api/examination_banks/".concat(c,"/edit_random_exam.json"),{method:"get"}).then(function(n){if(t.setState({loading:!1}),n==null?void 0:n.contents){var l=n.contents,s=n.groups,o=n.examination_bank,d=n.score_settings,f=n.all_sub_disciplines,E={},m={};l.map(function(u){return E=Object(y.a)(Object(y.a)({},E),{},Object(J.a)({},"count-".concat(u.item_type,"-").concat(u.sub_discipline_id,"-").concat(u.difficulty),u.quanlity)),null}),d.map(function(u){return m=Object(y.a)(Object(y.a)({},m),{},Object(J.a)({},"score-".concat(u.item_type),u.score)),null});var p=Object(y.a)(Object(y.a)({},o),{},{subDisciplines:f.map(function(u){return{id:u.sub_discipline_id,name:u.sub_discipline_name}}),group_ids:s});t.state.form.setFieldsValue(p),t.setState({formValue:p}),t.setState({countData:E,scoreData:m});var r=o.source;t.getdisciplines(r)}else j.b.error("\u83B7\u53D6\u8BD5\u5377\u4FE1\u606F\u9519\u8BEF")})},t.getdisciplines=function(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,n="/api/disciplines.json";Object(O.a)(n,{params:{source:"question",public:c}}).then(function(l){(l==null?void 0:l.disciplines)&&t.setState({disciplines:l.disciplines})}).catch(function(l){console.log(l)})},t.getQuestionNumbers=function(){t.setState({loading:!0});var c=t.state.form.getFieldValue("subDisciplines").map(function(l){return l.id}),n=t.state.form.getFieldValue("source");Object(O.a)("/api/examination_intelligent_settings/optinal_items.json",{method:"post",body:{sub_discipline_ids:c,source:n===1?0:2}}).then(function(l){t.setState({loading:!1}),l.contents&&(t.setState({optinalData:l.contents}),t.state.form.setFieldsValue(Object(y.a)({},t.state.countData)))})},t.next=Object(N.a)(P.a.mark(function c(){var n,l,s,o,d,f,E,m,p;return P.a.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(n=t.state.current+1,!(t.state.current===0)){u.next=8;break}return u.next=4,t.state.form.validateFields(["name","time","difficulty","source","subDisciplines"]);case 4:t.setState({current:n}),t.getQuestionNumbers(),u.next=9;break;case 8:t.state.current===1&&t.idEdit?(t.state.form.setFieldsValue(Object(y.a)({},t.state.scoreData)),t.setState({current:n})):t.state.current===1&&(l=0,s=t.state.form.getFieldsValue(),o=s.name,d=s.difficulty,f=s.time,E=s.source,m=s.subDisciplines,p=Object(k.a)(s,["name","difficulty","time","source","subDisciplines"]),Object.keys(p).forEach(function(R){p[R]>0&&++l}),l===0?j.b.error("\u8BF7\u586B\u5199\u9898\u578B\u6570\u91CF"):t.setState({current:n}));case 9:case"end":return u.stop()}},c)})),t.prev=function(){var c=t.state.current-1;t.setState({current:c})},t.submit=Object(N.a)(P.a.mark(function c(){var n,l,s,o,d,f,E,m,p,r,u;return P.a.wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return v.next=2,t.state.form.validateFields();case 2:n=t.state.form.getFieldsValue();debugger;l=n.exam_notes,s=n.group_ids,o=n.name,d=n.difficulty,f=n.time,E=n.source,m=Object(k.a)(n,["exam_notes","group_ids","name","difficulty","time","source"]),p=[],r=[],Object.keys(m).map(function(h){if(h.includes("count")){var ve=h.split("-")[1],ye=h.split("-")[2],ge=h.split("-")[3];n[h]!==0&&r.push({item_type:ve,difficulty:ge,sub_discipline_id:ye,items_count:n[h]})}else if(h.includes("score")){var Re=h.split("-")[1];p.push({item_type:Re,score:n[h]})}return null}),u={name:o,difficulty:d,time:f,source:E,score_settings:p,contents:r,exam_notes:l,group_ids:s==null?void 0:s.map(function(h){return h.group_id}),sub_discipline_id:0},t.idEdit?t.updatePaper(u):t.createPaper(u);case 10:case"end":return v.stop()}},c)})),t.createPaper=function(c){t.setState({loading:!0}),Object(O.a)("/api/examination_banks/create_random_exam.json",{method:"post",body:Object(y.a)({},c)}).then(function(n){t.setState({loading:!1}),n.status===0&&(j.b.success("\u521B\u5EFA\u6210\u529F"),t.props.history.push("/paperlibrary"))})},t.updatePaper=function(c){t.setState({loading:!0});var n=window.location.href.split("/").pop();Object(O.a)("/api/examination_banks/".concat(n,"/update_random_exam.json"),{method:"post",body:Object(y.a)({},c)}).then(function(l){t.setState({loading:!1}),l.status===0&&(j.b.success("\u7F16\u8F91\u6210\u529F"),t.props.history.push("/paperlibrary"))})},t.confirm=function(c){window.confirm("\u786E\u5B9A\u79BB\u5F00\u6B64\u9875\u9762\u5417?\u6B64\u9875\u6570\u636E\u53EF\u80FD\u4F1A\u4E22\u5931")&&(c?t.props.history.push(c):t.props.history.push("/paperlibrary"))},t.state={current:0,disciplines:[],loading:!1,optinalData:[],countData:{},scoreData:{},formValue:{}},t}return Object(C.a)(_,[{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 c="\u786E\u5B9A\u79BB\u5F00\u6B64\u9875\u9762\u5417?\u6B64\u9875\u6570\u636E\u53EF\u80FD\u4F1A\u4E22\u5931";return(t||window.event).returnValue=c,c}},{key:"render",value:function(){var t=this,c=this.state,n=c.current,l=c.disciplines,s=e.a.createElement(L.a,{onClick:function(){t.confirm()},style:{marginRight:16}},"\u8FD4\u56DE"),o=e.a.createElement(L.a,{type:"primary",onClick:function(){return t.next()}},"\u4E0B\u4E00\u6B65"),d=e.a.createElement(L.a,{onClick:function(){return t.prev()},style:{marginRight:16}},"\u4E0A\u4E00\u6B65"),f=e.a.createElement(L.a,{onClick:function(){return t.submit()},type:"primary"},"\u5B8C\u6210\u7EC4\u5377"),E=[{title:"\u57FA\u672C\u4FE1\u606F",content:e.a.createElement(re,{formValue:this.state.formValue,disciplines:l,getdisciplines:this.getdisciplines,form:this.state.form})},{title:"\u9898\u578B\u6570\u91CF",content:e.a.createElement(me,{form:this.state.form,optinalData:this.state.optinalData})},{title:"\u8D4B\u5206\u8BBE\u7F6E",content:e.a.createElement(fe,{form:this.state.form})}];return e.a.createElement("div",{style:{width:1200,margin:"0px auto"}},e.a.createElement(B.a,{separator:">",style:{padding:"12px 0px"}},e.a.createElement(B.a.Item,null,e.a.createElement(K.Link,{to:"/paperlibrary",onClick:function(p){p.preventDefault(),t.confirm("/paperlibrary")}},"\u8BD5\u5377\u5E93")),e.a.createElement(B.a.Item,null,"\u968F\u673A\u7EC4\u5377")),e.a.createElement(U.a,{from:this.state.form,onValuesChange:function(){return t.setState({formValue:Object(y.a)({},t.state.form.getFieldsValue())})},ref:"form",name:"basic",layout:"vertical",onChange:function(){t.setState({now:new Date})}},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(w.a,{style:{marginTop:12}},e.a.createElement("div",{style:{display:"flex",justifyContent:"center",padding:20}},e.a.createElement($.a,{current:n,style:{width:780}},E.map(function(m){return e.a.createElement(Ee,{key:m.title,title:m.title})}))),e.a.createElement(W.a,null),e.a.createElement(ee.a,{spinning:this.state.loading},E.map(function(m,p){return e.a.createElement("div",{style:{display:p===n?"block":"none"},key:p,className:"pl20 pr20"},m.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,n===0?s:d,n===E.length-1?f:o))))}}]),_}(e.a.Component),Be=F.default=be},Eaj2:function(X,F,i){X.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"}}}]);
|