You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/static/js/31.65dcc251.chunk.js

1 line
25 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

(this.webpackJsonp=this.webpackJsonp||[]).push([[31],{ekkM:function(e,t,n){"use strict";n.r(t),n.d(t,"questionType",(function(){return Se})),n.d(t,"difficultType",(function(){return xe}));n("6rnn");var r,o=n("d6B9"),i=(n("R/VY"),n("ZzqE")),a=(n("N452"),n("Wyac")),c=(n("7fbo"),n("LCR/")),l=(n("ZuIQ"),n("DbVt")),u=(n("Y5Ue"),n("xc0u")),s=(n("GpNG"),n("1GiV")),f=(n("jvqI"),n("z0KO")),p=n("xwgP"),m=n.n(p),y=n("sYIF"),d=n("5A3O"),b=(n("bqBU"),n("4OHk")),h=(n("oB2B"),n("ijLx")),v=(n("/mds"),n("aLG4")),g=(n("rJH4"),n("nKmx")),E=(n("kvrU"),n("BPQb")),O=n("DHRj"),_=n("nIBk"),w=function(){return m.a.createElement("div",{style:{textAlign:"right",fontSize:12,color:"#ccc",marginTop:95}},"如考察范围不能满足需求,请自行补充试题充实考察范围",m.a.createElement(_.a,{to:"/problemset",target:"_blank",style:{marginLeft:10,color:"#1890FF"}},"现在就去"))};function j(e){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e){return function(e){if(Array.isArray(e))return x(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return x(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return x(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function D(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=T(e);if(t){var o=T(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return C(this,n)}}function C(e,t){return!t||"object"!==j(t)&&"function"!=typeof t?F(e):t}function F(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function V(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var I,B,A=function(e){return!e||Number.isNaN(Number(e))?"":Math.ceil(e)},L=Object(O.b)(E.a.Button)(r||(I=["\n &.ant-radio-button-wrapper {\n width: 106px;\n height: 33px;\n text-align: center;\n margin-top: 6px;\n border-radius: 17px;\n background: #eeeeee;\n outline: none;\n }\n &.ant-radio-button-wrapper-checked {\n background: #4cacff;\n color: #ffffff;\n }\n &.ant-radio-button-wrapper-checked:focus-within {\n outline: none !important;\n }\n .ant-radio-button {\n text-align: center;\n }\n &.ant-radio-button-wrapper:not(:first-child)::before {\n width: 0px !important;\n border-radius: 17px;\n }\n"],B||(B=I.slice(0)),r=Object.freeze(Object.defineProperties(I,{raw:{value:Object.freeze(B)}})))),z=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&R(e,t)}(c,e);var t,n,r,a=D(c);function c(){var e;k(this,c);for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return V(F(e=a.call.apply(a,[this].concat(n))),"subDisciplinesAdd",(function(t){var n=e.props.form.getFieldValue("subDisciplines")||[];n.filter((function(e){return t.id===e.id})).length>0?s.a.error("您已经选择过此方向!"):e.props.form.setFieldsValue({subDisciplines:[].concat(S(n),[t])})})),V(F(e),"disciplinesRemove",(function(t){var n=e.props.form.getFieldValue("subDisciplines")||[];e.props.form.setFieldsValue({subDisciplines:n.filter((function(e){return e.id!==t.id}))})})),V(F(e),"handleSourceRadioChange",(function(t){e.props.getdisciplines(t.target.value),e.props.form.setFieldsValue({subDisciplines:[]})})),e}return t=c,(n=[{key:"render",value:function(){var e=this,t=this.props,n=t.disciplines,r=t.form,a=r.getFieldDecorator,c=r.getFieldValue,l=c("subDisciplines")||[];return m.a.createElement(o.a,null,m.a.createElement(o.a.Item,{label:"试卷名称:"},a("name",{rules:[{required:!0,message:"试卷名称不能为空"}]})(m.a.createElement(g.a,{style:{height:38},placeholder:"请输入试卷标题最多60字",suffix:c("name")?c("name").length+"/60":"0/60",maxLength:60}))),m.a.createElement(o.a.Item,{label:"考试时长:"},a("time",{rules:[{required:!0,message:"考试时长不能为空"}]})(m.a.createElement(v.a,{min:1,max:9999,formatter:A,placeholder:"请输入试卷考试时长",style:{width:150}})),m.a.createElement("span",{style:{marginLeft:8}},"分钟")),m.a.createElement(o.a.Item,{label:"难度"},a("difficulty",{rules:[{required:!0,message:"请选择难度"}]})(m.a.createElement(E.a.Group,{style:{display:"flex",width:400,justifyContent:"space-between",marginBottom:6},buttonStyle:"solid"},m.a.createElement(L,{value:1},"简单"),m.a.createElement(L,{value:2},"适中"),m.a.createElement(L,{value:3},"困难")))),m.a.createElement(o.a.Item,{label:"试题来源",style:{width:"100%"},extra:m.a.createElement("span",{style:{color:"#999",position:"absolute",left:100,top:"-28px",fontSize:12}},"(为保证考察准确性,建议使用私有题库)")},a("source",{rules:[{required:!0,message:"请选择试题来源"}],initialValue:1})(m.a.createElement(E.a.Group,{style:{display:"flex",width:700,justifyContent:"space-between"},onChange:function(t){e.handleSourceRadioChange(t)}},m.a.createElement(E.a,{value:1},"仅私有题库"),m.a.createElement(E.a,{value:0},"公共题库+私有题库")))),m.a.createElement(o.a.Item,{label:"考查范围:"},a("subDisciplines",{rules:[{required:!0,message:"请选择考查范围"}]})(m.a.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},n.map((function(t){return m.a.createElement(h.a,{key:"disciplines"+t.id,placement:"bottomLeft",overlay:m.a.createElement(i.a,{style:{maxWidth:600,display:"flex",msFlexDirection:"row",flexWrap:"warp",justifyContent:"center"}},t.sub_disciplines.length>0?t.sub_disciplines.map((function(t){return m.a.createElement("div",{style:{display:"inline-block",margin:"6px 12px"},key:"sub_disciplines"+t.id},m.a.createElement("a",{className:"color-dark",onClick:function(){e.subDisciplinesAdd(t)}},t.name))})):"暂无数据")},m.a.createElement(u.a,{style:{marginRight:12,marginTop:6,marginBottom:6}},t.name))}))))),l.length>0?m.a.createElement("div",{style:{minHeight:150,backgroundColor:"#FAFAFA"}},m.a.createElement("div",{style:{paddingLeft:12,paddingTop:12}},"已选"),m.a.createElement("div",{style:{display:"flex",flexWrap:"wrap"}},l.map((function(t){return m.a.createElement("div",{key:"subDisciplinesList"+t.id},m.a.createElement(u.a,{style:{margin:"12px 6px",backgroundColor:"#F6FFED"},onClick:function(){e.disciplinesRemove(t)}},t.name,m.a.createElement(b.a,{type:"close-circle"})))})))):null,m.a.createElement(w,null))}}])&&P(t.prototype,n),r&&P(t,r),c}(m.a.Component),q=n("91MD"),N=n.n(q);n("dQO7");function M(e){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function W(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function U(e,t){return(U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function H(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Q(e);if(t){var o=Q(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return J(this,n)}}function J(e,t){return!t||"object"!==M(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Q(e){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Y=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&U(e,t)}(a,e);var t,n,r,i=H(a);function a(){return W(this,a),i.apply(this,arguments)}return t=a,(n=[{key:"render",value:function(){var e=this.props.form,t=e.getFieldDecorator,n=e.getFieldsValue,r=(e.setFieldsValue,this.props.data),i=r.item_type,a=r.items_by_item_type,c=function(e){var t=e.difficult,n=e.count;return m.a.createElement("div",{style:{marginRight:10,lineHeight:"18px"}},m.a.createElement("div",{style:{fontSize:14,textAlign:"left"}},xe[t]),m.a.createElement("div",{style:{fontSize:12,color:"#999999"}},"(共 ",n," 题可选)"))},l=n(),u=Object.keys(l).filter((function(e){return e.includes("".concat(i,"-"))&&l[e]})),s=0;return u.map((function(e){return s+=l[e],null})),m.a.createElement("div",null,m.a.createElement("div",null,Se[i],A(s)>0?m.a.createElement("span",{style:{color:"#999999",fontSize:12}},"(已选 ",A(s)," 题)"):null),a.map((function(e){return m.a.createElement("div",{key:i+e.discipline_id+e.sub_discipline_id},m.a.createElement("div",{style:{fontSize:16,margin:"16px 0px",fontWeight:"500"}},e.discipline_name," / ",e.sub_discipline_name),m.a.createElement("div",null,e.items_by_item_type_and_sub_discipline.map((function(n){return m.a.createElement(o.a.Item,{label:m.a.createElement(c,{count:n.items_count,difficult:n.difficulty}),colon:!1,style:{width:"30%"},key:"".concat(i,"-").concat(e.sub_discipline_id,"-").concat(n.difficulty)},t("count-".concat(i,"-").concat(e.sub_discipline_id,"-").concat(n.difficulty),{initialValue:0})(m.a.createElement(v.a,{min:0,max:n.items_count,formatter:A})),m.a.createElement("span",{style:{marginLeft:8}},"题"))}))))})))}}])&&G(t.prototype,n),r&&G(t,r),a}(m.a.Component);function K(e){return(K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Z(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $(e,t){return($=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function X(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=te(e);if(t){var o=te(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return ee(this,n)}}function ee(e,t){return!t||"object"!==K(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function te(e){return(te=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ne,re=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&$(e,t)}(a,e);var t,n,r,i=X(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=i.call(this,e)).state={},t}return t=a,(n=[{key:"render",value:function(){var e=this.props.form,t=this.props.optinalData;return m.a.createElement(o.a,{layout:"inline"},t.map((function(n,r){return m.a.createElement("div",{key:n.item_type},m.a.createElement(Y,{form:e,data:n}),r===t.length-1?null:m.a.createElement(c.a,null))})),m.a.createElement(w,null))}}])&&Z(t.prototype,n),r&&Z(t,r),a}(m.a.Component);function oe(e){return(oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ae(e,t){return(ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ce(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ue(e);if(t){var o=ue(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return le(this,n)}}function le(e,t){return!t||"object"!==oe(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ue(e){return(ue=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var se=function(e){var t=e.title,n=e.score;e.totalCount;return m.a.createElement("div",null,t,":",n&&n>0?m.a.createElement("span",{style:{marginLeft:4,color:"#999",fontSize:12}},"(共 ",n," 分)"):null)},fe=Object(O.b)(o.a.Item)(ne||(ne=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}(["\n & .ant-form-item-required {\n display: flex;\n }\n & .ant-form-item-required::before {\n line-height: 41px;\n }\n"]))),pe=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ae(e,t)}(a,e);var t,n,r,i=ce(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=i.call(this,e)).state={},t}return t=a,(n=[{key:"render",value:function(){var e=this.props.form,t=e.getFieldDecorator,n=e.getFieldsValue,r=Object.keys(Se),i=n(),a=0;return m.a.createElement(o.a,null,r.map((function(e){var n=Object.keys(i).filter((function(t){return t.includes("".concat(e,"-"))&&i[t]})),r=0,o=0;return n.map((function(t){return r+=i[t],o=r*i["score-".concat(e)],null})),a+=o,n.length>0?m.a.createElement(fe,{label:m.a.createElement(se,{title:Se[e],score:o,totalCount:r}),colon:!1,key:Se[e]},t("score-".concat(e),{rules:[{required:!0,message:"分数不能为空"}]})(m.a.createElement(v.a,{min:1,max:100,formatter:A,placeholder:"请输入试题分数设置",style:{width:150}})),m.a.createElement("span",{style:{marginLeft:8}},"分/题")):null})),a&&a>0?m.a.createElement("div",{style:{marginTop:16}},"当前本卷总分",m.a.createElement("span",{style:{color:"#1890FF"}}," ",a," "),"分"):null)}}])&&ie(t.prototype,n),r&&ie(t,r),a}(m.a.Component);function me(e){return(me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ye(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function de(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?de(Object(n),!0).forEach((function(t){we(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):de(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function he(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ve(e,t){return(ve=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ge(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=_e(e);if(t){var o=_e(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ee(this,n)}}function Ee(e,t){return!t||"object"!==me(t)&&"function"!=typeof t?Oe(e):t}function Oe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _e(e){return(_e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function we(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var je=f.a.Step,Se={SINGLE:"单选题",MULTIPLE:"多选题",JUDGMENT:"判断题",COMPLETION:"填空题",SUBJECTIVE:"简答题",PRACTICAL:"实训题",PROGRAM:"编程题"},xe={1:"简单",2:"适中",3:"困难"},ke=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ve(e,t)}(p,e);var t,n,r,o=ge(p);function p(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),we(Oe(t=o.call(this,e)),"getPaperData",(function(){var e=window.location.href.split("/").pop();t.setState({loading:!0}),N.a.get("/examination_banks/".concat(e,"/edit_random_exam.json")).then((function(e){if(t.setState({loading:!1}),200===e.status){var n=e.data,r=n.contents,o=n.examination_bank,i=n.score_settings,a=n.all_sub_disciplines,c={},l={};r.map((function(e){return c=be(be({},c),{},we({},"count-".concat(e.item_type,"-").concat(e.sub_discipline_id,"-").concat(e.difficulty),e.quanlity)),null})),i.map((function(e){return l=be(be({},l),{},we({},"score-".concat(e.item_type),e.score)),null})),t.props.form.setFieldsValue(be(be({},o),{},{subDisciplines:a.map((function(e){return{id:e.sub_discipline_id,name:e.sub_discipline_name}}))})),t.setState({countData:c,scoreData:l});var u=o.source;t.getdisciplines(u)}else s.a.error("获取试卷信息错误")}))})),we(Oe(t),"getdisciplines",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n="/disciplines.json";N.a.get(n,{params:{source:"question",public:e}}).then((function(e){200==e.status&&t.setState({disciplines:e.data.disciplines})})).catch((function(e){console.log(e)}))})),we(Oe(t),"getQuestionNumbers",(function(){t.setState({loading:!0});var e=t.props.form.getFieldValue("subDisciplines").map((function(e){return e.id})),n=t.props.form.getFieldValue("source");N.a.post("/examination_intelligent_settings/optinal_items.json",{sub_discipline_ids:e,source:1===n?0:2}).then((function(e){t.setState({loading:!1}),200===e.status&&(t.setState({optinalData:e.data.contents}),t.props.form.setFieldsValue(be({},t.state.countData)))}))})),we(Oe(t),"next",(function(){var e=t.state.current+1;if(0===t.state.current)t.props.form.validateFields(["name","time","difficulty","source","subDisciplines"],(function(n,r){n||(t.setState({current:e}),t.getQuestionNumbers())}));else if(1===t.state.current&&t.idEdit)t.props.form.setFieldsValue(be({},t.state.scoreData)),t.setState({current:e});else if(1===t.state.current){var n=0,r=t.props.form.getFieldsValue(),o=(r.name,r.difficulty,r.time,r.source,r.subDisciplines,ye(r,["name","difficulty","time","source","subDisciplines"]));Object.keys(o).forEach((function(e){o[e]>0&&++n})),0===n?s.a.error("请填写题型数量"):t.setState({current:e})}})),we(Oe(t),"prev",(function(){var e=t.state.current-1;t.setState({current:e})})),we(Oe(t),"submit",(function(){t.props.form.getFieldsValue();t.props.form.validateFields((function(e,n){if(!e){var r=n.name,o=n.difficulty,i=n.time,a=n.source,c=ye(n,["name","difficulty","time","source"]),l=[],u=[];Object.keys(c).map((function(e){if(e.includes("count")){var t=e.split("-")[1],r=e.split("-")[2],o=e.split("-")[3];0!==n[e]&&u.push({item_type:t,difficulty:o,sub_discipline_id:r,items_count:n[e]})}else if(e.includes("score")){var i=e.split("-")[1];l.push({item_type:i,score:n[e]})}return null}));var s={name:r,difficulty:o,time:i,source:a,score_settings:l,contents:u};t.idEdit?t.updatePaper(s):t.createPaper(s)}}))})),we(Oe(t),"createPaper",(function(e){t.setState({loading:!0}),N.a.post("/examination_banks/create_random_exam.json",be({},e)).then((function(e){t.setState({loading:!1}),200===e.status&&(s.a.success("创建成功"),t.props.history.push("/paperlibrary"))}))})),we(Oe(t),"updatePaper",(function(e){t.setState({loading:!0});var n=window.location.href.split("/").pop();N.a.post("/examination_banks/".concat(n,"/update_random_exam.json"),be({},e)).then((function(e){t.setState({loading:!1}),200===e.status&&(s.a.success("编辑成功"),t.props.history.push("/paperlibrary"))}))})),we(Oe(t),"confirm",(function(e){window.confirm("确定离开此页面吗?此页数据可能会丢失")&&(e?t.props.history.push(e):t.props.history.push("/paperlibrary"))})),t.state={current:0,disciplines:[],loading:!1,optinalData:[],countData:{},scoreData:{}},t}return t=p,(n=[{key:"componentDidMount",value:function(){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(e){return(e||window.event).returnValue="确定离开此页面吗?此页数据可能会丢失","确定离开此页面吗?此页数据可能会丢失"}},{key:"render",value:function(){var e=this,t=this.props.form,n=this.state,r=n.current,o=n.disciplines,s=m.a.createElement(u.a,{onClick:function(){e.confirm()},style:{marginRight:16}},"返回"),p=m.a.createElement(u.a,{type:"primary",onClick:function(){return e.next()}},"下一步"),y=m.a.createElement(u.a,{onClick:function(){return e.prev()},style:{marginRight:16}},"上一步"),d=m.a.createElement(u.a,{onClick:function(){return e.submit()},type:"primary"},"完成组卷"),b=[{title:"基本信息",content:m.a.createElement(z,{disciplines:o,getdisciplines:this.getdisciplines,form:t})},{title:"题型数量",content:m.a.createElement(re,{form:t,optinalData:this.state.optinalData})},{title:"赋分设置",content:m.a.createElement(pe,{form:t})}];return m.a.createElement("div",{style:{width:1200,margin:"0px auto"}},m.a.createElement(l.a,{separator:">",style:{padding:"12px 0px"}},m.a.createElement(l.a.Item,null,m.a.createElement(_.a,{to:"/paperlibrary",onClick:function(t){t.preventDefault(),e.confirm("/paperlibrary")}},"试卷库")),m.a.createElement(l.a.Item,null,"随机组卷")),m.a.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},m.a.createElement("span",{style:{fontSize:20,fontWeight:600}},"随机组卷")),m.a.createElement(i.a,{style:{marginTop:12}},m.a.createElement("div",{style:{display:"flex",justifyContent:"center"}},m.a.createElement(f.a,{current:r,style:{width:780}},b.map((function(e){return m.a.createElement(je,{key:e.title,title:e.title})})))),m.a.createElement(c.a,null),m.a.createElement(a.a,{spinning:this.state.loading},b.map((function(e,t){return m.a.createElement("div",{style:{display:t===r?"block":"none"},key:t},e.content)})))),m.a.createElement("div",{style:{display:"flex",marginBottom:200,marginTop:12,justifyContent:"center"}},m.a.createElement("span",{style:{fontSize:20,fontWeight:600}}),m.a.createElement("span",null,0===r?s:y,r===b.length-1?d:p)))}}])&&he(t.prototype,n),r&&he(t,r),p}(m.a.Component);t.default=Object(y.m)()(Object(d.a)(o.a.create()(ke)))}}]);