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
3.0 KiB
2 lines
3.0 KiB
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[869],{48506:function(Y,x,c){c.r(x),c.d(x,{default:function(){return Q}});var e=c(59301),b=c(63144),O=c(15826),P=c(56511),I=c(3113),u={flex_box_center:"flex_box_center___xpkMF",flex_space_between:"flex_space_between___X8GQS",flex_box_vertical_center:"flex_box_vertical_center___QXnUW",flex_box_center_end:"flex_box_center_end___Qxdq1",flex_box_column:"flex_box_column___pN_H3",guidance:"guidance___BnanP",title:"title___b2ocd",u:"u___QIqxh",active:"active___VXClY",content:"content___NNbRj",btn:"btn___Q2wyi"},j=c(76265),C=c(46961),g=c(31272),N=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,Z=(n,i)=>{var t={};for(var a in n)F.call(n,a)&&i.indexOf(a)<0&&(t[a]=n[a]);if(n!=null&&N)for(var a of N(n))i.indexOf(a)<0&&T.call(n,a)&&(t[a]=n[a]);return t},w=(n,i,t)=>new Promise((a,v)=>{var m=l=>{try{s(t.next(l))}catch(f){v(f)}},p=l=>{try{s(t.throw(l))}catch(f){v(f)}},s=l=>l.done?a(l.value):Promise.resolve(l.value).then(m,p);s((t=t.apply(n,i)).next())});const D=n=>{var i=n,{user:t}=i,a=Z(i,["user"]),v,m,p;const[s,l]=(0,e.useState)(1),[f,R]=(0,e.useState)(!1),[z,G]=(0,e.useState)(!1),[A,S]=(0,e.useState)(""),[X,H]=(0,e.useState)(!0),[y,L]=(0,e.useState)([{},{}]),B=(0,b.useLocation)(),{pathname:E}=B;console.log(B,"location"),(0,e.useEffect)(()=>{var o;(o=t==null?void 0:t.userInfo)!=null&&o.identity&&V()},[(v=t==null?void 0:t.userInfo)==null?void 0:v.identity]),(0,e.useEffect)(()=>{M()},[]);const V=()=>{var o;if(E.includes("classrooms")){((o=t==null?void 0:t.userInfo)==null?void 0:o.identity)==="student"&&(R(!0),l(2));return}if(E.includes("paths")){G(!0);return}},M=o=>w(void 0,null,function*(){const r=yield(0,j.ZP)("/api/introductions.json",{method:"get"});if(r!=null&&r.introductions){let d=null;E.includes("classrooms")&&(d="course",S("\u6559\u5B66\u8BFE\u5802")),E.includes("paths")&&(d="subject",S("\u5B9E\u8DF5\u8BFE\u7A0B"));const h=r.introductions,W=[h==null?void 0:h.find(_=>_.clazz==="teacher"&&_.page_type===d),h==null?void 0:h.find(_=>_.clazz==="student"&&_.page_type===d)];L(W)}H(!1)}),U=()=>{var o,r;const d=C.Z.API_SERVER+"/api/attachments/"+(s===1?(o=y[0])==null?void 0:o.attachment_id:(r=y[1])==null?void 0:r.attachment_id);(0,O.Nd)("",d)};return e.createElement("section",{className:u.guidance},e.createElement(P.Z,{loading:X,active:!0,paragraph:{rows:5}},e.createElement("div",{className:u.title},A,"\u65B0\u624B\u6307\u5F15"),e.createElement("ul",{className:u.u},!f&&e.createElement("li",{onClick:()=>l(1),className:s===1?u.active:""},"\u6559\u5E08\u7248"),!z&&e.createElement("li",{onClick:()=>l(2),className:s===2?u.active:""},"\u5B66\u751F\u7248")),s===1&&e.createElement("div",{className:u.content},e.createElement(g.Z,{value:((m=y[0])==null?void 0:m.content)||""})),s===2&&e.createElement("div",{className:u.content},e.createElement(g.Z,{value:((p=y[1])==null?void 0:p.content)||""})),e.createElement("div",{className:u.btn},e.createElement(I.ZP,{type:"primary",onClick:U},"\u4E0B\u8F7D\u7528\u6237\u624B\u518C"))))};var Q=(0,b.connect)(({user:n})=>({user:n}))(D)}}]);
|