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

1 line
9.2 KiB

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[87058],{7406:function(e,n,t){var o=t(82242),i=t.n(o),c=(t(59301),t(93314)),s=t(3113),a=t(37712);n.Z=function(e){var n=e.img,t=e.buttonProps,o=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,a.jsxs)("section",{className:"tc animated fadeIn",style:i()(i()({},{color:"#999",margin:"100px auto",visibility:v?"hidden":"visible"}),r),children:[(0,a.jsx)("img",{src:n||c,style:i()(i()({},m),{},{pointerEvents:"none",userSelect:"none"})}),(0,a.jsx)("p",{className:"mt20 font14",children:d||"暂时还没有相关数据哦!"}),u&&(0,a.jsx)(s.ZP,i()(i()({className:f,onClick:p},o),{},{children:u})),x&&x]})}},84143:function(e,n,t){t.d(n,{Z:function(){return y}});var o=t(82242),i=t.n(o),c=t(7557),s=t.n(c),a=t(41498),l=t.n(a),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),j=t(27065),g=t(6288),w=t(37712),y=function(e){var n,t,o,c,a,r,y=e.editOffice,k=void 0===y?"view":y,Z=e.data,C=(e.theme,e.type),I=e.filename,N=e.monacoEditor,P=e.className,S=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]),J=(0,u.useState)(),U=d()(J,2),X=U[0],D=U[1],H="build"===window.ENV?"/react/build":"",L=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);I&&(N.filename=I),(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?D({url:Z,fileType:(e=Z,e.substring(e.lastIndexOf("/")+1).split(".").pop()),model:Z.indexOf("model=edit")?"edit":"view"}):G())}),[C,Z]);var G=function(){var e=l()(s()().mark((function e(){var n,t,o;return s()().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:(o=e.sent).url=L+o.url,D(o);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)(I||"educoder",Z,I)},Q=function(){z&&(0,g.fc)({id:null==z?void 0:z.id,watch_type:1,course_id:null==z?void 0:z.course_id}),(0,v.Nd)(I||"educoder",decodeURIComponent(Z))};return(0,w.jsxs)("div",{style:i()({},S||{}),className:"".concat(R&&p.bgBlack," ").concat(C?p.wrp:"hide"),children:[E&&(0,w.jsxs)("div",{className:p.close,ref:Y,children:[!!B&&(0,w.jsx)(_.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return Y.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 Y.current},children:(0,w.jsx)("span",{onClick:Q,children:(0,w.jsx)("i",{className:"icon-quxiaozhiding"})})}),(0,w.jsx)(_.Z,{title:"关闭",getPopupContainer:function(){return Y.current},children:(0,w.jsx)("span",{className:"",onClick:O,children:(0,w.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,w.jsx)("div",{className:"".concat(p[P]," ").concat(P," ").concat(p.monaco," ").concat("txt"===C?"show":"hide"),children:"txt"===C&&(0,w.jsx)(w.Fragment,{children:(0,w.jsx)(m.ZP,i()({},N))})}),"audio"===C&&(0,w.jsx)("audio",{src:"".concat((null===(t=Z)||void 0===t?void 0:t.indexOf("http://"))>-1||(null===(o=Z)||void 0===o?void 0:o.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&&X&&(0,w.jsx)("iframe",{src:"".concat(H,"/office.html?key=").concat(X.key,"&url=").concat(btoa(X.url),"&callbackUrl=").concat(L+X.callbackUrl,"&fileType=").concat(X.fileType,"&title=").concat(X.title,"&model=").concat(k,"&officeServer=").concat(j.Z.ONLYOFFICE,"&disabledDownload=").concat(!!V)}),"html"===C&&(0,w.jsx)("iframe",{src:Z+"&disposition=inline"}),"pdf"===C&&(0,w.jsx)("iframe",{src:"".concat(H,"/js/pdfview/index.html?url=").concat(Z,"&disabledDownload=").concat(!!V)}),"image"===C&&(0,w.jsx)("img",{src:"".concat((null===(a=Z)||void 0===a?void 0:a.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,{}),"点击下载"]})})]})}},969:function(e,n,t){t.r(n),t.d(n,{default:function(){return N}});var o=t(7557),i=t.n(o),c=t(82242),s=t.n(c),a=t(41498),l=t.n(a),r=t(79800),d=t.n(r),u=t(70236),p=t.n(u),f=t(59301),x=t(43418),m=t(8591),_=t(51136),v="wrap___o2NPa",h="btns___cXvqH",b="content___f5hCX",j=t(90963),g=t(14661),w=t(84143),y=t(27065),k=t(6457),Z=t(7880),C=t(89918),I=t(37712),N=function(e){p()(e);var n=(0,Z.useSearchParams)(),t=(d()(n,1)[0],(0,f.useState)({})),o=d()(t,2),c=o[0],a=o[1],r=(0,f.useState)({content:"",type:""}),u=d()(r,2),N=u[0],P=u[1],S=(0,Z.useParams)(),E=S.id,O=S.virtual_spacesId,R=(0,f.useRef)();(0,f.useEffect)((function(){E&&V()}),[E]);var V=function(){var e=l()(i()().mark((function e(){var n,t;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,_.ZP)("/api/virtual_classrooms/".concat(O,"/files/").concat(E,"/file_detail.json"),{method:"get"});case 2:if(-1===(null==(n=e.sent)?void 0:n.status)){e.next=11;break}if(a(s()({},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,R.current=t;case 10:P({type:n.file_type,content:y.Z.API_SERVER+n.url});case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,I.jsxs)("div",{className:v,children:[(0,I.jsx)(j.qE,{title:c.title,onClick:function(){return Z.history.push("/".concat(k.AS,"/").concat(S.virtual_spacesId,"/survey?leftMenuId=").concat(window.localStorage.getItem("vtrsModuleId")))},children:(0,I.jsxs)("div",{className:h,children:[(0,C.bg)()&&(0,I.jsx)("div",{onClick:function(){var e;(0,k.Nd)("","".concat(y.Z.API_SERVER).concat(null===(e=c.url)||void 0===e?void 0:e.replace("disposition=inline","")))},children:(0,I.jsxs)("span",{className:"primary-hover",children:[(0,I.jsx)("i",{className:"iconfont icon-xiazai4 font14 mr5"}),"下载"]})}),(null==c?void 0:c.can_delete)&&(0,I.jsx)("div",{onClick:function(){var e;x.Z.confirm({title:"提示",okText:"确定删除",okButtonProps:{danger:!0},icon:!1,className:g.Z.CustomTipsModalCss,cancelText:"取消",content:(0,I.jsxs)("div",{children:[(0,I.jsxs)("div",{children:["确认删除《",c.title,"》吗?"]}),(0,I.jsx)("div",{className:"mt10",children:"删除后,将无法恢复,请谨慎操作"})]}),onOk:(e=l()(i()().mark((function e(){var n;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,_.ZP)("/api/virtual_classrooms/".concat(S.virtual_spacesId,"/files/").concat(E,".json"),{method:"delete",body:{is_outer_chain:0}});case 2:0===(null==(n=e.sent)?void 0:n.status)&&(Z.history.push("/".concat(k.AS,"/").concat(S.virtual_spacesId,"/survey?leftMenuId=").concat(window.localStorage.getItem("vtrsModuleId"))),m.ZP.success("删除成功"));case 4:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)})})},children:(0,I.jsxs)("span",{className:"delete-hover",children:[" ",(0,I.jsx)("i",{className:"iconfont icon-piliangshanchubeifen font14 mr5"}),"删除"]})})]})}),(0,I.jsx)("div",{className:b,children:(0,I.jsx)(w.Z,{data:null==N?void 0:N.content,disabledDownload:!(0,C.bg)(),type:null==N?void 0:N.type,style:{position:"absolute",zIndex:1,alignItems:"flex-start"},monacoEditor:{value:R.current,language:"txt",onChange:function(){},options:{readOnly:!0,fontSize:14,minimap:{enabled:!1}}},onClose:function(){return P({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"}}}]);