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

5 lines
15 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[141],{"9Bee":function(oe,$,c){"use strict";var q=c("k1fw"),X=c("q1tI"),ee=c.n(X),ce=c("vg9a"),_e=c("tJVT"),te=c("DlQD"),K=c.n(te),re=c("rUJ1");function k(o,i){var r=o.match(/^(\s+)(?:```)/);if(r===null)return i;var _=r[1];return i.split(`
`).map(function(h){var E=h.match(/^\s+/);if(E===null)return h;var y=Object(_e.a)(E,1),U=y[0];return U.length>=_.length?h.slice(_.length):h}).join(`
`)}var G=[],s=["<ul>"],D=new K.a.Renderer,Y=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function V(){G.length=0,s=["<ul>"]}var ne={overflow:"hidden",WebkitBoxOrient:"vertical",display:"-webkit-box",WebkitLineClamp:2};function Q(o,i,r,_){if(i>=o.length||o[i].level<=r)return i;var h=o[i];_.push("<li><a href='#"+h.anchor+"'>"+h.text+"</a>"),i++;var E=[];return i=Q(o,i,h.level,E),E.length>0&&(_.push("<ul>"),E.forEach(function(y){_.push(y)}),_.push("</ul>")),_.push("</li>"),i=Q(o,i,r,_),i}function ie(){return Q(G,0,0,s),s.push("</ul>"),s.join("")}var de={heading:function(i){var r=Y.exec(i);if(r)return{type:"heading",raw:r[0],depth:r[1].length,text:r[2]}},fences:function(i){var r=this.rules.block.fences.exec(i);if(r){var _=r[0],h=k(_,r[3]||""),E=r[2]?r[2].trim():r[2];if(["latex","katex","math"].indexOf(E)>=0){var y=N(),U=h;h=y,J[y]={type:"block",expression:U}}return{type:"code",raw:_,lang:E,text:h}}}},se=/(?:\${2})([^\n`]+?)(?:\${2})/gi,ue=0,N=function(){return"__special_katext_id_".concat(ue++,"__")},J={};function B(){return J}function ae(){ue=0,J={}}function m(o){return o=o.replace(se,function(i,r){var _=N();return J[_]={type:"inline",expression:r},_}),o}var A=D.listitem;D.listitem=function(o){return A(m(o))};var b=D.paragraph;D.paragraph=function(o){return b(m(o))};var W=D.tablecell;D.tablecell=function(o,i){return W(m(o),i)},D.code=function(o,i,r){var _=(i||"").match(/\S*/)[0];return _?["latex","katex","math"].indexOf(_)>=0?"<p class='editormd-tex'>".concat(o,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(i,'">').concat(r?o:Object(re.escape)(o,!0),`</code></pre>
`):'<pre class="prettyprint linenums"><code>'+(r?o:Object(re.escape)(o,!0))+"</code></pre>"},D.heading=function(o,i,r){var _=this.options.headerPrefix+r.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return G.push({anchor:_,level:i,text:o}),"<h"+i+' id="'+_+'">'+o+"</h"+i+">"},K.a.setOptions({silent:!0,gfm:!0,pedantic:!1}),K.a.use({tokenizer:de,renderer:D});var x=K.a,z=c("SJMd"),j=c("m3rI"),v=c("Oy/b"),F=/<pre[^>]*>/g;function H(o){var i=document.createElement("div");return i.innerHTML=o,i.childNodes.length===0?"":i.childNodes[0].nodeValue}var R=$.a=function(o){var i=o.value,r=i===void 0?"":i,_=o.className,h=o.showTextOnly,E=o.showLines,y=o.style,U=y===void 0?{}:y,M=String(r),I=Object(X.useMemo)(function(){try{var P=/\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g,C=/\"\/api\/attachments\/|\"\/attachments\/download\//g,t=/\(\s+\/files\/uploads\/|\(\/files\/uploads\//g;M=M.replace(P,"("+j.a.API_SERVER+"/api/attachments/").replace(C,'"'+j.a.API_SERVER+"/api/attachments/").replace(t,'"'+j.a.API_SERVER+"/files/uploads/")}catch(u){}var e=x(M);setTimeout(function(){return L()},300);var n=B();if(M.match(/\[TOC\]/)&&(e=e.replace("<p>[TOC]</p>",ie()),V()),e=e.replace(/(__special_katext_id_\d+__)/g,function(u,l){var f=n[l],T=f.type,w=f.expression;return Object(v.renderToString)(H(w)||"",{displayMode:T==="block",throwOnError:!1,output:"html"})}),e=e.replace(/▁/g,"\u2581\u2581\u2581"),ae(),h){var a=document.createElement("div");return a.innerHTML=e,a.innerText}return e},[M]),p=Object(X.useRef)();ne.WebkitLineClamp=E,E&&(U=Object(q.a)(Object(q.a)({},U),ne));function g(P){var C=P.target;if(C.tagName.toUpperCase()==="A"){var t=C.getAttribute("href");if(t.startsWith("#")){P.preventDefault();var e=document.getElementById(t.replace("#",""));e&&e.scrollIntoView(!0)}}}var L=function(){};return Object(X.useEffect)(function(){if(p.current&&I&&(I.match(F)&&window.PR.prettyPrint()),p.current)return p.current.addEventListener("click",g),function(){p.current.removeEventListener("click",g),ae(),V()}},[I,p.current,g]),ee.a.createElement(ee.a.Fragment,null,ee.a.createElement("div",{ref:p,style:Object(q.a)({},U),className:"".concat(_||""," markdown-body "),dangerouslySetInnerHTML:{__html:I}}))}},X0ci:function(oe,$,c){},rmrE:function(oe,$,c){},ymAh:function(oe,$,c){"use strict";c.r($),c.d($,"Types",function(){return B});var q=c("T2oS"),X=c("W9HT"),ee=c("P2fV"),ce=c("NJEC"),_e=c("+L6B"),te=c("2/Rp"),K=c("9og8"),re=c("tJVT"),k=c("k1fw"),G=c("q1tI"),s=c.n(G),D=c("Ty5D"),Y=c("55Ip"),V=c("ErOA"),ne=c("m3rI"),Q=c("9Bee"),ie=c("X0ci"),de=c.n(ie),se=c("rmrE"),ue=c.n(se);function N(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */N=function(){return m};var m={},A=Object.prototype,b=A.hasOwnProperty,W=typeof Symbol=="function"?Symbol:{},x=W.iterator||"@@iterator",z=W.asyncIterator||"@@asyncIterator",j=W.toStringTag||"@@toStringTag";function v(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{v({},"")}catch(t){v=function(n,a,u){return n[a]=u}}function F(t,e,n,a){var u=e&&e.prototype instanceof o?e:o,l=Object.create(u.prototype),f=new L(a||[]);return l._invoke=function(T,w,d){var O="suspendedStart";return function(S,me){if(O==="executing")throw new Error("Generator is already running");if(O==="completed"){if(S==="throw")throw me;return C()}for(d.method=S,d.arg=me;;){var pe=d.delegate;if(pe){var le=I(pe,d);if(le){if(le===R)continue;return le}}if(d.method==="next")d.sent=d._sent=d.arg;else if(d.method==="throw"){if(O==="suspendedStart")throw O="completed",d.arg;d.dispatchException(d.arg)}else d.method==="return"&&d.abrupt("return",d.arg);O="executing";var Z=H(T,w,d);if(Z.type==="normal"){if(O=d.done?"completed":"suspendedYield",Z.arg===R)continue;return{value:Z.arg,done:d.done}}Z.type==="throw"&&(O="completed",d.method="throw",d.arg=Z.arg)}}}(t,n,f),l}function H(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(a){return{type:"throw",arg:a}}}m.wrap=F;var R={};function o(){}function i(){}function r(){}var _={};v(_,x,function(){return this});var h=Object.getPrototypeOf,E=h&&h(h(P([])));E&&E!==A&&b.call(E,x)&&(_=E);var y=r.prototype=o.prototype=Object.create(_);function U(t){["next","throw","return"].forEach(function(e){v(t,e,function(n){return this._invoke(e,n)})})}function M(t,e){function n(u,l,f,T){var w=H(t[u],t,l);if(w.type!=="throw"){var d=w.arg,O=d.value;return O&&typeof O=="object"&&b.call(O,"__await")?e.resolve(O.__await).then(function(S){n("next",S,f,T)},function(S){n("throw",S,f,T)}):e.resolve(O).then(function(S){d.value=S,f(d)},function(S){return n("throw",S,f,T)})}T(w.arg)}var a;this._invoke=function(u,l){function f(){return new e(function(T,w){n(u,l,T,w)})}return a=a?a.then(f,f):f()}}function I(t,e){var n=t.iterator[e.method];if(n===void 0){if(e.delegate=null,e.method==="throw"){if(t.iterator.return&&(e.method="return",e.arg=void 0,I(t,e),e.method==="throw"))return R;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return R}var a=H(n,t.iterator,e.arg);if(a.type==="throw")return e.method="throw",e.arg=a.arg,e.delegate=null,R;var u=a.arg;return u?u.done?(e[t.resultName]=u.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=void 0),e.delegate=null,R):u:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,R)}function p(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 g(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(p,this),this.reset(!0)}function P(t){if(t){var e=t[x];if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var n=-1,a=function u(){for(;++n<t.length;)if(b.call(t,n))return u.value=t[n],u.done=!1,u;return u.value=void 0,u.done=!0,u};return a.next=a}}return{next:C}}function C(){return{value:void 0,done:!0}}return i.prototype=r,v(y,"constructor",r),v(r,"constructor",i),i.displayName=v(r,j,"GeneratorFunction"),m.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return!!e&&(e===i||(e.displayName||e.name)==="GeneratorFunction")},m.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,r):(t.__proto__=r,v(t,j,"GeneratorFunction")),t.prototype=Object.create(y),t},m.awrap=function(t){return{__await:t}},U(M.prototype),v(M.prototype,z,function(){return this}),m.AsyncIterator=M,m.async=function(t,e,n,a,u){u===void 0&&(u=Promise);var l=new M(F(t,e,n,a),u);return m.isGeneratorFunction(e)?l:l.next().then(function(f){return f.done?f.value:l.next()})},U(y),v(y,j,"Generator"),v(y,x,function(){return this}),v(y,"toString",function(){return"[object Generator]"}),m.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function a(){for(;e.length;){var u=e.pop();if(u in t)return a.value=u,a.done=!1,a}return a.done=!0,a}},m.values=P,L.prototype={constructor:L,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(g),!e)for(var n in this)n.charAt(0)==="t"&&b.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=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 n=this;function a(d,O){return f.type="throw",f.arg=e,n.next=d,O&&(n.method="next",n.arg=void 0),!!O}for(var u=this.tryEntries.length-1;u>=0;--u){var l=this.tryEntries[u],f=l.completion;if(l.tryLoc==="root")return a("end");if(l.tryLoc<=this.prev){var T=b.call(l,"catchLoc"),w=b.call(l,"finallyLoc");if(T&&w){if(this.prev<l.catchLoc)return a(l.catchLoc,!0);if(this.prev<l.finallyLoc)return a(l.finallyLoc)}else if(T){if(this.prev<l.catchLoc)return a(l.catchLoc,!0)}else{if(!w)throw new Error("try statement without catch or finally");if(this.prev<l.finallyLoc)return a(l.finallyLoc)}}}},abrupt:function(e,n){for(var a=this.tryEntries.length-1;a>=0;--a){var u=this.tryEntries[a];if(u.tryLoc<=this.prev&&b.call(u,"finallyLoc")&&this.prev<u.finallyLoc){var l=u;break}}l&&(e==="break"||e==="continue")&&l.tryLoc<=n&&n<=l.finallyLoc&&(l=null);var f=l?l.completion:{};return f.type=e,f.arg=n,l?(this.method="next",this.next=l.finallyLoc,R):this.complete(f)},complete:function(e,n){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"&&n&&(this.next=n),R},finish:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.finallyLoc===e)return this.complete(a.completion,a.afterLoc),g(a),R}},catch:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc===e){var u=a.completion;if(u.type==="throw"){var l=u.arg;g(a)}return l}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,a){return this.delegate={iterator:P(e),resultName:n,nextLoc:a},this.method==="next"&&(this.arg=void 0),R}},m}var J={data:void 0},B;(function(m){m.GET_DATA="get-data",m.PRAISE="on-praise"})(B||(B={}));function ae(m,A){switch(A.type){case B.GET_DATA:return Object(k.a)(Object(k.a)({},m),{},{data:A.payload});case B.PRAISE:return Object(k.a)(Object(k.a)({},m),{},{data:A.payload});default:throw new Error}}$.default=function(){var m,A,b,W,x,z,j,v,F,H=Object(G.useReducer)(ae,J),R=Object(re.a)(H,2),o=R[0],i=R[1],r=o.data,_=Object(D.m)(),h=_.caseId,E=Object(D.k)();Object(G.useEffect)(function(){var p=!1;function g(){return L.apply(this,arguments)}function L(){return L=Object(K.a)(N().mark(function P(){var C;return N().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(V.c)("libraries/".concat(h,".json"));case 2:C=e.sent,p||(C.status===404?E.push("/moop_cases"):i({type:B.GET_DATA,payload:C}));case 4:case"end":return e.stop()}},P)})),L.apply(this,arguments)}return p||g(),function(){p=!0}},[h]);function y(){return U.apply(this,arguments)}function U(){return U=Object(K.a)(N().mark(function p(){var g;return N().wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return P.next=2,Object(V.f)("praise_tread/like.json",{object_id:h,object_type:"library"});case 2:g=Object(k.a)({},r),g.operation.user_praised=!0,g.praise_count+=1,i({type:B.PRAISE,payload:g});case 6:case"end":return P.stop()}},p)})),U.apply(this,arguments)}function M(){return I.apply(this,arguments)}function I(){return I=Object(K.a)(N().mark(function p(){return N().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:return L.next=2,Object(V.b)("/libraries/".concat(h,".json"));case 2:E.push("/moop_cases");case 3:case"end":return L.stop()}},p)})),I.apply(this,arguments)}return s.a.createElement(X.a,{spinning:!r,delay:500},r?s.a.createElement("section",{className:"moop-info"},s.a.createElement("div",{className:"crumb"},s.a.createElement(Y.Link,{to:"/moop_cases"},"\u6559\u5B66\u6848\u4F8B > "),s.a.createElement("span",null,r.title)),s.a.createElement("div",{className:"title"},s.a.createElement("h2",null,r.title,(m=r.tags)===null||m===void 0?void 0:m.map(function(p,g){return s.a.createElement("span",{className:"label-"+g,key:p.id},p.name)})),s.a.createElement(Y.Link,{to:"/moop_cases"},"\u8FD4\u56DE")),s.a.createElement("div",{className:"moop-info-body"},s.a.createElement("div",{className:"moop-sub-title"},s.a.createElement("img",{src:"".concat(ne.a.IMG_SERVER,"/images/").concat((A=r.creator)===null||A===void 0?void 0:A.image_url),alt:"cover",width:50}),s.a.createElement("div",{className:"desc"},s.a.createElement("div",{className:"flex-container"},s.a.createElement("span",null,(b=r.creator)===null||b===void 0?void 0:b.name),((W=r.operation)===null||W===void 0?void 0:W.can_editable)?s.a.createElement(Y.Link,{to:"/moop_cases/".concat(r.id,"/edit"),style:{marginRight:10}},s.a.createElement(te.a,{type:"ghost"},"\u7F16\u8F91")):null,((x=r.operation)===null||x===void 0?void 0:x.can_deletable)?s.a.createElement(ce.a,{placement:"bottomRight",title:"\u662F\u5426\u786E\u8BA4\u5220\u9664\uFF1F",onConfirm:M},s.a.createElement(te.a,{type:"dashed"},"\u5220\u9664")):null),s.a.createElement("div",{className:"sum"},s.a.createElement("span",null,(z=r.creator)===null||z===void 0?void 0:z.school_name),s.a.createElement("span",null,"\u7F16\u7801\uFF1A",r.uuid),s.a.createElement("span",null,"\u53D1\u5E03\u65F6\u95F4\uFF1A",r.published_at)))),s.a.createElement("p",null,"\u4F5C\u8005\uFF1A","".concat(r.author_name," / ").concat(r.author_school_name)),s.a.createElement(Q.a,{value:r.content}),s.a.createElement("ul",{className:"attachment"},(j=r.attachments)===null||j===void 0?void 0:j.map(function(p){return s.a.createElement("li",{key:p.id},s.a.createElement("a",{href:p.url},s.a.createElement("i",{className:"iconfont icon-fujian"}),s.a.createElement("span",null,p.title),s.a.createElement("span",null,p.filesize)))})),s.a.createElement("button",{className:"praise",disabled:(v=r.operation)===null||v===void 0?void 0:v.user_praised,onClick:y},((F=r.operation)===null||F===void 0?void 0:F.user_praised)?s.a.createElement("span",null,"\u5DF2\u8D5E"):s.a.createElement("span",null,s.a.createElement("i",{className:"iconfont icon-dianzan"})),s.a.createElement("span",null,r.praise_count)))):null)}}}]);