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
9.3 KiB

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[82339],{7406:function(e,n,t){var i=t(82242),o=t.n(i),c=(t(59301),t(93314)),a=t(3113),s=t(37712);n.Z=function(e){var n=e.img,t=e.buttonProps,i=void 0===t?{}:t,l=e.styles,r=void 0===l?{}:l,d=e.customText,u=e.ButtonText,p=e.ButtonClick,f=e.Buttonclass,x=e.ButtonTwo,m=e.imgStyles,_=e.loading,v=void 0!==_&&_;return(0,s.jsxs)("section",{className:"tc animated fadeIn",style:o()(o()({},{color:"#999",margin:"100px auto",visibility:v?"hidden":"visible"}),r),children:[(0,s.jsx)("img",{src:n||c,style:o()(o()({},m),{},{pointerEvents:"none",userSelect:"none"})}),(0,s.jsx)("p",{className:"mt20 font14",children:d||"暂时还没有相关数据哦!"}),u&&(0,s.jsx)(a.ZP,o()(o()({className:f,onClick:p},i),{},{children:u})),x&&x]})}},84143:function(e,n,t){t.d(n,{Z:function(){return y}});var i=t(82242),o=t.n(i),c=t(7557),a=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),x=t(74516),m=t(94049),_=t(6848),v=t(6457),h=t(83),b=t(7406),g=t(27065),j=t(6288),w=t(37712),y=function(e){var n,t,i,c,s,r,y=e.editOffice,k=void 0===y?"view":y,Z=e.data,C=(e.theme,e.type),N=e.filename,I=e.monacoEditor,S=e.className,P=e.style,E=e.close,O=e.onClose,R=e.hasMask,V=e.disabledDownload,B=e.onImgDimensions,T=e.showNodata,z=e.recordInfo,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"),M=d()(A,2),W=(M[0],M[1],(0,u.useState)("")),F=d()(W,2),q=(F[0],F[1]),D=(0,u.useState)(),J=d()(D,2),U=J[0],L=J[1],X="build"===window.ENV?"/react/build":"",Y=location.host.startsWith("localhost")?g.Z.PROXY_SERVER:g.Z.API_SERVER,G=(0,u.useRef)();null!==(n=Z)&&void 0!==n&&n.startsWith("/api")&&"txt"!==C&&(Z=g.Z.API_SERVER+Z);N&&(I.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]&&q(n[1])}))}),[]),(0,u.useEffect)((function(){var e;"office"===C&&(Z.indexOf("bigfilescdn.")>-1||Z.indexOf("bigfiles1")>-1?L({url:Z,fileType:(e=Z,e.substring(e.lastIndexOf("/")+1).split(".").pop()),model:Z.indexOf("model=edit")?"edit":"view"}):H())}),[C,Z]);var H=function(){var e=l()(a()().mark((function e(){var n,t,i;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return console.log("data:",Z),n=Z,Z.startsWith("http")||(n=location.origin+n),t=new URL(n).pathname.split("/").pop(),e.next=6,(0,h.gJ)({attachment_id:t});case 6:(i=e.sent).url=Y+i.url,L(i);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),K=function(){Z.startsWith("http")||Z.startsWith("blob:")?Q():(0,v.Sv)(N||"educoder",Z,N)},Q=function(){z&&(0,j.fc)({id:null==z?void 0:z.id,watch_type:1,course_id:null==z?void 0:z.course_id}),(0,v.Nd)(N||"educoder",decodeURIComponent(Z))};return(0,w.jsxs)("div",{style:o()({},P||{}),className:"".concat(R&&p.bgBlack," ").concat(C?p.wrp:"hide"),children:[E&&(0,w.jsxs)("div",{className:p.close,ref:G,children:[!!B&&(0,w.jsx)(_.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return G.current},children:(0,w.jsx)("span",{onClick:function(){O(),B()},children:(0,w.jsx)("i",{className:"icon-yulanpizhu"})})}),!V&&(0,w.jsx)(_.Z,{title:"点击下载此文件",getPopupContainer:function(){return G.current},children:(0,w.jsx)("span",{onClick:Q,children:(0,w.jsx)("i",{className:"icon-quxiaozhiding"})})}),(0,w.jsx)(_.Z,{title:"关闭",getPopupContainer:function(){return G.current},children:(0,w.jsx)("span",{className:"",onClick:O,children:(0,w.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,w.jsx)("div",{className:"".concat(p[S]," ").concat(S," ").concat(p.monaco," ").concat("txt"===C?"show":"hide"),children:"txt"===C&&(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(m.ZP,o()({},I))})}),"audio"===C&&(0,w.jsx)("audio",{src:"".concat((null===(t=Z)||void 0===t?void 0:t.indexOf("http://"))>-1||(null===(i=Z)||void 0===i?void 0:i.indexOf("https://"))>-1?"":"data:audio/mp3;base64,").concat(Z),autoPlay:!0}),"video"===C&&(0,w.jsx)(w.Fragment,{children:(null===(c=Z)||void 0===c?void 0:c.indexOf("http"))>-1?(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&&U&&(0,w.jsx)("iframe",{src:"".concat(X,"/office.html?key=").concat(U.key,"&url=").concat(btoa(U.url),"&callbackUrl=").concat(Y+U.callbackUrl,"&fileType=").concat(U.fileType,"&title=").concat(U.title,"&model=").concat(k,"&officeServer=").concat(g.Z.ONLYOFFICE,"&disabledDownload=").concat(!!V)}),"html"===C&&(0,w.jsx)("iframe",{src:Z+"&disposition=inline"}),"pdf"===C&&(0,w.jsx)("iframe",{src:"".concat(X,"/js/pdfview/index.html?url=").concat(Z,"&disabledDownload=").concat(!!V)}),"image"===C&&(0,w.jsx)("img",{src:"".concat((null===(s=Z)||void 0===s?void 0:s.indexOf("http://"))>-1||(null===(r=Z)||void 0===r?void 0:r.indexOf("https://"))>-1?"":"data:image/png;base64,").concat(Z)}),("other"===C||"download"===C)&&(0,w.jsx)(w.Fragment,{children:T?(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:K,children:"下载"})}):(0,w.jsxs)(f.ZP,{type:"primary",size:"middle",onClick:K,children:[(0,w.jsx)(x.Z,{}),"点击下载"]})})]})}},13030:function(e,n,t){t.r(n),t.d(n,{default:function(){return C}});var i=t(7557),o=t.n(i),c=t(82242),a=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),x=t(51136),m="wrap___r3so2",_="btns___SkCgc",v="content___qGyOY",h=t(90963),b=t(14661),g=t(84143),j=t(27065),w=t(6457),y=t(89918),k=t(7880),Z=t(37712),C=(0,k.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],I=C[1],S=(0,k.useParams)(),P=S.id,E=(S.virtual_spacesId,(0,u.useRef)()),O=n.virtualSpacesDetails;(0,u.useEffect)((function(){P&&V()}),[P]);var R,V=function(){var e=l()(o()().mark((function e(){var n,t;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,x.ZP)("/api/attachments/".concat(P,"/detail.json"),{method:"get"});case 2:if(-1===(null==(n=e.sent)?void 0:n.status)){e.next=11;break}if(s(a()({},n)),"txt"!==n.file_type){e.next=10;break}return e.next=8,(0,x.ZP)(n.url,{method:"get",headers:{"Content-Type":"application/xml"}});case 8:t=e.sent,E.current=t;case 10:I({type:n.file_type,content:j.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:m,children:[(0,Z.jsx)(h.qE,{title:c.title,onClick:function(){return k.history.push("/".concat(w.AS,"/").concat(S.virtual_spacesId,"/plan?leftMenuId=").concat(window.localStorage.getItem("vtrsModuleId")))},children:(0,Z.jsxs)("div",{className:_,children:[(0,y.bg)()&&(0,Z.jsx)("div",{onClick:function(){var e;(0,w.Nd)("","".concat(j.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"}),"下载"]})}),(R=null==c?void 0:c.user_id,((0,y.Ny)()||(null==O?void 0:O.is_creator)||(null==O?void 0:O.is_member)&&(null==O?void 0:O.user_id)===R)&&(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()(o()().mark((function e(){var n;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,x.ZP)("/api/attachments/".concat(P,".json"),{method:"delete"});case 2:0===(null==(n=e.sent)?void 0:n.status)&&(k.history.push("/".concat(w.AS,"/").concat(S.virtual_spacesId,"/plan?leftMenuId=").concat(window.localStorage.getItem("vtrsModuleId"))),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:v,children:(0,Z.jsx)(g.Z,{data:null==N?void 0:N.content,type:null==N?void 0:N.type,disabledDownload:!(0,y.bg)(),style:{position:"absolute",zIndex:1,alignItems:"flex-start"},monacoEditor:{value:E.current,language:"txt",onChange:function(){},options:{readOnly:!0,fontSize:14,minimap:{enabled:!1}}},onClose:function(){return I({content:"",type:""})}})})]})}))},14661: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"}}}]);