|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[85142],{36579:function(e,t,n){n.d(t,{Z:function(){return k}});var a=n(42122),i=n.n(a),c=n(17061),s=n.n(c),o=n(17156),r=n.n(o),l=n(27424),u=n.n(l),d=n(67294),p={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},f=n(71577),h=n(77171),m=n(8691),v=n(83062),x=n(29427),g=n(51412),j=n(82982),b=n(59758),y=n(85893),k=function(e){var t,n,a,c,o,l,k,S=e.editOffice,w=void 0===S?"view":S,_=e.data,C=(e.theme,e.type),Z=e.filename,P=e.monacoEditor,N=e.className,E=e.style,R=e.close,F=e.onClose,I=e.hasMask,T=e.disabledDownload,B=e.onImgDimensions,O=e.showNodata,D=(0,d.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),V=u()(D,2),L=(V[0],V[1],(0,d.useState)("")),W=u()(L,2),A=(W[0],W[1]),J=(0,d.useState)(),z=u()(J,2),M=z[0],U=z[1],q="build"===window.ENV?"/react/build":"",X=location.host.startsWith("localhost")?b.Z.PROXY_SERVER:b.Z.API_SERVER,Y=(0,d.useRef)();null!==(t=_)&&void 0!==t&&t.startsWith("/api")&&"txt"!==C&&(_=b.Z.API_SERVER+_),Z&&(P.filename=Z),(0,d.useEffect)((function(){var e,t,n=null===(e=document.cookie)||void 0===e||null===(t=e.replace(/\s/g,""))||void 0===t?void 0:t.split(";");null==n||n.map((function(e){var t=e.split("=");"_educoder_session"===t[0]&&A(t[1])}))}),[]),(0,d.useEffect)((function(){"office"===C&&G()}),[C,_]);var G=function(){var e=r()(s()().mark((function e(){var t,n,a;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=_,_.startsWith("http")||(t=location.origin+t),n=new URL(t).pathname.split("/").pop(),e.next=5,(0,g.gJ)({attachment_id:n});case 5:a=e.sent,U(a);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),H=function(){K()},K=function(){(0,x.Nd)(Z||"educoder",decodeURIComponent(_))};return(0,y.jsxs)("div",{style:i()({},E||{}),className:"".concat(I&&p.bgBlack," ").concat(C?p.wrp:"hide"),children:[R&&(0,y.jsxs)("div",{className:p.close,ref:Y,children:[!!B&&(0,y.jsx)(v.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return Y.current},children:(0,y.jsx)("span",{onClick:function(){F(),B()},children:(0,y.jsx)("i",{className:"icon-yulanpizhu"})})}),!T&&(0,y.jsx)(v.Z,{title:"点击下载此文件",getPopupContainer:function(){return Y.current},children:(0,y.jsx)("span",{onClick:K,children:(0,y.jsx)("i",{className:"icon-quxiaozhiding"})})}),(0,y.jsx)(v.Z,{title:"关闭",getPopupContainer:function(){return Y.current},children:(0,y.jsx)("span",{className:"",onClick:F,children:(0,y.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,y.jsx)("div",{className:"".concat(p[N]," ").concat(N," ").concat(p.monaco," ").concat("txt"===C?"show":"hide"),children:"txt"===C&&(0,y.jsx)(m.ZP,i()({},P))}),"audio"===C&&(0,y.jsx)("audio",{src:(null===(n=_)||void 0===n?void 0:n.indexOf("http"))>-1||null!==(a=_)&&void 0!==a&&a.startsWith("/api")?_:"data:image/png;base64,".concat(_),autoPlay:!0}),"video"===C&&(0,y.jsx)(y.Fragment,{children:(null===(c=_)||void 0===c?void 0:c.indexOf("http"))>-1||null!==(o=_)&&void 0!==o&&o.startsWith("/api")?(0,y.jsx)("video",{controls:!0,src:"".concat(_),autoPlay:!0}):(0,y.jsx)("video",{controls:!0,src:"data:video/mp4;base64,".concat(_),autoPlay:!0})}),"office"===C&&M&&(0,y.jsx)("iframe",{src:"".concat(q,"/office.html?key=").concat(M.key,"&url=").concat(X+M.url,"&callbackUrl=").concat(X+M.callbackUrl,"&fileType=").concat(M.fileType,"&title=").concat(M.title,"&model=").concat(w,"&officeServer=").concat(b.Z.ONLYOFFICE,"&disabledDownload=").concat(!!T)}),"html"===C&&(0,y.jsx)("iframe",{src:_+"&disposition=inline"}),"pdf"===C&&(0,y.jsx)("iframe",{src:"".concat(q,"/js/pdfview/index.html?url=").concat(_,"&disabledDownload=").concat(!!T)}),"image"===C&&(0,y.jsx)("img",{src:(null===(l=_)||void 0===l?void 0:l.indexOf("http"))>-1||null!==(k=_)&&void 0!==k&&k.startsWith("/api")?_:"data:image/png;base64,".concat(_)}),("other"===C||"download"===C)&&(0,y.jsx)(y.Fragment,{children:O?(0,y.jsx)(j.Z,{customText:"当前文件不支持预览,可点击下载查看",ButtonTwo:(0,y.jsx)(f.ZP,{icon:(0,y.jsx)("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:H,children:"下载"})}):(0,y.jsxs)(f.ZP,{type:"primary",size:"middle",onClick:H,children:[(0,y.jsx)(h.Z,{}),"点击下载"]})})]})}},97501:function(e,t,n){n.d(t,{h:function(){return x}});var a=n(42122),i=n.n(a),c=n(27424),s=n.n(c),o=n(67294),r=n(96101),l=n(91773),u=n(71577),d=n(4631),p=n.n(d),f=(n(71749),n(30483),n(85893)),h=r.Z.Option,m={labelCol:{span:4},wrapperCol:{span:20}},v={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};function x(e){var t=e.value,n=e.onChange,a=e.mode,c=e.options,r=void 0===c?{}:c,l=(0,o.useRef)(),u=(0,o.useState)(),d=s()(u,2),h=d[0],m=d[1];return(0,o.useEffect)((function(){if(h){var e=function(e){var t=e.getValue();n&&n(t)};return h.on("change",e),function(){h.off("change",e)}}}),[h,n]),(0,o.useEffect)((function(){h&&h.setOption("mode",a)}),[h,a]),(0,o.useEffect)((function(){h&&(t===h.getValue()&&""!==t||setTimeout((function(){h.setValue(t||"")}),300))}),[h,t]),(0,o.useEffect)((function(){if(l.current&&!h){var e=p().fromTextArea(l.current,i()({mode:a,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},r));m(e)}}),[l.current,h]),(0,f.jsx)("div",{className:"my-codemirror-container",children:(0,f.jsx)("textarea",{ref:l})})}t.Z=function(e){var t=e.callback,n=e.onCancel,a=(0,o.useState)("python"),c=s()(a,2),d=c[0],p=c[1];return(0,f.jsxs)(l.Z,i()(i()({},m),{},{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:function(e){t(e)},children:[(0,f.jsx)(l.Z.Item,{label:"代码语言",name:"language",children:(0,f.jsx)(r.Z,{getPopupContainer:function(e){return e.parentNode},onChange:function(e){p(v[e][1])},children:Object.keys(v).map((function(e){return(0,f.jsx)(h,{value:e,children:v[e][0]},e)}))})}),(0,f.jsx)(l.Z.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}],children:(0,f.jsx)(x,{mode:d})}),(0,f.jsxs)("div",{className:"flex-container flex-end",children:[(0,f.jsx)(u.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,f.jsx)(u.ZP,{type:"ghost",onClick:n,children:"取消"})]})]}))}},39026:function(e,t,n){n.d(t,{Z:function(){return k}});var a=n(42122),i=n.n(a),c=n(17061),s=n.n(c),o=n(17156),r=n.n(o),l=n(27424),u=n.n(l),d=n(67294),p=n(88275),f=n(91773),h=n(2453),m=n(14446),v=n(11486),x="wrap___TwY3U",g="content___Ks95W",j="mainPathWrap___CrMaa",b="colorBlue___dvWbP",y=n(85893),k=(0,p.connect)((function(e){var t=e.shixunsDetail,n=e.loading;return{shixunsDetail:t,globalSetting:e.globalSetting,loading:n.models.index}}))((function(e){var t=e.shixunsDetail,n=(e.globalSetting,e.loading,e.dispatch),a=e.title,c=e.pathList,o=void 0===c?[]:c,l=e.showInputPath,k=void 0!==l&&l,S=e.isMergeSelectFile,w=void 0!==S&&S,_=e.onFinish,C=void 0===_?function(){}:_,Z=f.Z.useForm(),P=u()(Z,1)[0],N=(0,p.useParams)(),E=(0,p.useLocation)(),R=(0,d.useRef)(),F=(0,d.useState)(""),I=u()(F,2),T=I[0],B=I[1],O=(0,d.useState)(""),D=u()(O,2),V=D[0],L=D[1],W=(0,d.useState)([]),A=u()(W,2),J=A[0],z=A[1],M=(0,d.useState)([]),U=u()(M,2),q=U[0],X=U[1];(0,d.useEffect)((function(){var e,t;R.current="repository"===(null===(e=E.pathname)||void 0===e||null===(t=e.split("/"))||void 0===t?void 0:t[3])}),[]),(0,d.useEffect)((function(){if("Repository-SelectFilePath"===t.actionTabs.key){var e=o.join("/"),n=[];o.map((function(t,a){0===a?n.push({val:"根目录",path:""},{val:"/".concat(t),path:e}):n.push({val:"/".concat(t),path:e})})),z(n),B(e),L(e),Y(e)}}),[t.actionTabs.key]);var Y=function(){var e=r()(s()().mark((function e(t){var a;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n({type:R.current?"shixunsDetail/getRepository":"shixunsDetail/getSecretRepository",payload:{id:N.id,path:t}});case 2:(a=e.sent)&&X(a.trees||[]);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),G=function(){var e=r()(s()().mark((function e(){var t,a,c;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=null==P?void 0:P.getFieldsValue(),a=T?"".concat(T).concat(null!=t&&t.name?"/".concat(null==t?void 0:t.name):""):null==t?void 0:t.name,!w){e.next=6;break}return C(a),H(),e.abrupt("return");case 6:if(!k){e.next=16;break}return e.next=9,P.validateFields();case 9:return e.next=11,n({type:"shixunsDetail/uploadGitFolder",payload:i()(i()({},{id:N.id,path:a}),R.current?{}:{secret_repository:!0})});case 11:c=e.sent,C(V),0===c.status&&h.ZP.info("新建成功"),e.next=18;break;case 16:C(a),h.ZP.success("选择文件目录成功");case 18:H();case 19:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),H=function(){n({type:"shixunsDetail/setActionTabs",payload:{}}),P.resetFields()};return(0,y.jsx)(m.Z,{centered:!0,title:a||"新建文件夹",closable:!1,keyboard:!1,open:"Repository-SelectFilePath"===t.actionTabs.key,onOk:G,onCancel:H,children:(0,y.jsxs)("div",{className:x,children:[(0,y.jsxs)("div",{className:g,children:[(0,y.jsx)("div",{className:j,children:!(null==J||!J.length)&&J.map((function(e,t){return(0,y.jsx)("a",{onClick:function(){return function(e,t){var n=J.filter((function(e,n){return n<=t}));z(n);var a=n.filter((function(e,t){return 0!==t})).map((function(e){return e.val})).join("").substr(1);B(a),Y(a)}(0,t)},children:e.val},t)}))}),!(null==q||!q.length)&&q.map((function(e,t){return"tree"===e.type&&(0,y.jsxs)("a",{onClick:function(){return function(e){var t=T;"tree"===e.type&&(J.length?J.push({val:"/".concat(e.name),path:e.name}):J.push({val:"根目录",path:""},{val:"/".concat(e.name),path:e.name}),z(J),t=T?"".concat(T,"/").concat(e.name):e.name,B(t)),Y(t)}(e)},children:[(0,y.jsx)("i",{className:"iconfont icon-wenjianjia ".concat(b)}),e.name]},t)}))]}),(0,y.jsx)("label",{className:"mt5",children:"选中的新建文件夹目录:"}),(0,y.jsx)("div",{className:"mt5 mb5",children:T}),k&&(0,y.jsx)(f.Z,{form:P,scrollToFirstError:!0,className:"mt20",children:(0,y.jsx)(f.Z.Item,{name:"name",rules:[{required:!0,message:"请输入名称"},{whitespace:!0,message:"请勿输入空格"}],children:(0,y.jsx)(v.Z,{placeholder:"请输入新文件夹名/子文件夹名。(如:src/step1)"})})})]})})}))}}]); |