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