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__virtualSpaces__Lists__Pl...

1 line
8.2 KiB

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[82339],{29114:function(e,n,t){t.d(n,{Z:function(){return w}});var i=t(82242),a=t.n(i),c=t(7557),o=t.n(c),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),g=t(37712),w=function(e){var n,t,i,c,s,r,w,k=e.editOffice,y=void 0===k?"view":k,Z=e.data,C=(e.theme,e.type),N=e.filename,S=e.monacoEditor,P=e.className,E=e.style,I=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),D=(q[0],q[1]),F=(0,u.useState)(),J=d()(F,2),U=J[0],M=J[1],L="build"===window.ENV?"/react/build":"",X=location.host.startsWith("localhost")?j.Z.PROXY_SERVER:j.Z.API_SERVER,Y=(0,u.useRef)();null!==(n=Z)&&void 0!==n&&n.startsWith("/api")&&"txt"!==C&&(Z=j.Z.API_SERVER+Z),N&&(S.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]&&D(n[1])}))}),[]),(0,u.useEffect)((function(){"office"===C&&G()}),[C,Z]);var G=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=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:i=e.sent,M(i);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),H=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,g.jsxs)("div",{style:a()({},E||{}),className:"".concat(V&&p.bgBlack," ").concat(C?p.wrp:"hide"),children:[I&&(0,g.jsxs)("div",{className:p.close,ref:Y,children:[!!z&&(0,g.jsx)(m.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return Y.current},children:(0,g.jsx)("span",{onClick:function(){R(),z()},children:(0,g.jsx)("i",{className:"icon-yulanpizhu"})})}),!O&&(0,g.jsx)(m.Z,{title:"点击下载此文件",getPopupContainer:function(){return Y.current},children:(0,g.jsx)("span",{onClick:K,children:(0,g.jsx)("i",{className:"icon-quxiaozhiding"})})}),(0,g.jsx)(m.Z,{title:"关闭",getPopupContainer:function(){return Y.current},children:(0,g.jsx)("span",{className:"",onClick:R,children:(0,g.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,g.jsx)("div",{className:"".concat(p[P]," ").concat(P," ").concat(p.monaco," ").concat("txt"===C?"show":"hide"),children:"txt"===C&&(0,g.jsx)(x.ZP,a()({},S))}),"audio"===C&&(0,g.jsx)("audio",{src:(null===(t=Z)||void 0===t?void 0:t.indexOf("http"))>-1||null!==(i=Z)&&void 0!==i&&i.startsWith("/api")?Z:"data:image/png;base64,".concat(Z),autoPlay:!0}),"video"===C&&(0,g.jsx)(g.Fragment,{children:(null===(c=Z)||void 0===c?void 0:c.indexOf("http"))>-1||null!==(s=Z)&&void 0!==s&&s.startsWith("/api")?(0,g.jsx)("video",{controls:!0,src:"".concat(Z),autoPlay:!0}):(0,g.jsx)("video",{controls:!0,src:"data:video/mp4;base64,".concat(Z),autoPlay:!0})}),"office"===C&&U&&(0,g.jsx)("iframe",{src:"".concat(L,"/office.html?key=").concat(U.key,"&url=").concat(X+U.url,"&callbackUrl=").concat(X+U.callbackUrl,"&fileType=").concat(U.fileType,"&title=").concat(U.title,"&model=").concat(y,"&officeServer=").concat(j.Z.ONLYOFFICE,"&disabledDownload=").concat(!!O)}),"html"===C&&(0,g.jsx)("iframe",{src:Z+"&disposition=inline"}),"pdf"===C&&(0,g.jsx)("iframe",{src:"".concat(L,"/js/pdfview/index.html?url=").concat(Z,"&disabledDownload=").concat(!!O)}),"image"===C&&(0,g.jsx)("img",{src:(null===(r=Z)||void 0===r?void 0:r.indexOf("http"))>-1||null!==(w=Z)&&void 0!==w&&w.startsWith("/api")?Z:"data:image/png;base64,".concat(Z)}),("other"===C||"download"===C)&&(0,g.jsx)(g.Fragment,{children:W?(0,g.jsx)(b.Z,{customText:"当前文件不支持预览,可点击下载查看",ButtonTwo:(0,g.jsx)(f.ZP,{icon:(0,g.jsx)("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:H,children:"下载"})}):(0,g.jsxs)(f.ZP,{type:"primary",size:"middle",onClick:H,children:[(0,g.jsx)(_.Z,{}),"点击下载"]})})]})}},95818:function(e,n,t){t.r(n),t.d(n,{default:function(){return C}});var i=t(7557),a=t.n(i),c=t(82242),o=t.n(c),s=t(41498),l=t.n(s),r=t(79800),d=t.n(r),u=t(59301),p=t(43418),f=t(8591),_=t(49105),x="wrap___r3so2",m="btns___SkCgc",h="content___qGyOY",v=t(2753),b=t(11806),j=t(29114),g=t(71681),w=t(27876),k=t(75916),y=t(80608),Z=t(37712),C=(0,y.connect)((function(e){var n=e.virtualSpaces;return{globalSetting:e.globalSetting,virtualSpaces:n}}))((function(e){e.globalSetting,e.dispatch;var n=e.virtualSpaces,t=(0,u.useState)({}),i=d()(t,2),c=i[0],s=i[1],r=(0,u.useState)({content:"",type:""}),C=d()(r,2),N=C[0],S=C[1],P=(0,y.useParams)(),E=P.id,I=(P.virtual_spacesId,(0,u.useRef)()),R=n.virtualSpacesDetails;(0,u.useEffect)((function(){E&&O()}),[E]);var V,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,_.ZP)("/api/attachments/".concat(E,"/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,_.ZP)(n.url,{method:"get",headers:{"Content-Type":"application/xml"}});case 8:t=e.sent,I.current=t;case 10:S({type:n.file_type,content:g.Z.API_SERVER+n.url});case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,Z.jsxs)("div",{className:x,children:[(0,Z.jsx)(v.qE,{title:c.title,onClick:function(){return y.history.push("/".concat(w.AS,"/").concat(P.virtual_spacesId,"/plan"))},children:(0,Z.jsxs)("div",{className:m,children:[(0,k.bg)()&&(0,Z.jsx)("div",{onClick:function(){var e;(0,w.Nd)("","".concat(g.Z.API_SERVER).concat(null===(e=c.url)||void 0===e?void 0:e.replace("disposition=inline","")))},children:(0,Z.jsxs)("span",{className:"primary-hover",children:[(0,Z.jsx)("i",{className:"iconfont icon-xiazai4 font14 mr5"}),"下载"]})}),(V=null==c?void 0:c.user_id,((0,k.Ny)()||(null==R?void 0:R.is_creator)||(null==R?void 0:R.is_member)&&(null==R?void 0:R.user_id)===V)&&(0,Z.jsx)("div",{onClick:function(){var e;p.Z.confirm({title:"提示",okText:"确定删除",okButtonProps:{danger:!0},icon:!1,className:b.Z.CustomTipsModalCss,cancelText:"取消",content:(0,Z.jsxs)("div",{children:[(0,Z.jsxs)("div",{children:["确认删除《",c.title,"》吗?"]}),(0,Z.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,_.ZP)("/api/attachments/".concat(E,".json"),{method:"delete"});case 2:0===(null==(n=e.sent)?void 0:n.status)&&(y.history.push("/".concat(w.AS,"/").concat(P.virtual_spacesId,"/plan")),f.ZP.success("删除成功"));case 4:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)})})},children:(0,Z.jsxs)("span",{className:"delete-hover",children:[" ",(0,Z.jsx)("i",{className:"iconfont icon-piliangshanchubeifen font14 mr5"}),"删除"]})}))]})}),(0,Z.jsx)("div",{className:h,children:(0,Z.jsx)(j.Z,{data:null==N?void 0:N.content,type:null==N?void 0:N.type,disabledDownload:!(0,k.bg)(),style:{position:"absolute",zIndex:1,alignItems:"flex-start"},monacoEditor:{value:I.current,language:"txt",onChange:function(){},options:{readOnly:!0,fontSize:14,minimap:{enabled:!1}}},onClose:function(){return S({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"}}}]);