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.
1 line
8.1 KiB
1 line
8.1 KiB
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[38734],{83385:function(e,n,t){t.d(n,{Z:function(){return _}});var i=t(82242),a=t.n(i),s=t(7557),o=t.n(s),c=t(41498),l=t.n(c),r=t(79800),d=t.n(r),u=t(59301),p={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},f=t(3113),h=t(38827),m=t(71138),x=t(6848),v=t(23756),g=t(37924),j=t(72721),y=t(97730),b=t(37712),_=function(e){var n,t,i,s,c,r,_,k=e.editOffice,w=void 0===k?"view":k,C=e.data,S=(e.theme,e.type),Z=e.filename,P=e.monacoEditor,R=e.className,I=e.style,E=e.close,N=e.onClose,W=e.hasMask,z=e.disabledDownload,O=e.onImgDimensions,B=e.showNodata,T=(0,u.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),V=d()(T,2),L=(V[0],V[1],(0,u.useState)("")),Y=d()(L,2),A=(Y[0],Y[1]),D=(0,u.useState)(),F=d()(D,2),J=F[0],M=F[1],U="build"===window.ENV?"/react/build":"",X=location.host.startsWith("localhost")?y.Z.PROXY_SERVER:y.Z.API_SERVER,H=(0,u.useRef)();null!==(n=C)&&void 0!==n&&n.startsWith("/api")&&"txt"!==S&&(C=y.Z.API_SERVER+C),Z&&(P.filename=Z),(0,u.useEffect)((function(){var e,n=null===(e=document.cookie)||void 0===e||null===(e=e.replace(/\s/g,""))||void 0===e?void 0:e.split(";");null==n||n.map((function(e){var n=e.split("=");"_educoder_session"===n[0]&&A(n[1])}))}),[]),(0,u.useEffect)((function(){"office"===S&&q()}),[S,C]);var q=function(){var e=l()(o()().mark((function e(){var n,t,i;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=C,C.startsWith("http")||(n=location.origin+n),t=new URL(n).pathname.split("/").pop(),e.next=5,(0,g.gJ)({attachment_id:t});case 5:i=e.sent,M(i);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),K=function(){C.startsWith("http")||C.startsWith("blob:")?G():(0,v.Sv)(Z||"educoder",C,Z)},G=function(){(0,v.Nd)(Z||"educoder",decodeURIComponent(C))};return(0,b.jsxs)("div",{style:a()({},I||{}),className:"".concat(W&&p.bgBlack," ").concat(S?p.wrp:"hide"),children:[E&&(0,b.jsxs)("div",{className:p.close,ref:H,children:[!!O&&(0,b.jsx)(x.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return H.current},children:(0,b.jsx)("span",{onClick:function(){N(),O()},children:(0,b.jsx)("i",{className:"icon-yulanpizhu"})})}),!z&&(0,b.jsx)(x.Z,{title:"点击下载此文件",getPopupContainer:function(){return H.current},children:(0,b.jsx)("span",{onClick:G,children:(0,b.jsx)("i",{className:"icon-quxiaozhiding"})})}),(0,b.jsx)(x.Z,{title:"关闭",getPopupContainer:function(){return H.current},children:(0,b.jsx)("span",{className:"",onClick:N,children:(0,b.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,b.jsx)("div",{className:"".concat(p[R]," ").concat(R," ").concat(p.monaco," ").concat("txt"===S?"show":"hide"),children:"txt"===S&&(0,b.jsx)(m.ZP,a()({},P))}),"audio"===S&&(0,b.jsx)("audio",{src:(null===(t=C)||void 0===t?void 0:t.indexOf("http"))>-1||null!==(i=C)&&void 0!==i&&i.startsWith("/api")?C:"data:image/png;base64,".concat(C),autoPlay:!0}),"video"===S&&(0,b.jsx)(b.Fragment,{children:(null===(s=C)||void 0===s?void 0:s.indexOf("http"))>-1||null!==(c=C)&&void 0!==c&&c.startsWith("/api")?(0,b.jsx)("video",{controls:!0,src:"".concat(C),autoPlay:!0}):(0,b.jsx)("video",{controls:!0,src:"data:video/mp4;base64,".concat(C),autoPlay:!0})}),"office"===S&&J&&(0,b.jsx)("iframe",{src:"".concat(U,"/office.html?key=").concat(J.key,"&url=").concat(X+J.url,"&callbackUrl=").concat(X+J.callbackUrl,"&fileType=").concat(J.fileType,"&title=").concat(J.title,"&model=").concat(w,"&officeServer=").concat(y.Z.ONLYOFFICE,"&disabledDownload=").concat(!!z)}),"html"===S&&(0,b.jsx)("iframe",{src:C+"&disposition=inline"}),"pdf"===S&&(0,b.jsx)("iframe",{src:"".concat(U,"/js/pdfview/index.html?url=").concat(C,"&disabledDownload=").concat(!!z)}),"image"===S&&(0,b.jsx)("img",{src:(null===(r=C)||void 0===r?void 0:r.indexOf("http"))>-1||null!==(_=C)&&void 0!==_&&_.startsWith("/api")?C:"data:image/png;base64,".concat(C)}),("other"===S||"download"===S)&&(0,b.jsx)(b.Fragment,{children:B?(0,b.jsx)(j.Z,{customText:"当前文件不支持预览,可点击下载查看",ButtonTwo:(0,b.jsx)(f.ZP,{icon:(0,b.jsx)("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:K,children:"下载"})}):(0,b.jsxs)(f.ZP,{type:"primary",size:"middle",onClick:K,children:[(0,b.jsx)(h.Z,{}),"点击下载"]})})]})}},57914:function(e,n,t){t.r(n),t.d(n,{default:function(){return j}});var i=t(7557),a=t.n(i),s=t(41498),o=t.n(s),c=t(79800),l=t.n(c),r=t(59301),d=t(66104),u=t(35699),p="innerhtml___RrSV2",f=t(97730),h=(t(39627),t(61186)),m=t.n(h),x=t(23634),v=t(83385),g=t(37712),j=(0,u.connect)((function(e){var n=e.homePage,t=e.loading,i=e.globalSetting,a=e.user;return{homePage:n,globalSetting:i,loading:t.models.homePage,user:a}}))((function(e){e.homePage,e.globalSetting,e.user,e.loading,e.dispatch;var n=(0,u.useSearchParams)(),t=(l()(n,1)[0],(0,u.useParams)()),i=(0,r.useState)({}),s=l()(i,2),c=s[0],h=s[1],j=(0,r.useState)({content:"",type:""}),y=l()(j,2),b=y[0],_=y[1],k=(0,r.useRef)();function w(){return(w=o()(a()().mark((function e(){var n;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,x.ZP)("/api/core_subject_papers/".concat(null==t?void 0:t.id,".json"),{method:"get"});case 2:0===(null==(n=e.sent)?void 0:n.status)&&h(null==n?void 0:n.data);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}(0,r.useEffect)((function(){!function(){w.apply(this,arguments)}()}),[]);var C=function(){var e=o()(a()().mark((function e(n){var t;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("txt"!==n.file_type){e.next=5;break}return e.next=3,(0,x.ZP)(n.url,{method:"get",headers:{"Content-Type":"application/xml"}});case 3:t=e.sent,k.current=t;case 5:_({type:n.file_type,content:f.Z.API_SERVER+n.url});case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,g.jsxs)("section",{style:{background:"#fff",paddingBottom:60},children:[(0,g.jsxs)("div",{style:{width:1200,margin:"0px auto"},children:[(0,g.jsx)("div",{style:{display:"flex",paddingTop:25,justifyContent:"space-between"},children:(0,g.jsx)(d.Z,{items:[{title:(0,g.jsx)(u.Link,{to:"/paper",children:"教学论文"})},{title:"正文"}]})}),(0,g.jsxs)("div",{style:{marginTop:30},children:[(0,g.jsx)("div",{style:{fontWeight:600,fontSize:26,color:"#000",textAlign:"center"},children:null==c?void 0:c.title}),(0,g.jsxs)("div",{style:{marginTop:20,display:"flex",justifyContent:"center",fontSize:18,flexWrap:"wrap"},children:[(0,g.jsxs)("div",{style:{display:"flex",alignItems:"baseline",marginRight:30},children:[(0,g.jsx)("span",{style:{color:"#999999",marginRight:10},children:"所属课程"}),(0,g.jsx)("span",{children:null==c?void 0:c.core_subject_name})]}),(0,g.jsxs)("div",{style:{display:"flex",alignItems:"baseline",marginRight:30},children:[(0,g.jsx)("span",{style:{color:"#999999",marginRight:10},children:"作者"}),(0,g.jsx)("span",{children:null==c?void 0:c.author})]}),(0,g.jsxs)("div",{style:{display:"flex",alignItems:"baseline",marginRight:30},children:[(0,g.jsx)("span",{style:{color:"#999999",marginRight:10},children:"发布时间"}),(0,g.jsx)("span",{children:m()(null==c?void 0:c.publish_time).format("YYYY-MM-DD")})]}),(null==c?void 0:c.link)&&(0,g.jsxs)("a",{href:null==c?void 0:c.link,target:"_blank",style:{marginLeft:30},children:[(0,g.jsx)("i",{className:"iconfont icon-lianjie",style:{fontSize:18}})," 前往原链接"]}),(null==c?void 0:c.link)&&(0,g.jsx)("div",{style:{marginLeft:30,cursor:"pointer"},onClick:function(){C(null==c?void 0:c.attachment)},children:"查看文件"})]}),(0,g.jsx)("div",{className:p,dangerouslySetInnerHTML:{__html:null==c?void 0:c.content}})]})]}),(0,g.jsx)(v.Z,{close:!0,data:null==b?void 0:b.content,type:null==b?void 0:b.type,hasMask:!0,editOffice:"view",monacoEditor:{value:k.current,language:"txt",onChange:function(){},options:{readOnly:!0,fontSize:14,minimap:{enabled:!1}}},onClose:function(){_({content:"",type:""})}})]})}))}}]); |