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

3 lines
16 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[151],{"/A5M":function(j,M,a){j.exports={randomIcon:"randomIcon___o7OlS"}},"00WW":function(j,M,a){"use strict";var Re=a("+L6B"),ee=a("2/Rp"),Ee=a("q1tI"),b=a.n(Ee),fe=a("ORPY"),re=a.n(fe),pe=a("rd/4"),z=a.n(pe),_e=a("3pxb"),oe=a.n(_e),ue=function(Y){var se=Y.createState,ie=Y.refreshLoading,S=Y.onRefresh,s=S===void 0?function(){}:S,te=Y.onCreate,le=te===void 0?function(){}:te;return b.a.createElement("div",{className:re.a.sendToClass},se?b.a.createElement(b.a.Fragment,null,b.a.createElement("img",{src:z.a,alt:"\u7A7A"}),b.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"),b.a.createElement(ee.a,{onClick:le,type:"primary",ghost:!0},"\u7ACB\u5373\u521B\u5EFA")):b.a.createElement(b.a.Fragment,null,b.a.createElement("img",{src:oe.a,alt:"\u7A7A"}),b.a.createElement("div",null,"\u5DF2\u521B\u5EFA\u6559\u5B66\u8BFE\u5802\uFF1F\u8BF7\u5237\u65B0\u5217\u8868"),b.a.createElement(ee.a,{loading:ie,onClick:s,type:"primary",ghost:!0},"\u7ACB\u5373\u5237\u65B0")))};M.a=ue},"3pxb":function(j,M,a){j.exports=a.p+"static/refresh.c0b88523.png"},MpT9:function(j,M,a){"use strict";a.r(M),a.d(M,"questionType",function(){return ce}),a.d(M,"difficultType",function(){return ne});var Re=a("T2oS"),ee=a("W9HT"),Ee=a("IzEo"),b=a("bx4M"),fe=a("/zsF"),re=a("PArb"),pe=a("sPJy"),z=a("bE4q"),_e=a("+L6B"),oe=a("2/Rp"),ue=a("oBTY"),he=a("fWQN"),Y=a("mtLc"),se=a("yKVA"),ie=a("879j"),S=a("q1tI"),s=a.n(S),te=a("ErOA"),le=a("55Ip"),ve=a("9kvl"),be=a("/A5M"),Oe=a.n(be),xe=a("2qtc"),Pe=a("kLXV"),Ie=a("7Kak"),ye=a("9yH6"),Xe=a("miYZ"),Ue=a("tsqr"),de=a("9og8"),J=a("tJVT"),De=a("PpiC"),we=a("5NDa"),Ce=a("5rEg"),Te=a("Ty5D"),Ae=a("hzL8"),k=a.n(Ae),ge=a("1vsH"),je=a("00WW");function K(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */K=function(){return E};var E={},R=Object.prototype,p=R.hasOwnProperty,F=Object.defineProperty||function(n,e,t){n[e]=t.value},_=typeof Symbol=="function"?Symbol:{},v=_.iterator||"@@iterator",D=_.asyncIterator||"@@asyncIterator",C=_.toStringTag||"@@toStringTag";function f(n,e,t){return Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}),n[e]}try{f({},"")}catch(n){f=function(t,r,u){return t[r]=u}}function H(n,e,t,r){var u=e&&e.prototype instanceof I?e:I,o=Object.create(u.prototype),l=new q(r||[]);return F(o,"_invoke",{value:X(n,t,l)}),o}function x(n,e,t){try{return{type:"normal",arg:n.call(e,t)}}catch(r){return{type:"throw",arg:r}}}E.wrap=H;var y={};function I(){}function O(){}function T(){}var i={};f(i,v,function(){return this});var g=Object.getPrototypeOf,A=g&&g(g(Z([])));A&&A!==R&&p.call(A,v)&&(i=A);var c=T.prototype=I.prototype=Object.create(i);function G(n){["next","throw","return"].forEach(function(e){f(n,e,function(t){return this._invoke(e,t)})})}function P(n,e){function t(u,o,l,m){var h=x(n[u],n,o);if(h.type!=="throw"){var N=h.arg,B=N.value;return B&&typeof B=="object"&&p.call(B,"__await")?e.resolve(B.__await).then(function(d){t("next",d,l,m)},function(d){t("throw",d,l,m)}):e.resolve(B).then(function(d){N.value=d,l(N)},function(d){return t("throw",d,l,m)})}m(h.arg)}var r;F(this,"_invoke",{value:function(o,l){function m(){return new e(function(h,N){t(o,l,h,N)})}return r=r?r.then(m,m):m()}})}function X(n,e,t){var r="suspendedStart";return function(u,o){if(r==="executing")throw new Error("Generator is already running");if(r==="completed"){if(u==="throw")throw o;return ae()}for(t.method=u,t.arg=o;;){var l=t.delegate;if(l){var m=V(l,t);if(m){if(m===y)continue;return m}}if(t.method==="next")t.sent=t._sent=t.arg;else if(t.method==="throw"){if(r==="suspendedStart")throw r="completed",t.arg;t.dispatchException(t.arg)}else t.method==="return"&&t.abrupt("return",t.arg);r="executing";var h=x(n,e,t);if(h.type==="normal"){if(r=t.done?"completed":"suspendedYield",h.arg===y)continue;return{value:h.arg,done:t.done}}h.type==="throw"&&(r="completed",t.method="throw",t.arg=h.arg)}}}function V(n,e){var t=e.method,r=n.iterator[t];if(r===void 0)return e.delegate=null,t==="throw"&&n.iterator.return&&(e.method="return",e.arg=void 0,V(n,e),e.method==="throw")||t!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+t+"' method")),y;var u=x(r,n.iterator,e.arg);if(u.type==="throw")return e.method="throw",e.arg=u.arg,e.delegate=null,y;var o=u.arg;return o?o.done?(e[n.resultName]=o.value,e.next=n.nextLoc,e.method!=="return"&&(e.method="next",e.arg=void 0),e.delegate=null,y):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function me(n){var e={tryLoc:n[0]};1 in n&&(e.catchLoc=n[1]),2 in n&&(e.finallyLoc=n[2],e.afterLoc=n[3]),this.tryEntries.push(e)}function Q(n){var e=n.completion||{};e.type="normal",delete e.arg,n.completion=e}function q(n){this.tryEntries=[{tryLoc:"root"}],n.forEach(me,this),this.reset(!0)}function Z(n){if(n){var e=n[v];if(e)return e.call(n);if(typeof n.next=="function")return n;if(!isNaN(n.length)){var t=-1,r=function u(){for(;++t<n.length;)if(p.call(n,t))return u.value=n[t],u.done=!1,u;return u.value=void 0,u.done=!0,u};return r.next=r}}return{next:ae}}function ae(){return{value:void 0,done:!0}}return O.prototype=T,F(c,"constructor",{value:T,configurable:!0}),F(T,"constructor",{value:O,configurable:!0}),O.displayName=f(T,C,"GeneratorFunction"),E.isGeneratorFunction=function(n){var e=typeof n=="function"&&n.constructor;return!!e&&(e===O||(e.displayName||e.name)==="GeneratorFunction")},E.mark=function(n){return Object.setPrototypeOf?Object.setPrototypeOf(n,T):(n.__proto__=T,f(n,C,"GeneratorFunction")),n.prototype=Object.create(c),n},E.awrap=function(n){return{__await:n}},G(P.prototype),f(P.prototype,D,function(){return this}),E.AsyncIterator=P,E.async=function(n,e,t,r,u){u===void 0&&(u=Promise);var o=new P(H(n,e,t,r),u);return E.isGeneratorFunction(e)?o:o.next().then(function(l){return l.done?l.value:o.next()})},G(c),f(c,C,"Generator"),f(c,v,function(){return this}),f(c,"toString",function(){return"[object Generator]"}),E.keys=function(n){var e=Object(n),t=[];for(var r in e)t.push(r);return t.reverse(),function u(){for(;t.length;){var o=t.pop();if(o in e)return u.value=o,u.done=!1,u}return u.done=!0,u}},E.values=Z,q.prototype={constructor:q,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(Q),!e)for(var t in this)t.charAt(0)==="t"&&p.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(N,B){return l.type="throw",l.arg=e,t.next=N,B&&(t.method="next",t.arg=void 0),!!B}for(var u=this.tryEntries.length-1;u>=0;--u){var o=this.tryEntries[u],l=o.completion;if(o.tryLoc==="root")return r("end");if(o.tryLoc<=this.prev){var m=p.call(o,"catchLoc"),h=p.call(o,"finallyLoc");if(m&&h){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(m){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var u=this.tryEntries[r];if(u.tryLoc<=this.prev&&p.call(u,"finallyLoc")&&this.prev<u.finallyLoc){var o=u;break}}o&&(e==="break"||e==="continue")&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var l=o?o.completion:{};return l.type=e,l.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(l)},complete:function(e,t){if(e.type==="throw")throw e.arg;return e.type==="break"||e.type==="continue"?this.next=e.arg:e.type==="return"?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):e.type==="normal"&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),Q(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var u=r.completion;if(u.type==="throw"){var o=u.arg;Q(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:Z(e),resultName:t,nextLoc:r},this.method==="next"&&(this.arg=void 0),y}},E}var Me=Ce.a.Search,Se=function(R){var p=R.paperlibrary,F=R.globalSetting,_=R.loading,v=R.dispatch,D=R.visible,C=R.onCancel,f=C===void 0?function(){}:C,H=Object(De.a)(R,["paperlibrary","globalSetting","loading","dispatch","visible","onCancel"]),x=Object(Te.m)(),y=Object(S.useState)(""),I=Object(J.a)(y,2),O=I[0],T=I[1],i=Object(S.useState)([]),g=Object(J.a)(i,2),A=g[0],c=g[1],G=Object(S.useState)(),P=Object(J.a)(G,2),X=P[0],V=P[1],me=Object(S.useState)(!1),Q=Object(J.a)(me,2),q=Q[0],Z=Q[1],ae=Object(S.useState)(!0),n=Object(J.a)(ae,2),e=n[0],t=n[1],r=Object(S.useState)(!1),u=Object(J.a)(r,2),o=u[0],l=u[1];Object(S.useEffect)(function(){m()},[]);var m=function(){var d=Object(de.a)(K().mark(function L(){var U;return K().wrap(function(W){for(;;)switch(W.prev=W.next){case 0:return W.next=2,v({type:"paperlibrary/getCourseList",payload:{search:O}});case 2:U=W.sent,U&&(c((U==null?void 0:U.courses)||[]),t(!0),l(!1));case 4:case"end":return W.stop()}},L)}));return function(){return d.apply(this,arguments)}}(),h=function(){var d=Object(de.a)(K().mark(function L(){var U,w,W,Le;return K().wrap(function($){for(;;)switch($.prev=$.next){case 0:if(X){$.next=4;break}return Ue.b.info("\u60A8\u9700\u8981\u521B\u5EFA\u8BFE\u5802\uFF0C\u624D\u80FD\u53D1\u9001"),Z(!0),$.abrupt("return");case 4:return $.next=6,v({type:"paperlibrary/sendToClass",payload:{course_id:X,id:x.id}});case 6:U=$.sent,N(),U&&U.status===0&&(Le=U==null||((w=U.first_category_url)===null||w===void 0||((W=w.split("/"))===null||W===void 0))?void 0:W[2],Object(ge.I)("/classrooms/".concat(Le,"/exercise")));case 9:case"end":return $.stop()}},L)}));return function(){return d.apply(this,arguments)}}(),N=function(){f()},B=function(){var d=Object(de.a)(K().mark(function L(){return K().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return l(!0),w.next=3,m();case 3:case"end":return w.stop()}},L)}));return function(){return d.apply(this,arguments)}}();return s.a.createElement(Pe.a,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,visible:D,title:"\u53D1\u9001\u81F3\u8BFE\u5802",okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",confirmLoading:_["paperlibrary/sendToClass"],width:600,onOk:h,onCancel:N},s.a.createElement("div",{className:k.a.wrap},s.a.createElement("div",{className:k.a.title},"\u6E29\u99A8\u63D0\u793A\uFF1A\u9009\u62E9\u7684\u8BD5\u5377\u5C06\u4F1A\u53D1\u9001\u5230\u6307\u5B9A\u8BFE\u5802"),s.a.createElement("div",{className:"mb10"},s.a.createElement(Me,{placeholder:"\u8F93\u5165\u8BFE\u5802\u540D\u79F0\u7684\u5173\u952E\u5B57\u8FDB\u884C\u641C\u7D22",value:O,onChange:function(L){return T(L.target.value)},onSearch:function(L){T(L),m()}})),A.length?s.a.createElement("div",{className:k.a.radioWrap},s.a.createElement(ye.a.Group,{value:X,onChange:function(L){V(L.target.value),Z(!1)}},A.map(function(d,L){return s.a.createElement(ye.a,{className:k.a.radio,value:d.course_id,key:d.course_id},d.course_name)}))):!O&&s.a.createElement(je.a,{createState:e,refreshLoading:o,onRefresh:B,onCreate:function(){t(!1),Object(ge.I)("/classrooms/new")}}),s.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"),q&&s.a.createElement("div",{className:k.a.colorFF0000},"\u8BF7\u5148\u9009\u62E9\u8BFE\u5802")))},Fe=Object(ve.a)(function(E){var R=E.paperlibrary,p=E.loading,F=E.globalSetting;return{paperlibrary:R,globalSetting:F,loading:p.effects}})(Se),ce={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"},ne={1:"\u7B80\u5355",2:"\u9002\u4E2D",3:"\u56F0\u96BE"},Ne=["\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D","\u5341"],Be=function(E){Object(se.a)(p,E);var R=Object(ie.a)(p);function p(F){var _;return Object(he.a)(this,p),_=R.call(this,F),_.getPaperData=function(){var v=window.location.href.split("/").pop();_.setState({loading:!0,id:v}),Object(te.a)("/api/examination_banks/".concat(v,"/edit_random_exam.json"),{method:"get"}).then(function(D){if(_.setState({loading:!1}),D){var C=D.contents,f=D.examination_bank,H=D.score_settings;_.setState({contents:C,examination_bank:f,score_settings:H})}})},_.state={loading:!1,contents:[],examination_bank:{},score_settings:[],modalVisible:!1,id:null},_}return Object(Y.a)(p,[{key:"componentDidMount",value:function(){this.getPaperData()}},{key:"render",value:function(){var _=this,v=this.state,D=v.contents,C=v.examination_bank,f=v.score_settings,H=v.loading,x=[],y=0,I=0;Object.keys(ce).map(function(i){var g=0;D.map(function(c){c.item_type===i&&(g+=c.quanlity)});var A=f.filter(function(c){return c.item_type===i});x=[].concat(Object(ue.a)(x),[{item_type:i,num:g,score:A.length>0?A[0].score:0}])});var O=x.filter(function(i){return i.num!==0});O.map(function(i){f.map(function(g){i.item_type===g.item_type&&(y+=i.num*g.score,I+=i.num)})});var T=s.a.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},s.a.createElement("div",{style:{display:"flex",justifyContent:"space-between",width:"50%",fontWeight:500,fontSize:"16px"}},s.a.createElement("span",null,"\u603B\u8BA1 ",O.length," \u5927\u9898\uFF0C ",I," \u5C0F\u9898\uFF0C\u603B\u5206 ",y," ","\u5206"),s.a.createElement("span",null,"\u8003\u8BD5\u65F6\u957F\uFF1A ",C.time," \u5206\u949F"),s.a.createElement("span",null,"\u8BD5\u5377\u96BE\u5EA6\uFF1A",ne[C.difficulty])),s.a.createElement("div",null,s.a.createElement(oe.a,{type:"primary",onClick:function(){return _.setState({modalVisible:!0})}},"\u53D1\u9001\u81F3\u8BFE\u5802")));return s.a.createElement("div",{style:{width:1200,margin:"0px auto"}},s.a.createElement(ee.a,{spinning:this.state.loading},s.a.createElement(z.a,{separator:">",style:{padding:"12px 0px"}},s.a.createElement(z.a.Item,null,"\u8BD5\u5377\u5E93"),s.a.createElement(z.a.Item,null,s.a.createElement(le.Link,{to:"/paperlibrary"},"\u6211\u7684\u8BD5\u5377\u5E93")),s.a.createElement(z.a.Item,null,"\u8BD5\u5377\u67E5\u770B")),s.a.createElement("div",{style:{height:50,display:"flex",alignItems:"center"}},s.a.createElement("span",{style:{fontSize:20,fontWeight:600}},s.a.createElement("i",{className:"icon-leftarrow iconfont",style:{fontSize:14,marginRight:8,cursor:"pointer"},onClick:function(){ve.c.goBack()}}),C.name),s.a.createElement("span",{className:Oe.a.randomIcon},"\u968F\u673A")),s.a.createElement(b.a,{title:T,style:{marginBottom:200}},O.map(function(i,g){var A=Array.from(new Set(D.map(function(c){return c.item_type===i.item_type?c.sub_discipline_id:null}).filter(function(c){return c})));return s.a.createElement("div",null,s.a.createElement("div",{style:{color:"#1890FF"}},Ne[g],"\u3001",ce[i.item_type],s.a.createElement("span",{style:{color:"#666666",marginLeft:5}},"(\u5171 ",i.num," \u9898\uFF0C\u6BCF\u9898 ",i.score," \u5206)")),s.a.createElement("div",null,A.map(function(c){var G=D.filter(function(P){return P.sub_discipline_id===c&&i.item_type===P.item_type});return s.a.createElement("div",{style:{marginTop:20,display:"flex"}},s.a.createElement("div",{style:{width:"30%",fontWeight:"600"}},s.a.createElement("span",null,"".concat(G[0].discipline_name,` /
`).concat(G[0].sub_discipline_name))),s.a.createElement("div",null,Object.keys(ne).map(function(P){var X=0;return G.map(function(V){return V.difficulty==P&&(X=V.quanlity),null}),X>0?s.a.createElement("span",{style:{color:"#1890FF",marginLeft:30}},ne[P],": ",X," \u9898"):null})))})),g===O.length-1?null:s.a.createElement(re.a,null))})),s.a.createElement(Fe,{visible:this.state.modalVisible,onCancel:function(){return _.setState({modalVisible:!1})}})))}}]),p}(s.a.Component),We=M.default=Be},ORPY:function(j,M,a){j.exports={sendToClass:"sendToClass___2FQ8x"}},hzL8:function(j,M,a){j.exports={wrap:"wrap___3xew9",title:"title___33cBU",radioWrap:"radioWrap___1GJxe",radio:"radio___3W-Oi",colorFF0000:"colorFF0000___2cz8C",pagination:"pagination___NI6NC"}},"rd/4":function(j,M,a){j.exports=a.p+"static/noData.dc777645.png"}}]);