2 lines
23 KiB
JavaScript
2 lines
23 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[134],{BkJg:function(J,j,i){"use strict";i.r(j),i.d(j,"questionType",function(){return M}),i.d(j,"difficultType",function(){return ae});var Le=i("EkPb"),U=i("7X0+"),De=i("Iszb"),z=i("GJ/b"),xe=i("Mumi"),ie=i("/zo+"),Oe=i("E+ey"),W=i("sY1U"),Fe=i("XSsT"),V=i("iBFk"),je=i("MPZO"),P=i("bnk9"),se=i("VBJJ"),L=i.n(se),H=i("buSX"),N=i("z3+T"),Ce=i("X/R0"),x=i("M6G9"),Q=i("zjzt"),R=i("55MS"),C=i("FGJx"),A=i("o0AO"),T=i("uwZC"),S=i("lpH6"),Ae=i("xUXf"),Z=i("T4F4"),le=i("ZZRV"),e=i.n(le),Te=i("FHsC"),re=i("4PKU"),Se=i("9cas"),D=i("twZV"),Me=i("XZgM"),K=i("TFeq"),Ne=i("RXQH"),B=i("VgM2"),Be=i("EYz/"),G=i("gwXo"),I=i("V0hb"),Xe=i("jpv3"),X=i("9rdS"),Ve=i("DHCt"),Y=i("CRgH"),q=i("ihQa"),ee=i("DndG"),ue=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(ee.Link,{to:"/problemset",target:"_blank",style:{marginLeft:10,color:"#1890FF"}},"\u73B0\u5728\u5C31\u53BB"))},te=ue,O=i("ErOA"),oe=i("Eaj2"),w=i.n(oe),de=Y.a.TextArea,ce=X.a.SubMenu,$=function(v){return!v||Number.isNaN(Number(v))?"":Math.ceil(v)},_e=function(h){Object(T.a)(p,h);var v=Object(S.a)(p);function p(){var a;Object(C.a)(this,p);for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return a=v.call.apply(v,[this].concat(o)),a.state={titleLen:0,subDisciplinesList:[],allGroupList:[],selectGroupList:[]},a.componentDidMount=function(){setTimeout(Object(N.a)(L.a.mark(function s(){var n;return L.a.wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(!a.props.form){u.next=6;break}return u.next=3,a.setState({subDisciplinesList:a.props.form.getFieldValue("subDisciplines")||[]});case 3:return u.next=5,a.setState({selectGroupList:((n=a.props.form.getFieldValue("group_ids"))===null||n===void 0?void 0:n.map(function(E){return Object(R.a)(Object(R.a)({},E),{},{id:E.id})}))||[]});case 5:a.handleGetGroupByDisciplines(a.props.form.getFieldValue("subDisciplines"));case 6:case"end":return u.stop()}},s)})),500)},a.subDisciplinesAdd=function(s){var n=a.props.form.getFieldValue("subDisciplines")||[];if(n.filter(function(u){return s.id===u.id}).length>0)x.b.error("\u60A8\u5DF2\u7ECF\u9009\u62E9\u8FC7\u6B64\u65B9\u5411\uFF01");else{var d=[].concat(Object(I.a)(n),[s]);a.props.form.setFieldsValue({subDisciplines:d}),a.handleGetGroupByDisciplines(d),a.setState({subDisciplinesList:d})}},a.disciplinesRemove=function(s){var n=a.props.form.getFieldValue("subDisciplines")||[],d=n.filter(function(u){return u.id!==s.id});a.props.form.setFieldsValue({subDisciplines:d}),a.setState({subDisciplinesList:d}),a.handleGetGroupByDisciplines(d)},a.handleSourceRadioChange=function(s){a.props.getdisciplines(s.target.value);var n=[];a.props.form.setFieldsValue({subDisciplines:n}),a.setState({subDisciplinesList:n}),a.handleGetGroupByDisciplines(n)},a.handleGetGroupByDisciplines=Object(N.a)(L.a.mark(function s(){var n,d,u,E,b,f,_,l=arguments;return L.a.wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return n=l.length>0&&l[0]!==void 0?l[0]:[],d=a.state.selectGroupList,y.next=4,Object(O.a)("/api/item_banks_groups/mine.json",{method:"get",params:{sub_discipline_ids:n.map(function(m){return m.id})}});case 4:u=y.sent,E=(u==null?void 0:u.item_banks_groups)||[],b=Object(I.a)(new Set(E.map(function(m){return m.id}))),E=E.filter(function(m){return b.includes(m.id)}),a.setState({allGroupList:E}),f=E.map(function(m){return m.id}),_=d.filter(function(m){return f.includes(m.id)}),a.props.form.setFieldsValue({group_ids:_}),a.setState({selectGroupList:_});case 13:case"end":return y.stop()}},s)})),a.addGroup=function(s){var n=a.props.form.getFieldValue("group_ids")||[];if(n.find(function(u){return u.id===s.id})){x.b.error("\u60A8\u5DF2\u7ECF\u9009\u62E9\u8FC7\u6B64\u5206\u7EC4\uFF01");return}var d=[].concat(Object(I.a)(n),[s]);a.props.form.setFieldsValue({group_ids:d}),a.setState({selectGroupList:d})},a.removeGroup=function(s){var n=a.props.form.getFieldValue("group_ids")||[],d=n.filter(function(u){return u.id!==s.id});a.props.form.setFieldsValue({group_ids:d}),a.setState({selectGroupList:d})},a}return Object(A.a)(p,[{key:"render",value:function(){var t=this,o;if(!this.props.form)return"";var r=this.props,s=r.disciplines,n=r.form,d=n.getFieldDecorator,u=n.getFieldValue,E=this.state,b=E.subDisciplinesList,f=E.allGroupList,_=E.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(Y.a,{style:{height:38},placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u591A60\u5B57",suffix:this.state.titleLen+"/60",onChange:function(c){t.setState({titleLen:u("name").length})},maxLength:60})),e.a.createElement(K.a,{align:"middle"},e.a.createElement(B.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(B.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(de,{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(c){t.handleSourceRadioChange(c)}},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(u("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"}},s.map(function(l){return e.a.createElement(re.a,{key:"disciplines"+l.id,placement:"bottomLeft",overlay:e.a.createElement("div",null,l.sub_disciplines.length>0?l.sub_disciplines.map(function(c){return e.a.createElement("div",{key:c.id},e.a.createElement(X.a,{key:c.id,mode:"vertical"},e.a.createElement(ce,{popupClassName:l.sub_disciplines.length>10?w.a.subheight:"",title:c.name},Array.isArray(c.tag_disciplines)&&!!c.tag_disciplines.length?c.tag_disciplines.map(function(y,m){return e.a.createElement(X.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(X.a.Item,null,"\u6682\u65E0\u6570\u636E"))))}):e.a.createElement(z.a,null,"\u6682\u65E0\u6570\u636E"))},e.a.createElement(P.a,{style:{marginRight:12,marginTop:6,marginBottom:6}},l.name))}))),b.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"}},b.map(function(l){return e.a.createElement("div",{key:"subDisciplinesList"+l.id},e.a.createElement(P.a,{style:{margin:"12px 6px",backgroundColor:"#F6FFED"},onClick:function(){t.disciplinesRemove(l)}},l.is_default&&e.a.createElement("span",null,l.parent_name," /"),l.name,e.a.createElement(q.a,null)))}))):null,((o=this.props.formValue)===null||o===void 0?void 0:o.source)==1&&e.a.createElement(e.a.Fragment,null,!!f.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"}},f.map(function(l){return e.a.createElement(P.a,{onClick:function(){return t.addGroup(l)},style:{marginRight:12,marginTop:6,marginBottom:6}},l.name)}))),_.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"}},_.map(function(l){return e.a.createElement("div",{key:l.id},e.a.createElement(P.a,{style:{margin:"12px 6px",backgroundColor:"#F6FFED"},onClick:function(){t.removeGroup(l)}},l.name,e.a.createElement(q.a,null)))}))):null),e.a.createElement(te,null))}}]),p}(e.a.Component),me=_e,pe=function(h){Object(T.a)(p,h);var v=Object(S.a)(p);function p(){return Object(C.a)(this,p),v.apply(this,arguments)}return Object(A.a)(p,[{key:"render",value:function(){var t=this.props.form,o=t.getFieldDecorator,r=t.getFieldsValue,s=t.setFieldsValue,n=this.props.data,d=n.item_type,u=n.items_by_item_type,E=function(c){var y=c.difficult,m=c.count;return e.a.createElement("div",{style:{marginRight:10,lineHeight:"18px"}},e.a.createElement("div",{style:{fontSize:14,textAlign:"left"}},ae[y]),e.a.createElement("div",{style:{fontSize:12,color:"#999999"}},"(\u5171 ",m," \u9898\u53EF\u9009)"))},b=r(),f=Object.keys(b).filter(function(l){return l.includes("".concat(d,"-"))&&b[l]}),_=0;return f.map(function(l){return _+=b[l],null}),e.a.createElement("div",null,e.a.createElement("div",null,e.a.createElement("span",{className:"font14"},M[d]),$(_)>0?e.a.createElement("span",{style:{color:"#999999",fontSize:12}},"\uFF08\u5DF2\u9009 ",$(_)," \u9898\uFF09"):null),u.map(function(l){return e.a.createElement("div",{key:d+l.discipline_id+l.sub_discipline_id},e.a.createElement("div",{style:{fontSize:16,margin:"16px 0px",fontWeight:"500"}},l.discipline_name," / ",l.sub_discipline_name," ",l.tag_discipline_name&&"/".concat(l.tag_discipline_name)),e.a.createElement("div",{className:w.a.formItem},l.items_by_item_type_and_tag_discipline.map(function(c){return e.a.createElement(U.a.Item,{label:e.a.createElement(E,{count:c.items_count,difficult:c.difficulty}),extra:e.a.createElement("span",{className:w.a.questionTip},"\u9898"),name:"count-".concat(d,"-").concat(l.sub_discipline_id,"-").concat(c.difficulty,"-").concat(l.tag_discipline_id),colon:!1,style:{width:"30%"},initialValue:0,key:"".concat(d,"-").concat(l.sub_discipline_id,"-").concat(c.difficulty)},e.a.createElement(G.a,{min:0,max:c.items_count,formatter:$}))})))}))}}]),p}(e.a.Component),fe=pe,Ge=[{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}]}]}],Ee=function(h){Object(T.a)(p,h);var v=Object(S.a)(p);function p(a){var t;return Object(C.a)(this,p),t=v.call(this,a),t.state={},t}return Object(A.a)(p,[{key:"render",value:function(){var t=this.props.form,o=this.props.optinalData;return e.a.createElement("div",null,o.map(function(r,s){return e.a.createElement("div",{key:r.item_type},e.a.createElement(fe,{form:t,data:r}),s===o.length-1?null:e.a.createElement(W.a,null))}),e.a.createElement(te,null))}}]),p}(e.a.Component),be=Ee,ve=function(v){var p=v.title,a=v.score,t=v.totalCount;return e.a.createElement("div",null,p,":",a&&a>0?e.a.createElement("span",{style:{marginLeft:4,color:"#999",fontSize:12}},"(\u5171 ",a," \u5206)"):null)},ye=function(h){Object(T.a)(p,h);var v=Object(S.a)(p);function p(a){var t;return Object(C.a)(this,p),t=v.call(this,a),t.state={},t}return Object(A.a)(p,[{key:"render",value:function(){if(!this.props.form)return"";var t=this.props.form,o=t.getFieldDecorator,r=t.getFieldsValue,s=Object.keys(M),n=r(),d=0;return e.a.createElement("div",null,s.map(function(u){var E=Object.keys(n).filter(function(_){return _.includes("".concat(u,"-"))&&n[_]}),b=0,f=0;return E.map(function(_){return b+=n[_],f=b*n["score-".concat(u)],null}),d+=f,E.length>0?e.a.createElement(K.a,{align:"middle"},e.a.createElement(B.a,null,e.a.createElement(U.a.Item,{label:e.a.createElement(ve,{title:M[u],score:f,totalCount:b}),name:"score-".concat(u),colon:!1,key:M[u],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(B.a,{flex:1},e.a.createElement("span",{style:{marginLeft:8,position:"relative",top:2}},"\u5206/\u9898"))):null}),d&&d>0?e.a.createElement("div",{style:{marginTop:16}},"\u5F53\u524D\u672C\u5377\u603B\u5206",e.a.createElement("span",{style:{color:"#1890FF"}}," ",d," "),"\u5206"):null)}}]),p}(e.a.Component),ge=ye,Re=Z.a.Step,M={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"},ae={1:"\u7B80\u5355",2:"\u9002\u4E2D",3:"\u56F0\u96BE"},he=function(h){Object(T.a)(p,h);var v=Object(S.a)(p);function p(a){var t;return Object(C.a)(this,p),t=v.call(this,a),t.getPaperData=function(){var o=window.location.href.split("/").pop(),r=[];t.setState({loading:!0}),Object(O.a)("/api/examination_banks/".concat(o,"/edit_random_exam.json"),{method:"get"}).then(function(s){if(t.setState({loading:!1}),s==null?void 0:s.contents){var n=s.contents,d=s.groups,u=s.examination_bank,E=s.score_settings,b=s.all_sub_disciplines,f=s.all_tag_disciplines,_={},l={};Array.isArray(n)&&n.map(function(m){return _=Object(R.a)(Object(R.a)({},_),{},Object(Q.a)({},"count-".concat(m.item_type,"-").concat(m.sub_discipline_id,"-").concat(m.difficulty,"-").concat(m.tag_discipline_id),m.quanlity)),null}),E.map(function(m){return l=Object(R.a)(Object(R.a)({},l),{},Object(Q.a)({},"score-".concat(m.item_type),m.score)),null}),f.map(function(m,g){b.map(function(F,ne){if((m==null?void 0:m.sub_discipline_id)===(F==null?void 0:F.sub_discipline_id)){var k={id:m.tag_discipline_id,name:m.tag_discipline_name,parent_name:F.sub_discipline_name,is_default:!0};r.push(k)}})});var c=Object(R.a)(Object(R.a)({},u),{},{subDisciplines:r,group_ids:d});t.state.form.setFieldsValue(c),t.setState({formValue:c}),t.setState({countData:_,scoreData:l});var y=u.source;t.getdisciplines(y)}else x.b.error("\u83B7\u53D6\u8BD5\u5377\u4FE1\u606F\u9519\u8BEF")})},t.getdisciplines=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,r="/api/disciplines.json";Object(O.a)(r,{params:{source:"question",public:o}}).then(function(s){(s==null?void 0:s.disciplines)&&t.setState({disciplines:s.disciplines})}).catch(function(s){console.log(s)})},t.getQuestionNumbers=function(){var o;t.setState({loading:!0});var r=t.state.form.getFieldValue("subDisciplines").map(function(n){return n.id}),s=t.state.form.getFieldValue("source");Object(O.a)("/api/examination_intelligent_settings/optional_items.json",{method:"post",body:{tag_discipline_ids:r,group_ids:(o=t.state.form.getFieldValue("group_ids"))===null||o===void 0?void 0:o.map(function(n){return n.id}),source:s===1?0:2}}).then(function(n){t.setState({loading:!1}),n.contents&&(t.setState({optinalData:n.contents}),t.state.form.setFieldsValue(Object(R.a)({},t.state.countData)))})},t.next=Object(N.a)(L.a.mark(function o(){var r,s,n,d,u,E,b,f,_;return L.a.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(r=t.state.current+1,!(t.state.current===0)){c.next=8;break}return c.next=4,t.state.form.validateFields(["name","time","difficulty","source","subDisciplines"]);case 4:t.setState({current:r}),t.getQuestionNumbers(),c.next=9;break;case 8:t.state.current===1&&t.idEdit?(t.state.form.setFieldsValue(Object(R.a)({},t.state.scoreData)),t.setState({current:r})):t.state.current===1&&(s=0,n=t.state.form.getFieldsValue(),d=n.name,u=n.difficulty,E=n.time,b=n.source,f=n.subDisciplines,_=Object(H.a)(n,["name","difficulty","time","source","subDisciplines"]),Object.keys(_).forEach(function(y){_[y]>0&&++s}),s===0?x.b.error("\u8BF7\u586B\u5199\u9898\u578B\u6570\u91CF"):t.setState({current:r}));case 9:case"end":return c.stop()}},o)})),t.prev=function(){var o=t.state.current-1;t.setState({current:o})},t.submit=Object(N.a)(L.a.mark(function o(){var r,s,n,d,u,E,b,f,_,l,c;return L.a.wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,t.state.form.validateFields();case 2:r=t.state.form.getFieldsValue(),s=r.exam_notes,n=r.group_ids,d=r.name,u=r.difficulty,E=r.time,b=r.source,f=Object(H.a)(r,["exam_notes","group_ids","name","difficulty","time","source"]),_=[],l=[],Object.keys(f).map(function(g){if(g.includes("count")){var F=g.split("-")[1],ne=g.split("-")[2],k=g.split("-")[3],Ue=g.split("-")[4];r[g]!==0&&l.push({item_type:F,difficulty:k,sub_discipline_id:ne,items_count:r[g],tag_discipline_id:Ue})}else if(g.includes("score")){var Pe=g.split("-")[1];_.push({item_type:Pe,score:r[g]})}return null}),c={name:d,difficulty:u,time:E,source:b,score_settings:_,contents:l,exam_notes:s,group_ids:n==null?void 0:n.map(function(g){return g.id}),sub_discipline_id:0},t.idEdit?t.updatePaper(c):t.createPaper(c);case 9:case"end":return m.stop()}},o)})),t.createPaper=function(o){t.setState({loading:!0}),Object(O.a)("/api/examination_banks/create_random_exam.json",{method:"post",body:Object(R.a)({},o)}).then(function(r){t.setState({loading:!1}),r.status===0&&(x.b.success("\u521B\u5EFA\u6210\u529F"),t.props.history.push("/paperlibrary"))})},t.updatePaper=function(o){t.setState({loading:!0});var r=window.location.href.split("/").pop();Object(O.a)("/api/examination_banks/".concat(r,"/update_random_exam.json"),{method:"post",body:Object(R.a)({},o)}).then(function(s){t.setState({loading:!1}),s.status===0&&(x.b.success("\u7F16\u8F91\u6210\u529F"),t.props.history.push("/paperlibrary"))})},t.confirm=function(o){window.confirm("\u786E\u5B9A\u79BB\u5F00\u6B64\u9875\u9762\u5417?\u6B64\u9875\u6570\u636E\u53EF\u80FD\u4F1A\u4E22\u5931")&&(o?t.props.history.push(o):t.props.history.push("/paperlibrary"))},t.state={current:0,disciplines:[],loading:!1,optinalData:[],countData:{},scoreData:{},formValue:{}},t}return Object(A.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 o="\u786E\u5B9A\u79BB\u5F00\u6B64\u9875\u9762\u5417?\u6B64\u9875\u6570\u636E\u53EF\u80FD\u4F1A\u4E22\u5931";return(t||window.event).returnValue=o,o}},{key:"render",value:function(){var t=this,o=this.state,r=o.current,s=o.disciplines,n=e.a.createElement(P.a,{onClick:function(){t.confirm()},style:{marginRight:16}},"\u8FD4\u56DE"),d=e.a.createElement(P.a,{type:"primary",onClick:function(){return t.next()}},"\u4E0B\u4E00\u6B65"),u=e.a.createElement(P.a,{onClick:function(){return t.prev()},style:{marginRight:16}},"\u4E0A\u4E00\u6B65"),E=e.a.createElement(P.a,{onClick:function(){return t.submit()},type:"primary"},"\u5B8C\u6210\u7EC4\u5377"),b=[{title:"\u57FA\u672C\u4FE1\u606F",content:e.a.createElement(me,{formValue:this.state.formValue,disciplines:s,getdisciplines:this.getdisciplines,form:this.state.form})},{title:"\u9898\u578B\u6570\u91CF",content:e.a.createElement(be,{form:this.state.form,optinalData:this.state.optinalData})},{title:"\u8D4B\u5206\u8BBE\u7F6E",content:e.a.createElement(ge,{form:this.state.form})}];return e.a.createElement("div",{style:{width:1200,margin:"0px auto"}},e.a.createElement(V.a,{separator:">",style:{padding:"12px 0px"}},e.a.createElement(V.a.Item,null,e.a.createElement(ee.Link,{to:"/paperlibrary",onClick:function(_){_.preventDefault(),t.confirm("/paperlibrary")}},"\u8BD5\u5377\u5E93")),e.a.createElement(V.a.Item,null,"\u968F\u673A\u7EC4\u5377")),e.a.createElement(U.a,{from:this.state.form,onValuesChange:function(){return t.setState({formValue:Object(R.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(z.a,{style:{marginTop:12}},e.a.createElement("div",{style:{display:"flex",justifyContent:"center",padding:20}},e.a.createElement(Z.a,{current:r,style:{width:780}},b.map(function(f){return e.a.createElement(Re,{key:f.title,title:f.title})}))),e.a.createElement(W.a,null),e.a.createElement(ie.a,{spinning:this.state.loading},b.map(function(f,_){return e.a.createElement("div",{style:{display:_===r?"block":"none"},key:_,className:"pl20 pr20"},f.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,r===0?n:u,r===b.length-1?E:d))))}}]),p}(e.a.Component),Ie=j.default=he},Eaj2:function(J,j,i){J.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"}}}]);
|