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
27 KiB
2 lines
27 KiB
(window.webpackJsonp=window.webpackJsonp||[]).push([[136],{"9ivq":function(yt,st,I){},axZZ:function(yt,st,I){"use strict";I.r(st);var Mt=I("DZo9"),Et=I("8z0m"),$t=I("+L6B"),rt=I("2/Rp"),Xt=I("miYZ"),J=I("tsqr"),nt=I("9og8"),x=I("tJVT"),A=I("q1tI"),b=I.n(A),Ft=I("5NDa"),wt=I("5rEg"),_t=I("Ot1p"),ot=I("ErOA");function tt(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */tt=function(){return l};var l={},w=Object.prototype,m=w.hasOwnProperty,_=typeof Symbol=="function"?Symbol:{},S=_.iterator||"@@iterator",k=_.asyncIterator||"@@asyncIterator",E=_.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(r,n,a){return r[n]=a}}function T(e,t,r,n){var a=t&&t.prototype instanceof N?t:N,o=Object.create(a.prototype),s=new $(n||[]);return o._invoke=function(d,v,i){var c="suspendedStart";return function(p,V){if(c==="executing")throw new Error("Generator is already running");if(c==="completed"){if(p==="throw")throw V;return B()}for(i.method=p,i.arg=V;;){var H=i.delegate;if(H){var F=z(H,i);if(F){if(F===u)continue;return F}}if(i.method==="next")i.sent=i._sent=i.arg;else if(i.method==="throw"){if(c==="suspendedStart")throw c="completed",i.arg;i.dispatchException(i.arg)}else i.method==="return"&&i.abrupt("return",i.arg);c="executing";var U=j(d,v,i);if(U.type==="normal"){if(c=i.done?"completed":"suspendedYield",U.arg===u)continue;return{value:U.arg,done:i.done}}U.type==="throw"&&(c="completed",i.method="throw",i.arg=U.arg)}}}(e,r,s),o}function j(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(n){return{type:"throw",arg:n}}}l.wrap=T;var u={};function N(){}function R(){}function h(){}var C={};f(C,S,function(){return this});var P=Object.getPrototypeOf,O=P&&P(P(X([])));O&&O!==w&&m.call(O,S)&&(C=O);var g=h.prototype=N.prototype=Object.create(C);function Y(e){["next","throw","return"].forEach(function(t){f(e,t,function(r){return this._invoke(t,r)})})}function y(e,t){function r(a,o,s,d){var v=j(e[a],e,o);if(v.type!=="throw"){var i=v.arg,c=i.value;return c&&typeof c=="object"&&m.call(c,"__await")?t.resolve(c.__await).then(function(p){r("next",p,s,d)},function(p){r("throw",p,s,d)}):t.resolve(c).then(function(p){i.value=p,s(i)},function(p){return r("throw",p,s,d)})}d(v.arg)}var n;this._invoke=function(a,o){function s(){return new t(function(d,v){r(a,o,d,v)})}return n=n?n.then(s,s):s()}}function z(e,t){var r=e.iterator[t.method];if(r===void 0){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=void 0,z(e,t),t.method==="throw"))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=j(r,e.iterator,t.arg);if(n.type==="throw")return t.method="throw",t.arg=n.arg,t.delegate=null,u;var a=n.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=void 0),t.delegate=null,u):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function W(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function G(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(W,this),this.reset(!0)}function X(e){if(e){var t=e[S];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var r=-1,n=function a(){for(;++r<e.length;)if(m.call(e,r))return a.value=e[r],a.done=!1,a;return a.value=void 0,a.done=!0,a};return n.next=n}}return{next:B}}function B(){return{value:void 0,done:!0}}return R.prototype=h,f(g,"constructor",h),f(h,"constructor",R),R.displayName=f(h,E,"GeneratorFunction"),l.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return!!t&&(t===R||(t.displayName||t.name)==="GeneratorFunction")},l.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,f(e,E,"GeneratorFunction")),e.prototype=Object.create(g),e},l.awrap=function(e){return{__await:e}},Y(y.prototype),f(y.prototype,k,function(){return this}),l.AsyncIterator=y,l.async=function(e,t,r,n,a){a===void 0&&(a=Promise);var o=new y(T(e,t,r,n),a);return l.isGeneratorFunction(t)?o:o.next().then(function(s){return s.done?s.value:o.next()})},Y(g),f(g,E,"Generator"),f(g,S,function(){return this}),f(g,"toString",function(){return"[object Generator]"}),l.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function n(){for(;t.length;){var a=t.pop();if(a in e)return n.value=a,n.done=!1,n}return n.done=!0,n}},l.values=X,$.prototype={constructor:$,reset:function(t){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(G),!t)for(var r in this)r.charAt(0)==="t"&&m.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(i,c){return s.type="throw",s.arg=t,r.next=i,c&&(r.method="next",r.arg=void 0),!!c}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if(o.tryLoc==="root")return n("end");if(o.tryLoc<=this.prev){var d=m.call(o,"catchLoc"),v=m.call(o,"finallyLoc");if(d&&v){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(d){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!v)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,r){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&m.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&(t==="break"||t==="continue")&&o.tryLoc<=r&&r<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=r,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(s)},complete:function(t,r){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&r&&(this.next=r),u},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),G(n),u}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc===t){var a=n.completion;if(a.type==="throw"){var o=a.arg;G(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:X(t),resultName:r,nextLoc:n},this.method==="next"&&(this.arg=void 0),u}},l}function Lt(l){var w=l.setIscreate,m=l.init,_=l.UpdateItem,S=Object(A.useState)(""),k=Object(x.a)(S,2),E=k[0],f=k[1],T=Object(A.useState)(""),j=Object(x.a)(T,2),u=j[0],N=j[1];Object(A.useEffect)(function(){if(!_)return;f(_&&_.name),N(_&&_.description)},[_]);function R(){return h.apply(this,arguments)}function h(){return h=Object(nt.a)(tt().mark(function O(){var g;return tt().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:if(E){y.next=3;break}return J.b.info("\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A"),y.abrupt("return");case 3:if(u){y.next=6;break}return J.b.info("\u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A"),y.abrupt("return");case 6:if(!_){y.next=9;break}return C(),y.abrupt("return");case 9:return y.next=11,Object(ot.a)("/api/hpc_courses.json",{method:"post",body:{name:E,description:u,container_type:window.location.pathname.split("/")[1]}});case 11:g=y.sent,g&&(J.b.info("\u521B\u5EFA\u6210\u529F"),w(!1),m("add"));case 13:case"end":return y.stop()}},O)})),h.apply(this,arguments)}function C(){return P.apply(this,arguments)}function P(){return P=Object(nt.a)(tt().mark(function O(){var g;return tt().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return y.next=2,Object(ot.a)("/api/hpc_courses/".concat(_.id,".json"),{method:"put",body:{name:E,description:u,container_type:window.location.pathname.split("/")[1]}});case 2:g=y.sent,g&&(J.b.info("\u7F16\u8F91\u6210\u529F"),w(!1),m(""));case 4:case"end":return y.stop()}},O)})),P.apply(this,arguments)}return b.a.createElement("div",null,b.a.createElement(wt.a,{style:{marginBottom:"20px"},placeholder:"\u8BF7\u8F93\u5165\u6807\u9898",value:E,maxLength:60,addonAfter:String(E.length)+"/60",onChange:function(g){return f(g.target.value)}}),b.a.createElement(_t.a,{id:"courseContentMD",defaultValue:u,onChange:function(g){return N(g)}}),b.a.createElement("div",{className:"clearfix mt30 mb30"},b.a.createElement(rt.a,{type:"primary",onClick:function(){return R()},className:"defalutSubmitbtn fl mr20"},"\u63D0\u4EA4"),b.a.createElement("a",{className:"defalutCancelbtn fl",onClick:function(){return w(!1)}},"\u53D6\u6D88")))}var bt=Lt,Ot=I("9Bee");function ct(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ct=function(){return l};var l={},w=Object.prototype,m=w.hasOwnProperty,_=typeof Symbol=="function"?Symbol:{},S=_.iterator||"@@iterator",k=_.asyncIterator||"@@asyncIterator",E=_.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(r,n,a){return r[n]=a}}function T(e,t,r,n){var a=t&&t.prototype instanceof N?t:N,o=Object.create(a.prototype),s=new $(n||[]);return o._invoke=function(d,v,i){var c="suspendedStart";return function(p,V){if(c==="executing")throw new Error("Generator is already running");if(c==="completed"){if(p==="throw")throw V;return B()}for(i.method=p,i.arg=V;;){var H=i.delegate;if(H){var F=z(H,i);if(F){if(F===u)continue;return F}}if(i.method==="next")i.sent=i._sent=i.arg;else if(i.method==="throw"){if(c==="suspendedStart")throw c="completed",i.arg;i.dispatchException(i.arg)}else i.method==="return"&&i.abrupt("return",i.arg);c="executing";var U=j(d,v,i);if(U.type==="normal"){if(c=i.done?"completed":"suspendedYield",U.arg===u)continue;return{value:U.arg,done:i.done}}U.type==="throw"&&(c="completed",i.method="throw",i.arg=U.arg)}}}(e,r,s),o}function j(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(n){return{type:"throw",arg:n}}}l.wrap=T;var u={};function N(){}function R(){}function h(){}var C={};f(C,S,function(){return this});var P=Object.getPrototypeOf,O=P&&P(P(X([])));O&&O!==w&&m.call(O,S)&&(C=O);var g=h.prototype=N.prototype=Object.create(C);function Y(e){["next","throw","return"].forEach(function(t){f(e,t,function(r){return this._invoke(t,r)})})}function y(e,t){function r(a,o,s,d){var v=j(e[a],e,o);if(v.type!=="throw"){var i=v.arg,c=i.value;return c&&typeof c=="object"&&m.call(c,"__await")?t.resolve(c.__await).then(function(p){r("next",p,s,d)},function(p){r("throw",p,s,d)}):t.resolve(c).then(function(p){i.value=p,s(i)},function(p){return r("throw",p,s,d)})}d(v.arg)}var n;this._invoke=function(a,o){function s(){return new t(function(d,v){r(a,o,d,v)})}return n=n?n.then(s,s):s()}}function z(e,t){var r=e.iterator[t.method];if(r===void 0){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=void 0,z(e,t),t.method==="throw"))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=j(r,e.iterator,t.arg);if(n.type==="throw")return t.method="throw",t.arg=n.arg,t.delegate=null,u;var a=n.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=void 0),t.delegate=null,u):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function W(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function G(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(W,this),this.reset(!0)}function X(e){if(e){var t=e[S];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var r=-1,n=function a(){for(;++r<e.length;)if(m.call(e,r))return a.value=e[r],a.done=!1,a;return a.value=void 0,a.done=!0,a};return n.next=n}}return{next:B}}function B(){return{value:void 0,done:!0}}return R.prototype=h,f(g,"constructor",h),f(h,"constructor",R),R.displayName=f(h,E,"GeneratorFunction"),l.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return!!t&&(t===R||(t.displayName||t.name)==="GeneratorFunction")},l.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,f(e,E,"GeneratorFunction")),e.prototype=Object.create(g),e},l.awrap=function(e){return{__await:e}},Y(y.prototype),f(y.prototype,k,function(){return this}),l.AsyncIterator=y,l.async=function(e,t,r,n,a){a===void 0&&(a=Promise);var o=new y(T(e,t,r,n),a);return l.isGeneratorFunction(t)?o:o.next().then(function(s){return s.done?s.value:o.next()})},Y(g),f(g,E,"Generator"),f(g,S,function(){return this}),f(g,"toString",function(){return"[object Generator]"}),l.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function n(){for(;t.length;){var a=t.pop();if(a in e)return n.value=a,n.done=!1,n}return n.done=!0,n}},l.values=X,$.prototype={constructor:$,reset:function(t){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(G),!t)for(var r in this)r.charAt(0)==="t"&&m.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(i,c){return s.type="throw",s.arg=t,r.next=i,c&&(r.method="next",r.arg=void 0),!!c}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if(o.tryLoc==="root")return n("end");if(o.tryLoc<=this.prev){var d=m.call(o,"catchLoc"),v=m.call(o,"finallyLoc");if(d&&v){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(d){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!v)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,r){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&m.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&(t==="break"||t==="continue")&&o.tryLoc<=r&&r<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=r,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(s)},complete:function(t,r){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&r&&(this.next=r),u},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),G(n),u}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc===t){var a=n.completion;if(a.type==="throw"){var o=a.arg;G(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:X(t),resultName:r,nextLoc:n},this.method==="next"&&(this.arg=void 0),u}},l}function St(l){var w=l.CourseItem,m=l.userId,_=l.init,S=l.ItemUpdate,k=l.setSee,E=l.UserInfo;function f(){return T.apply(this,arguments)}function T(){return T=Object(nt.a)(ct().mark(function u(){var N;return ct().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.next=2,Object(ot.a)("/api/hpc_courses/".concat(w.id,".json"),{method:"delete"});case 2:N=h.sent,N&&(J.b.info("\u5220\u9664\u6210\u529F"),_("delete"),k(!1));case 4:case"end":return h.stop()}},u)})),T.apply(this,arguments)}function j(){S(w)}return b.a.createElement("div",null,m===299635||m===301458||(E==null?void 0:E.admin)||(E==null?void 0:E.business)?b.a.createElement("div",{style:{textAlign:"right"}},b.a.createElement(rt.a,{onClick:function(){return j()}},"\u7F16\u8F91"),b.a.createElement(rt.a,{onClick:function(){return f()},style:{marginLeft:"30px"}},"\u5220\u9664")):null,b.a.createElement("h1",null,w==null?void 0:w.name),b.a.createElement(Ot.a,{value:w==null?void 0:w.description}))}var It=St,Yt=I("9ivq"),vt=I("m3rI"),jt=I("Ty5D"),Ut=I("9kvl");function lt(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */lt=function(){return l};var l={},w=Object.prototype,m=w.hasOwnProperty,_=typeof Symbol=="function"?Symbol:{},S=_.iterator||"@@iterator",k=_.asyncIterator||"@@asyncIterator",E=_.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(r,n,a){return r[n]=a}}function T(e,t,r,n){var a=t&&t.prototype instanceof N?t:N,o=Object.create(a.prototype),s=new $(n||[]);return o._invoke=function(d,v,i){var c="suspendedStart";return function(p,V){if(c==="executing")throw new Error("Generator is already running");if(c==="completed"){if(p==="throw")throw V;return B()}for(i.method=p,i.arg=V;;){var H=i.delegate;if(H){var F=z(H,i);if(F){if(F===u)continue;return F}}if(i.method==="next")i.sent=i._sent=i.arg;else if(i.method==="throw"){if(c==="suspendedStart")throw c="completed",i.arg;i.dispatchException(i.arg)}else i.method==="return"&&i.abrupt("return",i.arg);c="executing";var U=j(d,v,i);if(U.type==="normal"){if(c=i.done?"completed":"suspendedYield",U.arg===u)continue;return{value:U.arg,done:i.done}}U.type==="throw"&&(c="completed",i.method="throw",i.arg=U.arg)}}}(e,r,s),o}function j(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(n){return{type:"throw",arg:n}}}l.wrap=T;var u={};function N(){}function R(){}function h(){}var C={};f(C,S,function(){return this});var P=Object.getPrototypeOf,O=P&&P(P(X([])));O&&O!==w&&m.call(O,S)&&(C=O);var g=h.prototype=N.prototype=Object.create(C);function Y(e){["next","throw","return"].forEach(function(t){f(e,t,function(r){return this._invoke(t,r)})})}function y(e,t){function r(a,o,s,d){var v=j(e[a],e,o);if(v.type!=="throw"){var i=v.arg,c=i.value;return c&&typeof c=="object"&&m.call(c,"__await")?t.resolve(c.__await).then(function(p){r("next",p,s,d)},function(p){r("throw",p,s,d)}):t.resolve(c).then(function(p){i.value=p,s(i)},function(p){return r("throw",p,s,d)})}d(v.arg)}var n;this._invoke=function(a,o){function s(){return new t(function(d,v){r(a,o,d,v)})}return n=n?n.then(s,s):s()}}function z(e,t){var r=e.iterator[t.method];if(r===void 0){if(t.delegate=null,t.method==="throw"){if(e.iterator.return&&(t.method="return",t.arg=void 0,z(e,t),t.method==="throw"))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=j(r,e.iterator,t.arg);if(n.type==="throw")return t.method="throw",t.arg=n.arg,t.delegate=null,u;var a=n.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,t.method!=="return"&&(t.method="next",t.arg=void 0),t.delegate=null,u):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function W(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function G(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function $(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(W,this),this.reset(!0)}function X(e){if(e){var t=e[S];if(t)return t.call(e);if(typeof e.next=="function")return e;if(!isNaN(e.length)){var r=-1,n=function a(){for(;++r<e.length;)if(m.call(e,r))return a.value=e[r],a.done=!1,a;return a.value=void 0,a.done=!0,a};return n.next=n}}return{next:B}}function B(){return{value:void 0,done:!0}}return R.prototype=h,f(g,"constructor",h),f(h,"constructor",R),R.displayName=f(h,E,"GeneratorFunction"),l.isGeneratorFunction=function(e){var t=typeof e=="function"&&e.constructor;return!!t&&(t===R||(t.displayName||t.name)==="GeneratorFunction")},l.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,f(e,E,"GeneratorFunction")),e.prototype=Object.create(g),e},l.awrap=function(e){return{__await:e}},Y(y.prototype),f(y.prototype,k,function(){return this}),l.AsyncIterator=y,l.async=function(e,t,r,n,a){a===void 0&&(a=Promise);var o=new y(T(e,t,r,n),a);return l.isGeneratorFunction(t)?o:o.next().then(function(s){return s.done?s.value:o.next()})},Y(g),f(g,E,"Generator"),f(g,S,function(){return this}),f(g,"toString",function(){return"[object Generator]"}),l.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function n(){for(;t.length;){var a=t.pop();if(a in e)return n.value=a,n.done=!1,n}return n.done=!0,n}},l.values=X,$.prototype={constructor:$,reset:function(t){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(G),!t)for(var r in this)r.charAt(0)==="t"&&m.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if(t.type==="throw")throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(i,c){return s.type="throw",s.arg=t,r.next=i,c&&(r.method="next",r.arg=void 0),!!c}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if(o.tryLoc==="root")return n("end");if(o.tryLoc<=this.prev){var d=m.call(o,"catchLoc"),v=m.call(o,"finallyLoc");if(d&&v){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(d){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!v)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(t,r){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&m.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&(t==="break"||t==="continue")&&o.tryLoc<=r&&r<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=r,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(s)},complete:function(t,r){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&r&&(this.next=r),u},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),G(n),u}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc===t){var a=n.completion;if(a.type==="throw"){var o=a.arg;G(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:X(t),resultName:r,nextLoc:n},this.method==="next"&&(this.arg=void 0),u}},l}function Nt(l){var w,m,_,S,k,E,f,T,j,u=l.user,N=l.dispatch,R=Object(A.useState)(1),h=Object(x.a)(R,2),C=h[0],P=h[1],O=Object(A.useState)(100),g=Object(x.a)(O,2),Y=g[0],y=g[1],z=Object(A.useState)([]),W=Object(x.a)(z,2),G=W[0],$=W[1],X=Object(A.useState)(!1),B=Object(x.a)(X,2),e=B[0],t=B[1],r=Object(A.useState)(!1),n=Object(x.a)(r,2),a=n[0],o=n[1],s=Object(A.useState)(""),d=Object(x.a)(s,2),v=d[0],i=d[1],c=Object(A.useState)(""),p=Object(x.a)(c,2),V=p[0],H=p[1],F=Object(A.useState)(""),U=Object(x.a)(F,2),mt=U[0],Rt=U[1],Tt=Object(jt.m)(),K=Tt.itemname,Ct=Object(A.useState)(""),gt=Object(x.a)(Ct,2),at=gt[0],Q=gt[1];Object(A.useEffect)(function(){N({type:"globalSetting/headerToggle",payload:!1}),C&&it("")},[C]);function it(D){return ft.apply(this,arguments)}function ft(){return ft=Object(nt.a)(lt().mark(function D(Z){var L,et,dt,ht,ut;return lt().wrap(function(M){for(;;)switch(M.prev=M.next){case 0:return M.next=2,Object(ot.a)("/api/hpc_courses.json",{method:"get",params:{page:C,per_page:Y,container_type:window.location.pathname.split("/")[1]}});case 2:if(L=M.sent,!L){M.next=24;break}if(et=L.data.hpc_courses.length,$(L.data.hpc_courses),Rt(L.data.file_url),H(""),et){M.next=10;break}return M.abrupt("return");case 10:if(at){M.next=14;break}K?(ut=0,L==null||((dt=L.data)===null||dt===void 0||((ht=dt.hpc_courses)===null||ht===void 0))||ht.map(function(q,Dt){var pt;(K==null?void 0:K.toLocaleLowerCase())===(q==null||((pt=q.name)===null||pt===void 0)?void 0:pt.toLocaleLowerCase())&&(ut=Dt)}),i(L.data.hpc_courses[ut]),o(!0),Q(L.data.hpc_courses[ut].id),(K==null?void 0:K.toLocaleLowerCase())==="resources"&&(i(L.data.hpc_courses.filter(function(q){return q.id===15})[0]),o(!0),Q(15))):(i(L.data.hpc_courses[0]),o(!0),Q(L.data.hpc_courses[0].id)),M.next=24;break;case 14:if(!(Z==="delete")){M.next=23;break}if(!(et===0)){M.next=18;break}return o(!1),M.abrupt("return");case 18:i(L.data.hpc_courses[0]),o(!0),Q(L.data.hpc_courses[0].id),M.next=24;break;case 23:Z==="add"?(i(L.data.hpc_courses[et-1]),o(!0),Q(L.data.hpc_courses[et-1].id)):(i(L.data.hpc_courses.filter(function(q){return q.id===at})[0]),o(!0),Q(at));case 24:case"end":return M.stop()}},D)})),ft.apply(this,arguments)}function Pt(D){t(!1),o(!0),i(D),Q(D.id)}function At(D){H(D),t(!0),o(!1)}function kt(){H(""),t(!0),o(!1)}var Gt={name:"file",multiple:!0,action:"https://www.educoder.net/api/hpc_courses/upload_file.json",data:{container_type:window.location.pathname.split("/")[1]},onChange:function(Z){var L=Z.file.status;L!=="uploading",L==="done"?(J.b.success("".concat(Z.file.name," \u6587\u4EF6\u4E0A\u4F20\u6210\u529F")),it("")):L==="error"&&J.b.error("".concat(Z.file.name," \u6587\u4EF6\u4E0A\u4F20\u5931\u8D25"))},beforeUpload:function(Z){var L=Z.size/1024/1024<150;return L||J.b.info("\u6587\u4EF6\u5927\u5C0F\u5FC5\u987B\u5C0F\u4E8E150MB"),L}};return b.a.createElement("div",{style:{marginBottom:"40px"}},b.a.createElement("div",{className:"bannterdiv",style:{background:"url(".concat(vt.a.IMG_SERVER+"/".concat(mt),")")}}),b.a.createElement("img",{style:{width:"100%"},src:vt.a.IMG_SERVER+"/".concat(mt)}),b.a.createElement("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"}},b.a.createElement("div",{style:{flex:"1",marginTop:"17px"}},G&&G.map(function(D,Z){return b.a.createElement("p",{key:Z,onClick:function(){return Pt(D)},className:at===D.id?"menuitemselect":"menuitem task-hide"},D.name)}),(u==null||((w=u.userInfo)===null||w===void 0)?void 0:w.user_id)===299635||(u==null||((m=u.userInfo)===null||m===void 0)?void 0:m.user_id)===301458||(u==null||((_=u.userInfo)===null||_===void 0)?void 0:_.admin)||(u==null||((S=u.userInfo)===null||S===void 0)?void 0:S.business)?b.a.createElement("p",{onClick:function(){return kt()},className:"menuadd",style:{fontSize:"24px",paddingLeft:"10px"}},b.a.createElement("span",{style:{fontSize:"16px",marginLeft:"5px"}},"Last updated")):null),b.a.createElement("div",{className:"rightcount",style:{flex:"6",background:"#ffffff",padding:"20px",marginLeft:"30px",marginTop:"24px"}},e?b.a.createElement(bt,{UpdateItem:V,setIscreate:t,init:it}):null,a?b.a.createElement(It,{UserInfo:u==null?void 0:u.userInfo,setSee:o,userId:u==null||((k=u.userInfo)===null||k===void 0)?void 0:k.user_id,ItemUpdate:At,CourseItem:v,init:it}):null)),(u==null||((E=u.userInfo)===null||E===void 0)?void 0:E.user_id)===299635||(u==null||((f=u.userInfo)===null||f===void 0)?void 0:f.user_id)===301458||(u==null||((T=u.userInfo)===null||T===void 0)?void 0:T.admin)||(u==null||((j=u.userInfo)===null||j===void 0)?void 0:j.business)?b.a.createElement(Et.a,Gt,b.a.createElement(rt.a,{className:"menuadd",style:{paddingLeft:"10px",marginLeft:"20px"}},"\u4E0A\u4F20\u9996\u9875\u56FE\u7247")):null)}var Ht=st.default=Object(Ut.a)(function(l){var w=l.user;return{user:w}})(Nt)}}]);
|