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__Guidance.aa75b65a.async.js

2 lines
9.8 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[129],{"5oB3":function(q,V,l){q.exports={flex_box_center:"flex_box_center___2WENa",flex_space_between:"flex_space_between___32o_C",flex_box_vertical_center:"flex_box_vertical_center___VReNJ",flex_box_center_end:"flex_box_center_end___VidHP",flex_box_column:"flex_box_column___7bh0_",guidance:"guidance___1zlCK",title:"title___TLK56",u:"u___1YcNG",active:"active___2cPfY",content:"content___3PW9_",btn:"btn___26Rnl"}},ObO0:function(q,V,l){"use strict";l.r(V);var ft=l("cWXX"),et=l("/ezw"),dt=l("+L6B"),rt=l("2/Rp"),nt=l("9og8"),D=l("tJVT"),ot=l("PpiC"),E=l("q1tI"),m=l.n(E),at=l("Ty5D"),it=l("9kvl"),ut=l("1vsH"),ct=l("5oB3"),O=l.n(ct),lt=l("ErOA"),st=l("m3rI"),tt=l("9Bee");function H(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */H=function(){return s};var d,s={},R=Object.prototype,p=R.hasOwnProperty,b=Object.defineProperty||function(r,t,e){r[t]=e.value},h=typeof Symbol=="function"?Symbol:{},A=h.iterator||"@@iterator",X=h.asyncIterator||"@@asyncIterator",j=h.toStringTag||"@@toStringTag";function _(r,t,e){return Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{_({},"")}catch(r){_=function(e,a,o){return e[a]=o}}function M(r,t,e,a){var o=t&&t.prototype instanceof N?t:N,n=Object.create(o.prototype),i=new k(a||[]);return b(n,"_invoke",{value:Z(r,e,i)}),n}function B(r,t,e){try{return{type:"normal",arg:r.call(t,e)}}catch(a){return{type:"throw",arg:a}}}s.wrap=M;var W="suspendedStart",Q="suspendedYield",Y="executing",T="completed",v={};function N(){}function U(){}function g(){}var I={};_(I,A,function(){return this});var K=Object.getPrototypeOf,w=K&&K(K(S([])));w&&w!==R&&p.call(w,A)&&(I=w);var P=g.prototype=N.prototype=Object.create(I);function G(r){["next","throw","return"].forEach(function(t){_(r,t,function(e){return this._invoke(t,e)})})}function C(r,t){function e(o,n,i,u){var c=B(r[o],r,n);if(c.type!=="throw"){var f=c.arg,y=f.value;return y&&typeof y=="object"&&p.call(y,"__await")?t.resolve(y.__await).then(function(x){e("next",x,i,u)},function(x){e("throw",x,i,u)}):t.resolve(y).then(function(x){f.value=x,i(f)},function(x){return e("throw",x,i,u)})}u(c.arg)}var a;b(this,"_invoke",{value:function(n,i){function u(){return new t(function(c,f){e(n,i,c,f)})}return a=a?a.then(u,u):u()}})}function Z(r,t,e){var a=W;return function(o,n){if(a===Y)throw new Error("Generator is already running");if(a===T){if(o==="throw")throw n;return{value:d,done:!0}}for(e.method=o,e.arg=n;;){var i=e.delegate;if(i){var u=$(i,e);if(u){if(u===v)continue;return u}}if(e.method==="next")e.sent=e._sent=e.arg;else if(e.method==="throw"){if(a===W)throw a=T,e.arg;e.dispatchException(e.arg)}else e.method==="return"&&e.abrupt("return",e.arg);a=Y;var c=B(r,t,e);if(c.type==="normal"){if(a=e.done?T:Q,c.arg===v)continue;return{value:c.arg,done:e.done}}c.type==="throw"&&(a=T,e.method="throw",e.arg=c.arg)}}}function $(r,t){var e=t.method,a=r.iterator[e];if(a===d)return t.delegate=null,e==="throw"&&r.iterator.return&&(t.method="return",t.arg=d,$(r,t),t.method==="throw")||e!=="return"&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+e+"' method")),v;var o=B(a,r.iterator,t.arg);if(o.type==="throw")return t.method="throw",t.arg=o.arg,t.delegate=null,v;var n=o.arg;return n?n.done?(t[r.resultName]=n.value,t.next=r.nextLoc,t.method!=="return"&&(t.method="next",t.arg=d),t.delegate=null,v):n:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,v)}function J(r){var t={tryLoc:r[0]};1 in r&&(t.catchLoc=r[1]),2 in r&&(t.finallyLoc=r[2],t.afterLoc=r[3]),this.tryEntries.push(t)}function L(r){var t=r.completion||{};t.type="normal",delete t.arg,r.completion=t}function k(r){this.tryEntries=[{tryLoc:"root"}],r.forEach(J,this),this.reset(!0)}function S(r){if(r||r===""){var t=r[A];if(t)return t.call(r);if(typeof r.next=="function")return r;if(!isNaN(r.length)){var e=-1,a=function o(){for(;++e<r.length;)if(p.call(r,e))return o.value=r[e],o.done=!1,o;return o.value=d,o.done=!0,o};return a.next=a}}throw new TypeError(typeof r+" is not iterable")}return U.prototype=g,b(P,"constructor",{value:g,configurable:!0}),b(g,"constructor",{value:U,configurable:!0}),U.displayName=_(g,j,"GeneratorFunction"),s.isGeneratorFunction=function(r){var t=typeof r=="function"&&r.constructor;return!!t&&(t===U||(t.displayName||t.name)==="GeneratorFunction")},s.mark=function(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,g):(r.__proto__=g,_(r,j,"GeneratorFunction")),r.prototype=Object.create(P),r},s.awrap=function(r){return{__await:r}},G(C.prototype),_(C.prototype,X,function(){return this}),s.AsyncIterator=C,s.async=function(r,t,e,a,o){o===void 0&&(o=Promise);var n=new C(M(r,t,e,a),o);return s.isGeneratorFunction(t)?n:n.next().then(function(i){return i.done?i.value:n.next()})},G(P),_(P,j,"Generator"),_(P,A,function(){return this}),_(P,"toString",function(){return"[object Generator]"}),s.keys=function(r){var t=Object(r),e=[];for(var a in t)e.push(a);return e.reverse(),function o(){for(;e.length;){var n=e.pop();if(n in t)return o.value=n,o.done=!1,o}return o.done=!0,o}},s.values=S,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=d,this.done=!1,this.delegate=null,this.method="next",this.arg=d,this.tryEntries.forEach(L),!t)for(var e in this)e.charAt(0)==="t"&&p.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=d)},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 e=this;function a(f,y){return i.type="throw",i.arg=t,e.next=f,y&&(e.method="next",e.arg=d),!!y}for(var o=this.tryEntries.length-1;o>=0;--o){var n=this.tryEntries[o],i=n.completion;if(n.tryLoc==="root")return a("end");if(n.tryLoc<=this.prev){var u=p.call(n,"catchLoc"),c=p.call(n,"finallyLoc");if(u&&c){if(this.prev<n.catchLoc)return a(n.catchLoc,!0);if(this.prev<n.finallyLoc)return a(n.finallyLoc)}else if(u){if(this.prev<n.catchLoc)return a(n.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<n.finallyLoc)return a(n.finallyLoc)}}}},abrupt:function(t,e){for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a];if(o.tryLoc<=this.prev&&p.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var n=o;break}}n&&(t==="break"||t==="continue")&&n.tryLoc<=e&&e<=n.finallyLoc&&(n=null);var i=n?n.completion:{};return i.type=t,i.arg=e,n?(this.method="next",this.next=n.finallyLoc,v):this.complete(i)},complete:function(t,e){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"&&e&&(this.next=e),v},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var a=this.tryEntries[e];if(a.finallyLoc===t)return this.complete(a.completion,a.afterLoc),L(a),v}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var a=this.tryEntries[e];if(a.tryLoc===t){var o=a.completion;if(o.type==="throw"){var n=o.arg;L(a)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,a){return this.delegate={iterator:S(t),resultName:e,nextLoc:a},this.method==="next"&&(this.arg=d),v}},s}var _t=function(s){var R,p,b,h=s.user,A=Object(ot.a)(s,["user"]),X=Object(E.useState)(1),j=Object(D.a)(X,2),_=j[0],M=j[1],B=Object(E.useState)(!1),W=Object(D.a)(B,2),Q=W[0],Y=W[1],T=Object(E.useState)(!1),v=Object(D.a)(T,2),N=v[0],U=v[1],g=Object(E.useState)(""),I=Object(D.a)(g,2),K=I[0],w=I[1],P=Object(E.useState)(!0),G=Object(D.a)(P,2),C=G[0],Z=G[1],$=Object(E.useState)([{},{}]),J=Object(D.a)($,2),L=J[0],k=J[1],S=Object(at.l)(),r=S.pathname;console.log(S,"location"),Object(E.useEffect)(function(){var o;(h==null||((o=h.userInfo)===null||o===void 0)?void 0:o.identity)&&t()},[h==null||((R=h.userInfo)===null||R===void 0)?void 0:R.identity]),Object(E.useEffect)(function(){e()},[]);var t=function(){if(r.includes("classrooms")){var n;(h==null||((n=h.userInfo)===null||n===void 0)?void 0:n.identity)==="student"&&(Y(!0),M(2));return}if(r.includes("paths")){U(!0);return}},e=function(){var o=Object(nt.a)(H().mark(function n(i){var u,c,f,y;return H().wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return F.next=2,Object(lt.a)("/api/introductions.json",{method:"get"});case 2:u=F.sent,(u==null?void 0:u.introductions)&&(c=null,r.includes("classrooms")&&(c="course",w("\u6559\u5B66\u8BFE\u5802")),r.includes("paths")&&(c="subject",w("\u5B9E\u8DF5\u8BFE\u7A0B")),f=u.introductions,y=[f==null?void 0:f.find(function(z){return z.clazz==="teacher"&&z.page_type===c}),f==null?void 0:f.find(function(z){return z.clazz==="student"&&z.page_type===c})],k(y)),Z(!1);case 5:case"end":return F.stop()}},n)}));return function(i){return o.apply(this,arguments)}}(),a=function(){var n,i,u=st.a.API_SERVER+"/api/attachments/"+(_===1?(n=L[0])===null||n===void 0?void 0:n.attachment_id:(i=L[1])===null||i===void 0?void 0:i.attachment_id);Object(ut.s)("",u)};return m.a.createElement("section",{className:O.a.guidance},m.a.createElement(et.a,{loading:C,active:!0,paragraph:{rows:5}},m.a.createElement("div",{className:O.a.title},K,"\u65B0\u624B\u6307\u5F15"),m.a.createElement("ul",{className:O.a.u},!Q&&m.a.createElement("li",{onClick:function(){return M(1)},className:_===1?O.a.active:""},"\u6559\u5E08\u7248"),!N&&m.a.createElement("li",{onClick:function(){return M(2)},className:_===2?O.a.active:""},"\u5B66\u751F\u7248")),_===1&&m.a.createElement("div",{className:O.a.content},m.a.createElement(tt.a,{value:((p=L[0])===null||p===void 0?void 0:p.content)||""})),_===2&&m.a.createElement("div",{className:O.a.content},m.a.createElement(tt.a,{value:((b=L[1])===null||b===void 0?void 0:b.content)||""})),m.a.createElement("div",{className:O.a.btn},m.a.createElement(rt.a,{type:"primary",onClick:a},"\u4E0B\u8F7D\u7528\u6237\u624B\u518C"))))};V.default=Object(it.a)(function(d){var s=d.user;return{user:s}})(_t)}}]);