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/p__Paperlibrary__Random__De...

1 line
16 KiB

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[147,11],{"/A5M":function(t,e,n){t.exports={randomIcon:"randomIcon___o7OlS"}},"00WW":function(t,e,n){"use strict";n("+L6B");var r=n("2/Rp"),a=n("q1tI"),i=n.n(a),o=n("ORPY"),c=n.n(o),l=n("rd/4"),s=n.n(l),u=n("3pxb"),f=n.n(u),p=function(t){var e=t.createState,n=t.refreshLoading,a=t.onRefresh,o=void 0===a?function(){}:a,l=t.onCreate,u=void 0===l?function(){}:l;return i.a.createElement("div",{className:c.a.sendToClass},e?i.a.createElement(i.a.Fragment,null,i.a.createElement("img",{src:s.a,alt:"\u7a7a"}),i.a.createElement("div",null,"\u60a8\u8fd8\u6ca1\u6709\u521b\u5efa\u6559\u5b66\u8bfe\u5802\uff0c\u65e0\u6cd5\u5c06\u8bd5\u5377\u53d1\u9001\u81f3\u6559\u5b66\u8bfe\u5802\u3002"),i.a.createElement(r["a"],{onClick:u,type:"primary",ghost:!0},"\u7acb\u5373\u521b\u5efa")):i.a.createElement(i.a.Fragment,null,i.a.createElement("img",{src:f.a,alt:"\u7a7a"}),i.a.createElement("div",null,"\u5df2\u521b\u5efa\u6559\u5b66\u8bfe\u5802\uff1f\u8bf7\u5237\u65b0\u5217\u8868"),i.a.createElement(r["a"],{loading:n,onClick:o,type:"primary",ghost:!0},"\u7acb\u5373\u5237\u65b0")))};e["a"]=p},"3pxb":function(t,e,n){t.exports=n.p+"static/refresh.c0b88523.png"},MpT9:function(t,e,n){"use strict";n.r(e),n.d(e,"questionType",(function(){return W})),n.d(e,"difficultType",(function(){return A}));n("T2oS");var r=n("W9HT"),a=(n("IzEo"),n("bx4M")),i=(n("/zsF"),n("PArb")),o=(n("sPJy"),n("bE4q")),c=(n("+L6B"),n("2/Rp")),l=n("oBTY"),s=n("fWQN"),u=n("mtLc"),f=n("yKVA"),p=n("879j"),h=n("q1tI"),m=n.n(h),d=n("ErOA"),y=n("55Ip"),v=n("9kvl"),g=n("/A5M"),b=n.n(g),E=(n("2qtc"),n("kLXV")),w=(n("7Kak"),n("9yH6")),_=(n("miYZ"),n("tsqr")),x=n("9og8"),O=n("tJVT"),L=n("PpiC"),j=(n("5NDa"),n("5rEg")),k=n("Ty5D"),S=n("hzL8"),C=n.n(S),T=n("1vsH"),N=n("00WW");function I(){I=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function s(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var i=e&&e.prototype instanceof v?e:v,o=Object.create(i.prototype),c=new T(r||[]);return a(o,"_invoke",{value:j(t,n,c)}),o}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=u;var p="suspendedStart",h="suspendedYield",m="executing",d="completed",y={};function v(){}function g(){}function b(){}var E={};s(E,o,(function(){return this}));var w=Object.getPrototypeOf,_=w&&w(w(N([])));_&&_!==n&&r.call(_,o)&&(E=_);var x=b.prototype=v.prototype=Object.create(E);function O(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function n(a,i,o,c){var l=f(t[a],t,i);if("throw"!==l.type){var s=l.arg,u=s.value;return u&&"object"==typeof u&&r.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,o,c)}),(function(t){n("throw",t,o,c)})):e.resolve(u).then((function(t){s.value=t,o(s)}),(function(t){return n("throw",t,o,c)}))}c(l.arg)}var i;a(this,"_invoke",{value:function(t,r){function a(){return new e((function(e,a){n(t,r,e,a)}))}return i=i?i.then(a,a):a()}})}function j(e,n,r){var a=p;return function(i,o){if(a===m)throw new Error("Generator is already running");if(a===d){if("throw"===i)throw o;return{value:t,done:!0}}for(r.method=i,r.arg=o;;){var c=r.delegate;if(c){var l=k(c,r);if(l){if(l===y)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===p)throw a=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=m;var s=f(e,n,r);if("normal"===s.type){if(a=r.done?d:h,s.arg===y)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(a=d,r.method="throw",r.arg=s.arg)}}}function k(e,n){var r=n.method,a=e.iterator[r];if(a===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,k(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var i=f(a,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,y;var o=i.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function N(e){if(e||""===e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,i=function n(){for(;++a<e.length;)if(r.call(e,a))return n.value=e[a],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return g.prototype=b,a(x,"constructor",{value:b,configurable:!0}),a(b,"constructor",{value:g,configurable:!0}),g.displayName=s(b,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,l,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},O(L.prototype),s(L.prototype,c,(function(){return this})),e.AsyncIterator=L,e.async=function(t,n,r,a,i){void 0===i&&(i=Promise);var o=new L(u(t,n,r,a),i);return e.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},O(x),s(x,l,"Generator"),s(x,o,(function(){return this})),s(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=N,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function a(r,a){return c.type="throw",c.arg=e,n.next=r,a&&(n.method="next",n.arg=t),!!a}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],c=o.completion;if("root"===o.tryLoc)return a("end");if(o.tryLoc<=this.prev){var l=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(l&&s){if(this.prev<o.catchLoc)return a(o.catchLoc,!0);if(this.prev<o.finallyLoc)return a(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return a(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return a(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;C(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:N(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}var F=j["a"].Search,P=function(t){t.paperlibrary,t.globalSetting;var e=t.loading,n=t.dispatch,r=t.visible,a=t.onCancel,i=void 0===a?function(){}:a,o=(Object(L["a"])(t,["paperlibrary","globalSetting","loading","dispatch","visible","onCancel"]),Object(k["m"])()),c=Object(h["useState"])(""),l=Object(O["a"])(c,2),s=l[0],u=l[1],f=Object(h["useState"])([]),p=Object(O["a"])(f,2),d=p[0],y=p[1],v=Object(h["useState"])(),g=Object(O["a"])(v,2),b=g[0],j=g[1],S=Object(h["useState"])(!1),P=Object(O["a"])(S,2),G=P[0],W=P[1],A=Object(h["useState"])(!0),R=Object(O["a"])(A,2),M=R[0],q=R[1],z=Object(h["useState"])(!1),V=Object(O["a"])(z,2),B=V[0],D=V[1];Object(h["useEffect"])((function(){J()}),[]);var J=function(){var t=Object(x["a"])(I().mark((function t(){var e;return I().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,n({type:"paperlibrary/getCourseList",payload:{search:s}});case 2:e=t.sent,e&&(y((null===e||void 0===e?void 0:e.courses)||[]),q(!0),D(!1));case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),Y=function(){var t=Object(x["a"])(I().mark((function t(){var e,r,a,i;return I().wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(b){t.next=4;break}return _["b"].info("\u60a8\u9700\u8981\u521b\u5efa\u8bfe\u5802\uff0c\u624d\u80fd\u53d1\u9001"),W(!0),t.abrupt("return");case 4:return t.next=6,n({type:"paperlibrary/sendToClass",payload:{course_id:b,id:o.id}});case 6:e=t.sent,U(),e&&0===e.status&&(i=null===e||void 0===e||null===(r=e.first_category_url)||void 0===r||null===(a=r.split("/"))||void 0===a?void 0:a[2],Object(T["L"])("/classrooms/".concat(i,"/exercise")));case 9:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),U=function(){i()},H=function(){var t=Object(x["a"])(I().mark((function t(){return I().wrap((function(t){while(1)switch(t.prev=t.next){case 0:return D(!0),t.next=3,J();case 3:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return m.a.createElement(E["a"],{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:r,title:"\u53d1\u9001\u81f3\u8bfe\u5802",okText:"\u786e\u5b9a",cancelText:"\u53d6\u6d88",confirmLoading:e["paperlibrary/sendToClass"],width:600,onOk:Y,onCancel:U},m.a.createElement("div",{className:C.a.wrap},m.a.createElement("div",{className:C.a.title},"\u6e29\u99a8\u63d0\u793a\uff1a\u9009\u62e9\u7684\u8bd5\u5377\u5c06\u4f1a\u53d1\u9001\u5230\u6307\u5b9a\u8bfe\u5802"),m.a.createElement("div",{className:"mb10"},m.a.createElement(F,{placeholder:"\u8f93\u5165\u8bfe\u5802\u540d\u79f0\u7684\u5173\u952e\u5b57\u8fdb\u884c\u641c\u7d22",value:s,onChange:function(t){return u(t.target.value)},onSearch:function(t){u(t),J()}})),d.length?m.a.createElement("div",{className:C.a.radioWrap},m.a.createElement(w["a"].Group,{value:b,onChange:function(t){j(t.target.value),W(!1)}},d.map((function(t,e){return m.a.createElement(w["a"],{className:C.a.radio,value:t.course_id,key:t.course_id},t.course_name)})))):!s&&m.a.createElement(N["a"],{createState:M,refreshLoading:B,onRefresh:H,onCreate:function(){q(!1),Object(T["L"])("/classrooms/new")}}),m.a.createElement("div",{className:"c-grey-999"},"\u672c\u5217\u8868\u4ec5\u8bfb\u53d6\u672c\u4eba\u7ba1\u7406\u7684\u3001\u4f7f\u7528\u4e2d\u7684\u8bfe\u5802\uff0c\u4e0d\u542b\u5df2\u7ed3\u675f\u8bfe\u5802"),G&&m.a.createElement("div",{className:C.a.colorFF0000},"\u8bf7\u5148\u9009\u62e9\u8bfe\u5802")))},G=Object(v["a"])((function(t){var e=t.paperlibrary,n=t.loading,r=t.globalSetting;return{paperlibrary:e,globalSetting:r,loading:n.effects}}))(P),W={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"},A={1:"\u7b80\u5355",2:"\u9002\u4e2d",3:"\u56f0\u96be"},R=["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341"],M=function(t){Object(f["a"])(n,t);var e=Object(p["a"])(n);function n(t){var r;return Object(s["a"])(this,n),r=e.call(this,t),r.getPaperData=function(){var t=window.location.href.split("/").pop();r.setState({loading:!0,id:t}),Object(d["a"])("/api/examination_banks/".concat(t,"/edit_random_exam.json"),{method:"get"}).then((function(t){if(r.setState({loading:!1}),t){var e=t.contents,n=t.examination_bank,a=t.score_settings;r.setState({contents:e,examination_bank:n,score_settings:a})}}))},r.state={loading:!1,contents:[],examination_bank:{},score_settings:[],modalVisible:!1,id:null},r}return Object(u["a"])(n,[{key:"componentDidMount",value:function(){this.getPaperData()}},{key:"render",value:function(){var t=this,e=this.state,n=e.contents,s=e.examination_bank,u=e.score_settings,f=(e.loading,[]),p=0,h=0;Object.keys(W).map((function(t){var e=0;n.map((function(n){n.item_type===t&&(e+=n.quanlity)}));var r=u.filter((function(e){return e.item_type===t}));f=[].concat(Object(l["a"])(f),[{item_type:t,num:e,score:r.length>0?r[0].score:0}])}));var d=f.filter((function(t){return 0!==t.num}));d.map((function(t){u.map((function(e){t.item_type===e.item_type&&(p+=t.num*e.score,h+=t.num)}))}));var g=m.a.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},m.a.createElement("div",{style:{display:"flex",justifyContent:"space-between",width:"50%",fontWeight:500,fontSize:"16px"}},m.a.createElement("span",null,"\u603b\u8ba1 ",d.length," \u5927\u9898\uff0c ",h," \u5c0f\u9898\uff0c\u603b\u5206 ",p," ","\u5206"),m.a.createElement("span",null,"\u8003\u8bd5\u65f6\u957f\uff1a ",s.time," \u5206\u949f"),m.a.createElement("span",null,"\u8bd5\u5377\u96be\u5ea6\uff1a",A[s.difficulty])),m.a.createElement("div",null,m.a.createElement(c["a"],{type:"primary",onClick:function(){return t.setState({modalVisible:!0})}},"\u53d1\u9001\u81f3\u8bfe\u5802")));return m.a.createElement("div",{style:{width:1200,margin:"0px auto"}},m.a.createElement(r["a"],{spinning:this.state.loading},m.a.createElement(o["a"],{separator:">",style:{padding:"12px 0px"}},m.a.createElement(o["a"].Item,null,"\u8bd5\u5377\u5e93"),m.a.createElement(o["a"].Item,null,m.a.createElement(y["Link"],{to:"/paperlibrary"},"\u6211\u7684\u8bd5\u5377\u5e93")),m.a.createElement(o["a"].Item,null,"\u8bd5\u5377\u67e5\u770b")),m.a.createElement("div",{style:{height:50,display:"flex",alignItems:"center"}},m.a.createElement("span",{style:{fontSize:20,fontWeight:600}},m.a.createElement("i",{className:"icon-leftarrow iconfont",style:{fontSize:14,marginRight:8,cursor:"pointer"},onClick:function(){v["c"].goBack()}}),s.name),m.a.createElement("span",{className:b.a.randomIcon},"\u968f\u673a")),m.a.createElement(a["a"],{title:g,style:{marginBottom:200}},d.map((function(t,e){var r=Array.from(new Set(n.map((function(e){return e.item_type===t.item_type?e.sub_discipline_id:null})).filter((function(t){return t}))));return m.a.createElement("div",null,m.a.createElement("div",{style:{color:"#1890FF"}},R[e],"\u3001",W[t.item_type],m.a.createElement("span",{style:{color:"#666666",marginLeft:5}},"(\u5171 ",t.num," \u9898\uff0c\u6bcf\u9898 ",t.score," \u5206)")),m.a.createElement("div",null,r.map((function(e){var r=n.filter((function(n){return n.sub_discipline_id===e&&t.item_type===n.item_type}));return m.a.createElement("div",{style:{marginTop:20,display:"flex"}},m.a.createElement("div",{style:{width:"30%",fontWeight:"600"}},m.a.createElement("span",null,"".concat(r[0].discipline_name," /\n ").concat(r[0].sub_discipline_name))),m.a.createElement("div",null,Object.keys(A).map((function(t){var e=0;return r.map((function(n){return n.difficulty==t&&(e=n.quanlity),null})),e>0?m.a.createElement("span",{style:{color:"#1890FF",marginLeft:30}},A[t],": ",e," \u9898"):null}))))}))),e===d.length-1?null:m.a.createElement(i["a"],null))}))),m.a.createElement(G,{visible:this.state.modalVisible,onCancel:function(){return t.setState({modalVisible:!1})}})))}}]),n}(m.a.Component);e["default"]=M},ORPY:function(t,e,n){t.exports={sendToClass:"sendToClass___2FQ8x"}},hzL8:function(t,e,n){t.exports={wrap:"wrap___3xew9",title:"title___33cBU",radioWrap:"radioWrap___1GJxe",radio:"radio___3W-Oi",colorFF0000:"colorFF0000___2cz8C",pagination:"pagination___NI6NC"}},"rd/4":function(t,e,n){t.exports=n.p+"static/noData.dc777645.png"}}]);