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.0 KiB
1 line
8.0 KiB
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[38734],{21248:function(e,n,t){t.d(n,{Z:function(){return _}});var i=t(82242),a=t.n(i),o=t(7557),s=t.n(o),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(70557),m=t(72355),x=t(6848),v=t(20731),g=t(39996),j=t(72226),y=t(17631),b=t(37712),_=function(e){var n,t,i,o,c,r,_,k=e.editOffice,w=void 0===k?"view":k,C=e.data,Z=(e.theme,e.type),P=e.filename,R=e.monacoEditor,S=e.className,I=e.style,E=e.close,N=e.onClose,z=e.hasMask,O=e.disabledDownload,W=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"!==Z&&(C=y.Z.API_SERVER+C),P&&(R.filename=P),(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"===Z&&q()}),[Z,C]);var q=function(){var e=l()(s()().mark((function e(){var n,t,i;return s()().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(){G()},G=function(){(0,v.Nd)(P||"educoder",decodeURIComponent(C))};return(0,b.jsxs)("div",{style:a()({},I||{}),className:"".concat(z&&p.bgBlack," ").concat(Z?p.wrp:"hide"),children:[E&&(0,b.jsxs)("div",{className:p.close,ref:H,children:[!!W&&(0,b.jsx)(x.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return H.current},children:(0,b.jsx)("span",{onClick:function(){N(),W()},children:(0,b.jsx)("i",{className:"icon-yulanpizhu"})})}),!O&&(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[S]," ").concat(S," ").concat(p.monaco," ").concat("txt"===Z?"show":"hide"),children:"txt"===Z&&(0,b.jsx)(m.ZP,a()({},R))}),"audio"===Z&&(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"===Z&&(0,b.jsx)(b.Fragment,{children:(null===(o=C)||void 0===o?void 0:o.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"===Z&&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(!!O)}),"html"===Z&&(0,b.jsx)("iframe",{src:C+"&disposition=inline"}),"pdf"===Z&&(0,b.jsx)("iframe",{src:"".concat(U,"/js/pdfview/index.html?url=").concat(C,"&disabledDownload=").concat(!!O)}),"image"===Z&&(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"===Z||"download"===Z)&&(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,{}),"点击下载"]})})]})}},69414:function(e,n,t){t.r(n),t.d(n,{default:function(){return j}});var i=t(7557),a=t.n(i),o=t(41498),s=t.n(o),c=t(79800),l=t.n(c),r=t(59301),d=t(66104),u=t(13032),p="innerhtml___RrSV2",f=t(17631),h=(t(56349),t(61186)),m=t.n(h),x=t(58181),v=t(21248),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,t=(0,u.useSearchParams)(),i=(l()(t,1)[0],(0,u.useParams)()),o=(0,r.useState)({}),c=l()(o,2),h=c[0],j=c[1],y=(0,r.useState)({content:"",type:""}),b=l()(y,2),_=b[0],k=b[1],w=(0,r.useRef)();function C(){return(C=s()(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==i?void 0:i.id,".json"),{method:"get"});case 2:0===(null==(n=e.sent)?void 0:n.status)&&j(null==n?void 0:n.data);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}(0,r.useEffect)((function(){!function(){C.apply(this,arguments)}()}),[]);var Z=function(){var e=s()(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,w.current=t;case 5:k({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==h?void 0:h.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==h?void 0:h.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==h?void 0:h.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==h?void 0:h.publish_time).format("YYYY-MM-DD")})]}),(null==h?void 0:h.link)&&(0,g.jsxs)("a",{href:null==h?void 0:h.link,target:"_blank",style:{marginLeft:30},children:[(0,g.jsx)("i",{className:"iconfont icon-lianjie",style:{fontSize:18}})," 前往原链接"]}),(null==h||null===(n=h.attachment)||void 0===n?void 0:n.id)&&(0,g.jsx)("div",{style:{marginLeft:30,cursor:"pointer"},onClick:function(){Z(null==h?void 0:h.attachment)},children:"查看文件"})]}),(0,g.jsx)("div",{className:p,dangerouslySetInnerHTML:{__html:null==h?void 0:h.content}})]})]}),(0,g.jsx)(v.Z,{close:!0,data:null==_?void 0:_.content,type:null==_?void 0:_.type,hasMask:!0,editOffice:"view",monacoEditor:{value:w.current,language:"txt",onChange:function(){},options:{readOnly:!0,fontSize:14,minimap:{enabled:!1}}},onClose:function(){k({content:"",type:""})}})]})}))}}]); |