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([[87058],{29114:function(e,n,t){t.d(n,{Z:function(){return y}});var c=t(82242),a=t.n(c),i=t(7557),o=t.n(i),s=t(41498),l=t.n(s),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),_=t(22441),x=t(38288),m=t(6848),h=t(27876),v=t(43516),b=t(6638),j=t(71681),w=t(37712),y=function(e){var n,t,c,i,s,r,y,k=e.editOffice,g=void 0===k?"view":k,Z=e.data,C=(e.theme,e.type),N=e.filename,P=e.monacoEditor,I=e.className,E=e.style,S=e.close,R=e.onClose,V=e.hasMask,O=e.disabledDownload,z=e.onImgDimensions,W=e.showNodata,A=(0,u.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),B=d()(A,2),T=(B[0],B[1],(0,u.useState)("")),q=d()(T,2),F=(q[0],q[1]),J=(0,u.useState)(),U=d()(J,2),X=U[0],D=U[1],M="build"===window.ENV?"/react/build":"",H=location.host.startsWith("localhost")?j.Z.PROXY_SERVER:j.Z.API_SERVER,L=(0,u.useRef)();null!==(n=Z)&&void 0!==n&&n.startsWith("/api")&&"txt"!==C&&(Z=j.Z.API_SERVER+Z),N&&(P.filename=N),(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]&&F(n[1])}))}),[]),(0,u.useEffect)((function(){"office"===C&&Y()}),[C,Z]);var Y=function(){var e=l()(o()().mark((function e(){var n,t,c;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Z,Z.startsWith("http")||(n=location.origin+n),t=new URL(n).pathname.split("/").pop(),e.next=5,(0,v.gJ)({attachment_id:t});case 5:c=e.sent,D(c);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),G=function(){Z.startsWith("http")||Z.startsWith("blob:")?K():(0,h.Sv)(N||"educoder",Z,N)},K=function(){(0,h.Nd)(N||"educoder",decodeURIComponent(Z))};return(0,w.jsxs)("div",{style:a()({},E||{}),className:"".concat(V&&p.bgBlack," ").concat(C?p.wrp:"hide"),children:[S&&(0,w.jsxs)("div",{className:p.close,ref:L,children:[!!z&&(0,w.jsx)(m.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return L.current},children:(0,w.jsx)("span",{onClick:function(){R(),z()},children:(0,w.jsx)("i",{className:"icon-yulanpizhu"})})}),!O&&(0,w.jsx)(m.Z,{title:"点击下载此文件",getPopupContainer:function(){return L.current},children:(0,w.jsx)("span",{onClick:K,children:(0,w.jsx)("i",{className:"icon-quxiaozhiding"})})}),(0,w.jsx)(m.Z,{title:"关闭",getPopupContainer:function(){return L.current},children:(0,w.jsx)("span",{className:"",onClick:R,children:(0,w.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,w.jsx)("div",{className:"".concat(p[I]," ").concat(I," ").concat(p.monaco," ").concat("txt"===C?"show":"hide"),children:"txt"===C&&(0,w.jsx)(x.ZP,a()({},P))}),"audio"===C&&(0,w.jsx)("audio",{src:(null===(t=Z)||void 0===t?void 0:t.indexOf("http"))>-1||null!==(c=Z)&&void 0!==c&&c.startsWith("/api")?Z:"data:image/png;base64,".concat(Z),autoPlay:!0}),"video"===C&&(0,w.jsx)(w.Fragment,{children:(null===(i=Z)||void 0===i?void 0:i.indexOf("http"))>-1||null!==(s=Z)&&void 0!==s&&s.startsWith("/api")?(0,w.jsx)("video",{controls:!0,src:"".concat(Z),autoPlay:!0}):(0,w.jsx)("video",{controls:!0,src:"data:video/mp4;base64,".concat(Z),autoPlay:!0})}),"office"===C&&X&&(0,w.jsx)("iframe",{src:"".concat(M,"/office.html?key=").concat(X.key,"&url=").concat(H+X.url,"&callbackUrl=").concat(H+X.callbackUrl,"&fileType=").concat(X.fileType,"&title=").concat(X.title,"&model=").concat(g,"&officeServer=").concat(j.Z.ONLYOFFICE,"&disabledDownload=").concat(!!O)}),"html"===C&&(0,w.jsx)("iframe",{src:Z+"&disposition=inline"}),"pdf"===C&&(0,w.jsx)("iframe",{src:"".concat(M,"/js/pdfview/index.html?url=").concat(Z,"&disabledDownload=").concat(!!O)}),"image"===C&&(0,w.jsx)("img",{src:(null===(r=Z)||void 0===r?void 0:r.indexOf("http"))>-1||null!==(y=Z)&&void 0!==y&&y.startsWith("/api")?Z:"data:image/png;base64,".concat(Z)}),("other"===C||"download"===C)&&(0,w.jsx)(w.Fragment,{children:W?(0,w.jsx)(b.Z,{customText:"当前文件不支持预览,可点击下载查看",ButtonTwo:(0,w.jsx)(f.ZP,{icon:(0,w.jsx)("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:G,children:"下载"})}):(0,w.jsxs)(f.ZP,{type:"primary",size:"middle",onClick:G,children:[(0,w.jsx)(_.Z,{}),"点击下载"]})})]})}},62038:function(e,n,t){t.r(n),t.d(n,{default:function(){return P}});var c=t(7557),a=t.n(c),i=t(82242),o=t.n(i),s=t(41498),l=t.n(s),r=t(79800),d=t.n(r),u=t(70236),p=t.n(u),f=t(59301),_=t(43418),x=t(8591),m=t(49105),h="wrap___o2NPa",v="btns___cXvqH",b="content___f5hCX",j=t(2753),w=t(11806),y=t(29114),k=t(71681),g=t(27876),Z=t(80608),C=t(75916),N=t(37712),P=function(e){p()(e);var n=(0,Z.useSearchParams)(),t=(d()(n,1)[0],(0,f.useState)({})),c=d()(t,2),i=c[0],s=c[1],r=(0,f.useState)({content:"",type:""}),u=d()(r,2),P=u[0],I=u[1],E=(0,Z.useParams)(),S=E.id,R=E.virtual_spacesId,V=(0,f.useRef)();(0,f.useEffect)((function(){S&&O()}),[S]);var O=function(){var e=l()(a()().mark((function e(){var n,t;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,m.ZP)("/api/virtual_classrooms/".concat(R,"/files/").concat(S,"/file_detail.json"),{method:"get"});case 2:if(-1===(null==(n=e.sent)?void 0:n.status)){e.next=11;break}if(s(o()({},n)),"txt"!==n.file_type){e.next=10;break}return e.next=8,(0,m.ZP)(n.url,{method:"get",headers:{"Content-Type":"application/xml"}});case 8:t=e.sent,V.current=t;case 10:I({type:n.file_type,content:k.Z.API_SERVER+n.url});case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,N.jsxs)("div",{className:h,children:[(0,N.jsx)(j.qE,{title:i.title,onClick:function(){return Z.history.push("/".concat(g.AS,"/").concat(E.virtual_spacesId,"/survey"))},children:(0,N.jsxs)("div",{className:v,children:[(0,C.bg)()&&(0,N.jsx)("div",{onClick:function(){var e;(0,g.Nd)("","".concat(k.Z.API_SERVER).concat(null===(e=i.url)||void 0===e?void 0:e.replace("disposition=inline","")))},children:(0,N.jsxs)("span",{className:"primary-hover",children:[(0,N.jsx)("i",{className:"iconfont icon-xiazai4 font14 mr5"}),"下载"]})}),(null==i?void 0:i.can_delete)&&(0,N.jsx)("div",{onClick:function(){var e;_.Z.confirm({title:"提示",okText:"确定删除",okButtonProps:{danger:!0},icon:!1,className:w.Z.CustomTipsModalCss,cancelText:"取消",content:(0,N.jsxs)("div",{children:[(0,N.jsxs)("div",{children:["确认删除《",i.title,"》吗?"]}),(0,N.jsx)("div",{className:"mt10",children:"删除后,将无法恢复,请谨慎操作"})]}),onOk:(e=l()(a()().mark((function e(){var n;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,m.ZP)("/api/virtual_classrooms/".concat(E.virtual_spacesId,"/files/").concat(S,".json"),{method:"delete",body:{is_outer_chain:0}});case 2:0===(null==(n=e.sent)?void 0:n.status)&&(Z.history.push("/".concat(g.AS,"/").concat(E.virtual_spacesId,"/survey")),x.ZP.success("删除成功"));case 4:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)})})},children:(0,N.jsxs)("span",{className:"delete-hover",children:[" ",(0,N.jsx)("i",{className:"iconfont icon-piliangshanchubeifen font14 mr5"}),"删除"]})})]})}),(0,N.jsx)("div",{className:b,children:(0,N.jsx)(y.Z,{data:null==P?void 0:P.content,disabledDownload:!(0,C.bg)(),type:null==P?void 0:P.type,style:{position:"absolute",zIndex:1,alignItems:"flex-start"},monacoEditor:{value:V.current,language:"txt",onChange:function(){},options:{readOnly:!0,fontSize:14,minimap:{enabled:!1}}},onClose:function(){return I({content:"",type:""})}})})]})}},11806:function(e,n){n.Z={flex_box_center:"flex_box_center___vG4eV",flex_space_between:"flex_space_between___qVVxe",flex_box_vertical_center:"flex_box_vertical_center___P8Z8s",flex_box_center_end:"flex_box_center_end___VMme3",flex_box_column:"flex_box_column___VMHwm",dropdownmenus:"dropdownmenus___oVzoj",popupClassNames:"popupClassNames___OcZq7",selectdown:"selectdown___mmcA8"}}}]); |