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
25 KiB
2 lines
25 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[147],{BkJg:function(G,F,a){"use strict";a.r(F),a.d(F,"questionType",function(){return H}),a.d(F,"difficultType",function(){return be});var ye=a("y8nQ"),P=a("Vl3Y"),de=a("IzEo"),k=a("bx4M"),te=a("T2oS"),ae=a("W9HT"),ne=a("/zsF"),Y=a("PArb"),w=a("sPJy"),j=a("bE4q"),_e=a("+L6B"),T=a("2/Rp"),z=a("WmNS"),A=a.n(z),ie=a("PpiC"),M=a("9og8"),se=a("miYZ"),B=a("tsqr"),Z=a("jrin"),U=a("k1fw"),I=a("fWQN"),S=a("mtLc"),X=a("yKVA"),V=a("879j"),ce=a("FJo9"),J=a("L41K"),le=a("q1tI"),e=a.n(le),me=a("qVdP"),ue=a("jsC+"),Ee=a("7Kak"),C=a("9yH6"),K=a("14J3"),O=a("BMrR"),h=a("jCWc"),x=a("kPKH"),N=a("giR+"),W=a("fyUT"),q=a("oBTY"),Xe=a("lUTK"),ee=a("BvKs"),Ve=a("5NDa"),pe=a("5rEg"),he=a("2BaD"),fe=a("55Ip"),ge=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"))},ve=ge,Re=a("Eaj2"),re=a.n(Re),Ue=a("P/tu"),Pe=pe.a.TextArea,De=ee.a.SubMenu,oe=function(y){return!y||Number.isNaN(Number(y))?"":Math.ceil(y)},Le=function(D){Object(X.a)(c,D);var y=Object(V.a)(c);function c(){var r;Object(I.a)(this,c);for(var t=arguments.length,d=new Array(t),i=0;i<t;i++)d[i]=arguments[i];return r=y.call.apply(y,[this].concat(d)),r.state={titleLen:0,subDisciplinesList:[],allGroupList:[],selectGroupList:[],openKeys:[],visible:null},r.componentDidMount=function(){setTimeout(Object(M.a)(A.a.mark(function n(){return A.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:if(!r.props.form){s.next=3;break}return s.next=3,r.setState({subDisciplinesList:r.props.form.getFieldValue("subDisciplines")||[]});case 3:case"end":return s.stop()}},n)})),1e3)},r.subDisciplinesAdd=function(n){var o=[],s=r.props.form.getFieldValue("subDisciplines")||[],u=s.filter(function(E){return n.id===E.id}).length>0;u?o=s.filter(function(E){return n.id!==E.id}):o=[].concat(Object(q.a)(s),[n]),r.props.form.setFieldsValue({subDisciplines:o}),r.setState({subDisciplinesList:o})},r.disciplinesRemove=function(n){var o=r.props.form.getFieldValue("subDisciplines")||[],s=o.filter(function(u){return u.id!==n.id});r.props.form.setFieldsValue({subDisciplines:s}),r.setState({subDisciplinesList:s})},r.handleSourceRadioChange=function(n){r.props.getdisciplines(n.target.value);var o=[];r.props.form.setFieldsValue({subDisciplines:o}),r.setState({subDisciplinesList:o})},r.dealList=function(){for(var n=r.state.subDisciplinesList,o=Object(q.a)(n),s=0,u=[],E=0;E<o.length;E++){for(var b="",_=0;_<u.length;_++)if(u[_][0].parent_name==o[E].parent_name){s=1,b=_;break}if(s==1)u[b].push(o[E]),s=0;else if(s==0){var p=new Array;p.push(o[E]),u.push(p)}}return u},r}return Object(S.a)(c,[{key:"render",value:function(){var t=this;if(!this.props.form)return"";var d=this.props,i=d.disciplines,n=d.form,o=n.getFieldDecorator,s=n.getFieldValue,u=this.state,E=u.subDisciplinesList,b=u.allGroupList,_=u.selectGroupList,p=u.openKeys,f=u.visible;return e.a.createElement("div",null,e.a.createElement(P.a.Item,{label:"\u8BD5\u5377\u540D\u79F0:",name:"name",rules:[{required:!0,message:"\u8BD5\u5377\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"}]},e.a.createElement(pe.a,{style:{height:38},placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u6807\u9898\uFF0C\u6700\u591A60\u5B57",suffix:this.state.titleLen+"/60",onChange:function(R){t.setState({titleLen:s("name").length})},maxLength:60})),e.a.createElement(O.a,{align:"middle"},e.a.createElement(x.a,null,e.a.createElement(P.a.Item,{label:"\u8003\u8BD5\u65F6\u957F:",name:"time",rules:[{required:!0,message:"\u8003\u8BD5\u65F6\u957F\u4E0D\u80FD\u4E3A\u7A7A"}]},e.a.createElement(W.a,{min:1,max:9999,placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u8003\u8BD5\u65F6\u957F",style:{width:150}}))),e.a.createElement(x.a,{flex:1},e.a.createElement("span",{style:{marginLeft:8,top:2,position:"relative"}},"\u5206\u949F"))),e.a.createElement(P.a.Item,{label:"\u96BE\u5EA6",name:"difficulty",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u5EA6"}]},e.a.createElement(C.a.Group,{style:{display:"flex",width:400,justifyContent:"space-between",marginBottom:6},size:"large",buttonStyle:"solid"},e.a.createElement(C.a.Button,{style:{width:120,textAlign:"center",borderRadius:50,overflow:"hidden"},value:1},"\u7B80\u5355"),e.a.createElement(C.a.Button,{style:{width:120,textAlign:"center",borderRadius:50,overflow:"hidden"},value:2},"\u9002\u4E2D"),e.a.createElement(C.a.Button,{style:{width:120,textAlign:"center",borderRadius:50,overflow:"hidden"},value:3},"\u56F0\u96BE"))),e.a.createElement(P.a.Item,{label:"\u8003\u8BD5\u987B\u77E5",name:"exam_notes"},e.a.createElement(Pe,{rows:4,maxLength:300})),e.a.createElement(P.a.Item,{label:e.a.createElement("span",null,"\u8BD5\u9898\u6765\u6E90",e.a.createElement("span",{className:"font12 c-grey-999"},"\uFF08\u4E3A\u4FDD\u8BC1\u8003\u5BDF\u51C6\u786E\u6027\uFF0C\u5EFA\u8BAE\u4F7F\u7528\u6211\u521B\u5EFA\u7684\uFF09")),name:"source",style:{width:"100%"},rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u8BD5\u9898\u6765\u6E90"}]},e.a.createElement(C.a.Group,{style:{display:"flex",width:368,justifyContent:"space-between"},onChange:function(R){t.handleSourceRadioChange(R)}},e.a.createElement(C.a,{value:1},"\u4EC5\u6211\u521B\u5EFA\u7684"),e.a.createElement(C.a,{value:0},"\u516C\u5171\u9898\u5E93+\u6211\u521B\u5EFA\u7684"))),e.a.createElement(P.a.Item,{label:"\u8003\u67E5\u8303\u56F4\uFF1A",name:"subDisciplines",initialValue:[]},e.a.createElement("div",{style:{display:"inline-flex",flexWrap:"wrap"}},i.map(function(m,R){return e.a.createElement("div",{style:{marginRight:12},onMouseLeave:function(){return t.setState({openKeys:[],visible:null})}},e.a.createElement(ue.a,{key:"disciplines"+m.id,placement:"bottomLeft",visible:R===f,getPopupContainer:function(v){return v.parentNode},overlay:e.a.createElement("div",null,m.sub_disciplines.length>0?e.a.createElement(ee.a,{mode:"vertical",multiple:!0,selectedKeys:E==null?void 0:E.map(function(l){return String(l.id)}),subMenuCloseDelay:0,subMenuOpenDelay:0,openKeys:p,getPopupContainer:function(v){return v.parentNode}},m.sub_disciplines.map(function(l){var v;return e.a.createElement(De,{onTitleMouseEnter:function(){t.setState({openKeys:[String(l.id)]})},key:l.id,title:e.a.createElement("span",null,"".concat(l.name,"(").concat(l.item_count,")")),popupClassName:((v=l.tag_disciplines)===null||v===void 0?void 0:v.length)>10?re.a.maxHeiTag:""},Array.isArray(l.tag_disciplines)&&!!l.tag_disciplines.length?l.tag_disciplines.map(function(g){return e.a.createElement(ee.a.Item,{key:g.id,onClick:function(){t.subDisciplinesAdd(g)}},e.a.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},e.a.createElement("span",{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},g.name,"(",g.item_count,")"),e.a.createElement("span",null,g.type==="personal"?"\uFF08\u81EA\u7528\uFF09":"")))}):e.a.createElement(ee.a.Item,null,"\u6682\u65E0\u6570\u636E"))})):e.a.createElement(k.a,null,"\u6682\u65E0\u6570\u636E"))},e.a.createElement(T.a,{onMouseEnter:function(){return t.setState({visible:R,openKeys:[]})},style:{marginTop:6,marginBottom:6}},m.name)))}))),E.length>0?e.a.createElement("div",{style:{minHeight:150,backgroundColor:"#FAFAFA"}},e.a.createElement("div",{style:{paddingLeft:12,paddingTop:12}},"\u5DF2\u9009"),this.dealList().map(function(m,R){var l;return e.a.createElement(e.a.Fragment,{key:R},e.a.createElement("div",{style:{fontSize:14,paddingLeft:10,marginTop:6}},m==null||((l=m[0])===null||l===void 0)?void 0:l.parent_name),e.a.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},m==null?void 0:m.map(function(v){return e.a.createElement("div",{key:"subDisciplinesList"+v.id},e.a.createElement(T.a,{style:{margin:"12px 6px",backgroundColor:"#F6FFED"},onClick:function(){t.disciplinesRemove(v)}},v.name,e.a.createElement(he.a,null)))})))})):null,e.a.createElement(P.a.Item,{initialValue:[],label:"\u8BD5\u9898\u6587\u4EF6\u5939:\uFF08\u9009\u4E2D\u9879\u4EC5\u5305\u62EC\u8BE5\u6587\u4EF6\u5939\u4E0B\u7684\u8BD5\u9898\uFF0C\u4E0D\u5305\u62EC\u5B50\u6587\u4EF6\u5939\uFF0C\u4E14\u7CFB\u7EDF\u53D6\u60A8\u9009\u4E2D\u7684\u6587\u4EF6\u5939\u548C\u8003\u67E5\u8303\u56F4\u4E2D\u7684\u8BD5\u9898\u7684\u4EA4\u96C6\u4F5C\u4E3A\u968F\u673A\u5BF9\u8C61\u3002\uFF09",name:"group_ids"},e.a.createElement(Ue.a,{multiple:!0})),e.a.createElement(ve,null))}}]),c}(e.a.Component),Oe=Le,$=a("ErOA"),xe=function(D){Object(X.a)(c,D);var y=Object(V.a)(c);function c(){return Object(I.a)(this,c),y.apply(this,arguments)}return Object(S.a)(c,[{key:"render",value:function(){var t=this.props.form,d=t.getFieldDecorator,i=t.getFieldsValue,n=t.setFieldsValue,o=this.props.data,s=o.item_type,u=o.items_by_item_type,E=function(m){var R=m.difficult,l=m.count;return e.a.createElement("div",{style:{marginRight:10,lineHeight:"18px"}},e.a.createElement("div",{style:{fontSize:14,textAlign:"left"}},be[R]),e.a.createElement("div",{style:{fontSize:12,color:"#999999"}},"(\u5171 ",l," \u9898\u53EF\u9009)"))},b=i(),_=Object.keys(b).filter(function(f){return f.includes("".concat(s,"-"))&&b[f]}),p=0;return _.map(function(f){return p+=b[f],null}),e.a.createElement("div",null,e.a.createElement("div",null,e.a.createElement("span",{className:"font14"},H[s]),oe(p)>0?e.a.createElement("span",{style:{color:"#999999",fontSize:12}},"\uFF08\u5DF2\u9009 ",oe(p)," \u9898\uFF09"):null),u.map(function(f){return e.a.createElement("div",{key:s+f.discipline_id+f.sub_discipline_id},e.a.createElement("div",{style:{fontSize:16,margin:"16px 0px",fontWeight:"500"}},f.discipline_name," / ",f.sub_discipline_name," ",f.tag_discipline_name&&"/".concat(f.tag_discipline_name)),e.a.createElement("div",{className:re.a.formItem},f.items_by_item_type_and_tag_discipline.map(function(m){return e.a.createElement(P.a.Item,{label:e.a.createElement(E,{count:m.items_count,difficult:m.difficulty}),extra:e.a.createElement("span",{className:re.a.questionTip},"\u9898"),name:"count-".concat(s,"-").concat(f.sub_discipline_id,"-").concat(m.difficulty,"-").concat(f.tag_discipline_id),colon:!1,style:{width:"30%"},initialValue:0,key:"".concat(s,"-").concat(f.sub_discipline_id,"-").concat(m.difficulty)},e.a.createElement(W.a,{min:0,max:m.items_count,formatter:oe}))})))}))}}]),c}(e.a.Component),je=xe,Ke=[{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(D){Object(X.a)(c,D);var y=Object(V.a)(c);function c(r){var t;return Object(I.a)(this,c),t=y.call(this,r),t.state={},t}return Object(S.a)(c,[{key:"render",value:function(){var t=this.props.form,d=this.props.optinalData;return e.a.createElement("div",null,d.map(function(i,n){return e.a.createElement("div",{key:i.item_type},e.a.createElement(je,{form:t,data:i}),n===d.length-1?null:e.a.createElement(Y.a,null))}),e.a.createElement(ve,null))}}]),c}(e.a.Component),Fe=Ce,Te=function(y){var c=y.title,r=y.score,t=y.totalCount;return e.a.createElement("div",null,c,":",r&&r>0?e.a.createElement("span",{style:{marginLeft:4,color:"#999",fontSize:12}},"(\u5171 ",r," \u5206)"):null)},Ae=function(D){Object(X.a)(c,D);var y=Object(V.a)(c);function c(r){var t;return Object(I.a)(this,c),t=y.call(this,r),t.state={},t}return Object(S.a)(c,[{key:"render",value:function(){if(!this.props.form)return"";var t=this.props.form,d=t.getFieldDecorator,i=t.getFieldsValue,n=Object.keys(H),o=i(),s=0;return e.a.createElement("div",null,n.map(function(u){var E=Object.keys(o).filter(function(p){return p.includes("".concat(u,"-"))&&o[p]}),b=0,_=0;return E.map(function(p){return b+=o[p],_=b*o["score-".concat(u)],null}),s+=_,E.length>0?e.a.createElement(O.a,{align:"middle"},e.a.createElement(x.a,null,e.a.createElement(P.a.Item,{label:e.a.createElement(Te,{title:H[u],score:_,totalCount:b}),name:"score-".concat(u),colon:!1,key:H[u],rules:[{required:!0,message:"\u5206\u6570\u4E0D\u80FD\u4E3A\u7A7A"}]},e.a.createElement(W.a,{min:1,max:100,placeholder:"\u8BF7\u8F93\u5165\u8BD5\u9898\u5206\u6570\u8BBE\u7F6E",style:{width:150}}))),e.a.createElement(x.a,{flex:1},e.a.createElement("span",{style:{marginLeft:8,position:"relative",top:2}},"\u5206/\u9898"))):null}),s&&s>0?e.a.createElement("div",{style:{marginTop:16}},"\u5F53\u524D\u672C\u5377\u603B\u5206",e.a.createElement("span",{style:{color:"#1890FF"}}," ",s," "),"\u5206"):null)}}]),c}(e.a.Component),Me=Ae,Se=J.a.Step,H={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"},be={1:"\u7B80\u5355",2:"\u9002\u4E2D",3:"\u56F0\u96BE"},Ne=function(D){Object(X.a)(c,D);var y=Object(V.a)(c);function c(r){var t;return Object(I.a)(this,c),t=y.call(this,r),t.getPaperData=function(){var d=window.location.href.split("/").pop(),i=[];t.setState({loading:!0}),Object($.a)("/api/examination_banks/".concat(d,"/edit_random_exam.json"),{method:"get"}).then(function(n){if(t.setState({loading:!1}),n==null?void 0:n.contents){var o=n.contents,s=n.groups,u=n.examination_bank,E=n.score_settings,b=n.all_sub_disciplines,_=n.all_tag_disciplines,p={},f={};Array.isArray(o)&&o.map(function(l){return p=Object(U.a)(Object(U.a)({},p),{},Object(Z.a)({},"count-".concat(l.item_type,"-").concat(l.sub_discipline_id,"-").concat(l.difficulty,"-").concat(l.tag_discipline_id),l.quanlity)),null}),E.map(function(l){return f=Object(U.a)(Object(U.a)({},f),{},Object(Z.a)({},"score-".concat(l.item_type),l.score)),null}),_.map(function(l,v){b.map(function(g,L){if((l==null?void 0:l.sub_discipline_id)===(g==null?void 0:g.sub_discipline_id)){var Q={id:l.tag_discipline_id,name:l.tag_discipline_name,parent_name:g.sub_discipline_name,is_default:!0};i.push(Q)}})});var m=Object(U.a)(Object(U.a)({},u),{},{subDisciplines:i,group_ids:s==null?void 0:s.map(function(l){return l.id})});t.state.form.setFieldsValue(m),t.setState({formValue:m}),t.setState({countData:p,scoreData:f});var R=u.source;t.getdisciplines(R)}else B.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,i="/api/disciplines.json";Object($.a)(i,{params:{source:"question",public:d}}).then(function(n){(n==null?void 0:n.disciplines)&&t.setState({disciplines:n.disciplines})}).catch(function(n){console.log(n)})},t.getQuestionNumbers=function(){var d;t.setState({loading:!0});var i=t.state.form.getFieldValue("subDisciplines").map(function(u){return u.id}),n=t.state.form.getFieldValue("source"),o=(d=t.state.disciplines)===null||d===void 0?void 0:d.map(function(u){return u.id}),s={group_ids:t.state.form.getFieldValue("group_ids"),source:n===1?0:2};i.length?s.tag_discipline_ids=i:s.discipline_ids=o,Object($.a)("/api/examination_intelligent_settings/optional_items.json",{method:"post",body:s}).then(function(u){t.setState({loading:!1}),u.contents&&(t.setState({optinalData:u.contents}),t.state.form.setFieldsValue(Object(U.a)({},t.state.countData)))})},t.next=Object(M.a)(A.a.mark(function d(){var i,n,o,s,u,E,b,_,p,f,m,R,l,v;return A.a.wrap(function(L){for(;;)switch(L.prev=L.next){case 0:if(i=t.state.current+1,!(t.state.current===0)){L.next=13;break}return L.next=4,t.state.form.validateFields(["name","time","difficulty","source"]);case 4:if(n=t.state.form.getFieldsValue(),o=n.subDisciplines,s=o===void 0?[]:o,u=n.group_ids,E=u===void 0?[]:u,!(!s.length&&!E.length)){L.next=9;break}return B.b.warn("\u5FC5\u987B\u9009\u62E9\u8003\u5BDF\u8303\u56F4\u6216\u8BD5\u9898\u6587\u4EF6\u5939\u7684\u5176\u4E2D\u4E00\u9879\uFF0C\u624D\u80FD\u8FDB\u884C\u4E0B\u4E00\u6B65"),L.abrupt("return");case 9:t.setState({current:i}),t.getQuestionNumbers(),L.next=14;break;case 13:t.state.current===1&&t.idEdit?(t.state.form.setFieldsValue(Object(U.a)({},t.state.scoreData)),t.setState({current:i})):t.state.current===1&&(b=0,_=t.state.form.getFieldsValue(),p=_.name,f=_.difficulty,m=_.time,R=_.source,l=_.subDisciplines,v=Object(ie.a)(_,["name","difficulty","time","source","subDisciplines"]),Object.keys(v).forEach(function(Q){v[Q]>0&&++b}),b===0?B.b.error("\u8BF7\u586B\u5199\u9898\u578B\u6570\u91CF"):t.setState({current:i}));case 14:case"end":return L.stop()}},d)})),t.prev=function(){var d=t.state.current-1;t.setState({current:d})},t.submit=Object(M.a)(A.a.mark(function d(){var i,n,o,s,u,E,b,_,p,f,m;return A.a.wrap(function(l){for(;;)switch(l.prev=l.next){case 0:return l.next=2,t.state.form.validateFields();case 2:i=t.state.form.getFieldsValue(),n=i.exam_notes,o=i.group_ids,s=i.name,u=i.difficulty,E=i.time,b=i.source,_=Object(ie.a)(i,["exam_notes","group_ids","name","difficulty","time","source"]),p=[],f=[],Object.keys(_).map(function(v){if(v.includes("count")){var g=v.split("-")[1],L=v.split("-")[2],Q=v.split("-")[3],Be=v.split("-")[4];i[v]!==0&&f.push({item_type:g,difficulty:Q,sub_discipline_id:L,items_count:i[v],tag_discipline_id:Be})}else if(v.includes("score")){var Ie=v.split("-")[1];p.push({item_type:Ie,score:i[v]})}return null}),m={name:s,difficulty:u,time:E,source:b,score_settings:p,contents:f,exam_notes:n,group_ids:o,sub_discipline_id:0},t.idEdit?t.updatePaper(m):t.createPaper(m);case 9:case"end":return l.stop()}},d)})),t.createPaper=function(d){t.setState({loading:!0}),Object($.a)("/api/examination_banks/create_random_exam.json",{method:"post",body:Object(U.a)({},d)}).then(function(i){t.setState({loading:!1}),i.status===0&&(B.b.success("\u521B\u5EFA\u6210\u529F"),t.props.history.push("/paperlibrary"))})},t.updatePaper=function(d){t.setState({loading:!0});var i=window.location.href.split("/").pop();Object($.a)("/api/examination_banks/".concat(i,"/update_random_exam.json"),{method:"post",body:Object(U.a)({},d)}).then(function(n){t.setState({loading:!1}),n.status===0&&(B.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(S.a)(c,[{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,i=d.current,n=d.disciplines,o=e.a.createElement(T.a,{onClick:function(){t.confirm()},style:{marginRight:16}},"\u8FD4\u56DE"),s=e.a.createElement(T.a,{type:"primary",onClick:function(){return t.next()}},"\u4E0B\u4E00\u6B65"),u=e.a.createElement(T.a,{onClick:function(){return t.prev()},style:{marginRight:16}},"\u4E0A\u4E00\u6B65"),E=e.a.createElement(T.a,{onClick:function(){return t.submit()},type:"primary"},"\u5B8C\u6210\u7EC4\u5377"),b=[{title:"\u57FA\u672C\u4FE1\u606F",content:e.a.createElement(Oe,{formValue:this.state.formValue,disciplines:n,getdisciplines:this.getdisciplines,form:this.state.form})},{title:"\u9898\u578B\u6570\u91CF",content:e.a.createElement(Fe,{form:this.state.form,optinalData:this.state.optinalData})},{title:"\u8D4B\u5206\u8BBE\u7F6E",content:e.a.createElement(Me,{form:this.state.form})}];return e.a.createElement("div",{style:{width:1200,margin:"0px auto"}},e.a.createElement(j.a,{separator:">",style:{padding:"12px 0px"}},e.a.createElement(j.a.Item,null,e.a.createElement(fe.Link,{to:"/paperlibrary",onClick:function(p){p.preventDefault(),t.confirm("/paperlibrary")}},"\u8BD5\u5377\u5E93")),e.a.createElement(j.a.Item,null,"\u968F\u673A\u7EC4\u5377")),e.a.createElement(P.a,{from:this.state.form,onValuesChange:function(){return t.setState({formValue:Object(U.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(k.a,{style:{marginTop:12}},e.a.createElement("div",{style:{display:"flex",justifyContent:"center",padding:20}},e.a.createElement(J.a,{current:i,style:{width:780}},b.map(function(_){return e.a.createElement(Se,{key:_.title,title:_.title})}))),e.a.createElement(Y.a,null),e.a.createElement(ae.a,{spinning:this.state.loading},b.map(function(_,p){return e.a.createElement("div",{style:{display:p===i?"block":"none"},key:p,className:"pl20 pr20"},_.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,i===0?o:u,i===b.length-1?E:s))))}}]),c}(e.a.Component),We=F.default=Ne},Eaj2:function(G,F,a){G.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"}},"P/tu":function(G,F,a){"use strict";var ye=a("ozfa"),P=a("MJZm"),de=a("0Owb"),k=a("WmNS"),te=a.n(k),ae=a("9og8"),ne=a("tJVT"),Y=a("PpiC"),w=a("q1tI"),j=a.n(w),_e=a("WCUW"),T=a("spXi"),z=a.n(T),A=function(M){var se=M.value,B=M.onChange,Z=M.defaultValue,U=Object(Y.a)(M,["value","onChange","defaultValue"]),I=Object(w.useState)([]),S=Object(ne.a)(I,2),X=S[0],V=S[1],ce=Object(w.useState)("1"),J=Object(ne.a)(ce,2),le=J[0],e=J[1];Object(w.useEffect)(function(){me()},[]);var me=function(){var C=Object(ae.a)(te.a.mark(function K(){var O,h;return te.a.wrap(function(N){for(;;)switch(N.prev=N.next){case 0:return N.next=2,Object(_e.x)({});case 2:O=N.sent,(O==null?void 0:O.data)&&(h=[{title:j.a.createElement("div",{title:"\u6839\u76EE\u5F55",className:z.a.name},"\u6839\u76EE\u5F55"),value:0,key:0,icon:j.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:ue(O.data||[])}],V(h),e("2"));case 4:case"end":return N.stop()}},K)}));return function(){return C.apply(this,arguments)}}(),ue=function(K){function O(h){var x=h.children,N=Array.isArray(x)&&x.length>0,W=h==null?void 0:h.group_id;return{title:j.a.createElement("div",{title:h==null?void 0:h.name,className:z.a.name},h==null?void 0:h.name),value:W,key:W,icon:j.a.createElement("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:N?x==null?void 0:x.map(function(q){return O(q)}):[]}}return K==null?void 0:K.map(function(h){return O(h)})},Ee=Z?{defaultExpandedKeys:[0]}:{selectedKeys:se,defaultExpandedKeys:se};return j.a.createElement("div",{className:z.a.customTree},j.a.createElement(P.a,Object(de.a)({key:le},Ee,{showIcon:!0,treeData:X,onSelect:B},U)))};F.a=A},spXi:function(G,F,a){G.exports={flex_box_center:"flex_box_center___2B_Y7",flex_space_between:"flex_space_between___2olzC",flex_box_vertical_center:"flex_box_vertical_center___2Z4dV",flex_box_center_end:"flex_box_center_end___3FiwX",flex_box_column:"flex_box_column___8kyK-",customTree:"customTree___1KOYx",name:"name___3pqs4"}}}]);
|