forked from Gitlink/forgeplus
1 line
9.2 KiB
JavaScript
1 line
9.2 KiB
JavaScript
(this.webpackJsonp=this.webpackJsonp||[]).push([[78],{"E+/Y":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenKey=t.httpUrl=void 0;var r=u(a("TeRw")),n=u(a("tsqr"));a("O+I2"),a("8/o9");var o=u(a("vDqi")),i=u(a("Po8q")),l=u(a("H5Q0"));function u(e){return e&&e.__esModule?e:{default:e}}var s="";window.location.href.indexOf("localhost")>-1?s="https://test-search.trustie.net":window.location.href.indexOf("testforgeplus")>-1?(s="https://test-search.trustie.net",o.default.defaults.withCredentials=!0):window.location.href.indexOf("forgeplus")>-1&&(s="https://wiki-api.trustie.net",o.default.defaults.withCredentials=!0);var c=t.httpUrl=s,d=t.TokenKey="autologin_trustie",f=o.default.create({baseURL:c,timeout:1e4});f.interceptors.request.use((function(e){if(i.default.load(d)&&(console.log(i.default.load(d)),e.headers.Authorization=i.default.load(d)),"3007"===window.location.port){var t=sessionStorage.taskToken;-1===e.url.indexOf("?")?e.url=e.url+"?token="+t:e.url=e.url+"&token="+t}return e}),(function(e){console.log(e)})),f.interceptors.response.use((function(e){var t=e||{};return 400===t.status?(n.default.error(t.data.message||"操作失败"),Promise.reject("error")):401===t.status?(n.default.error(t.data.message||"登录信息已过期"),Promise.reject("error")):403===t.status?(n.default.error(t.data.message||"无权限!"),Promise.reject("error")):40001===t.status?(r.default.open({message:"提示",description:"账户或密码错误!"}),Promise.reject("error")):200===e.status||200===t.status?e.data:void r.default.open({message:"提示",description:t.message})}),(function(e){console.log(e);var t=e.response||{};return 400===t.status?(n.default.error(t.data.message||"操作失败"),Promise.reject("error")):401===t.status?(n.default.error(t.data.message||"登录信息已过期"),(0,l.default)(),Promise.reject("error")):403===t.status?(n.default.error(t.data.message||"无权限!"),Promise.reject("error")):(r.default.open({message:"提示",description:e.message}),Promise.reject(e))})),t.default=f},FRFo:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=l(a("3S7+")),n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],r=!0,n=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(a.push(i.value),!t||a.length!==t);r=!0);}catch(e){n=!0,o=e}finally{try{!r&&l.return&&l.return()}finally{if(n)throw o}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};a("TfFZ");var o=a("q1tI"),i=l(o);function l(e){return e&&e.__esModule?e:{default:e}}function u(e){var t=e.beforeText,a=e.afterText,l=e.className,u=e.inputId,s=e.timeOut,c=(0,o.useState)((function(){return t})),d=n(c,2),f=d[0],m=d[1],p=(0,o.useCallback)((function(){var e=document.querySelector("#"+u);e?(e.select(),document.execCommand("copy")&&document.execCommand("copy"),document.getSelection().removeAllRanges(),m(a),s&&setTimeout((function(){m(t)}),1500)):console.error("您的CopyTool未设置正确的inputId")}),[]);return i.default.createElement(r.default,{placement:"top",title:f,onVisibleChange:function(){m(t)}},i.default.createElement("i",{className:"iconfont icon-fuzhiicon "+l,style:{color:"#466aff"},onClick:p}))}u.defaultProps={beforeText:"复制链接",afterText:"复制成功",className:"",inputId:"copyText",timeOut:!0},t.default=(0,o.memo)(u)},H5Q0:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],r=!0,n=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(a.push(i.value),!t||a.length!==t);r=!0);}catch(e){n=!0,o=e}finally{try{!r&&l.return&&l.return()}finally{if(n)throw o}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};t.default=function(e){var t=document.createElement("div");function a(){i.unmountComponentAtNode(t)&&t.parentNode&&t.parentNode.removeChild(t)}document.body.appendChild(t),setTimeout((function(){i.render(o.default.createElement(s,{afterClose:a}),t)}))};var n=a("q1tI"),o=u(n),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}(a("i8i4")),l=u(a("CWZq"));function u(e){return e&&e.__esModule?e:{default:e}}function s(e){var t=e.afterClose,a=(0,n.useState)(!0),i=r(a,2),u=i[0],s=i[1];return o.default.createElement(l.default,{isRender:u,Modifyloginvalue:function(){s(!1),t()}})}},"j/6D":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wikiPages=function(e){return(0,o.default)({url:"/api/wiki/wikiPages",method:"get",params:e})},t.getWiki=function(e){return(0,o.default)({url:"/api/wiki/getWiki",method:"get",params:e})},t.addWiki=function(e){return(0,o.default)({url:"/api/wiki/createWiki",method:"post",data:e})},t.updateWiki=function(e){return(0,o.default)({url:"/api/wiki/updateWiki",method:"PUT",data:e})},t.deleteWiki=function(e){return(0,o.default)({url:"/api/wiki/deleteWiki",method:"DELETE",data:e})};var r,n=a("E+/Y"),o=(r=n)&&r.__esModule?r:{default:r}},j29u:function(e,t,a){},oHRg:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=v(a("jsC+")),n=v(a("2/Rp")),o=v(a("CtXQ")),i=v(a("BvKs")),l=v(a("2fM7")),u=v(a("5rEg")),s=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var a=[],r=!0,n=!1,o=void 0;try{for(var i,l=e[Symbol.iterator]();!(r=(i=l.next()).done)&&(a.push(i.value),!t||a.length!==t);r=!0);}catch(e){n=!0,o=e}finally{try{!r&&l.return&&l.return()}finally{if(n)throw o}}return a}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};a("aIZi"),a("L/Qf"),a("2oDE"),a("2WkQ"),a("8QGh"),a("1vPl");var c=a("q1tI"),d=v(c),f=v(a("FRFo")),m=a("j/6D"),p=a("E+/Y");function v(e){return e&&e.__esModule?e:{default:e}}a("j29u");var w=u.default.Group,h=l.default.Option;t.default=function(e){var t=e.match,a=e.history,v=e.showNotification,k=e.project,y=e.projectDetail,E=y&&y.permission&&"Reporter"!==y.permission,g=t.params.projectsId,j=t.params.owner,_=t.params.projectName,N=t.params.projectId;console.log("projectName:"),console.log(_);var T=(0,c.useState)({}),b=s(T,2),P=b[0],S=b[1],C=(0,c.useState)({}),I=s(C,2),O=I[0],x=I[1],M=(0,c.useState)([]),H=s(M,2),W=H[0],q=H[1],A=(0,c.useState)("HTTPS"),R=s(A,2),D=R[0],U=R[1];(0,c.useEffect)((function(){g&&(0,m.wikiPages)({owner:j,repo:g,projectId:N}).then((function(e){e&&"200"===e.message?(q(e.data),e.data.length&&S(e.data[0])):v("加载失败")}))}),[k]),(0,c.useEffect)((function(){g&&P.name&&(0,m.getWiki)({owner:j,repo:g,pagename:P.name,projectId:N}).then((function(e){e&&"200"===e.message?x(e.data):v("加载失败")}))}),[k,P]);var F=d.default.createElement(i.default,null,d.default.createElement(i.default.Item,{key:"1",onClick:function(){Q("markdown")}},"Markdown"),d.default.createElement(i.default.Item,{key:"2",onClick:function(){Q("html")}},"HTML"),d.default.createElement(i.default.Item,{key:"3",onClick:function(){Q("pdf")}},"PDF"));function Q(e){window.open(p.httpUrl+"/api/wikiExport/wikiExport-wrapper?repoName="+g+"&owner="+j+"&type="+e+"&projectName="+_+"&projectId="+N)}return d.default.createElement("div",{className:"wiki-preview"},d.default.createElement("div",{className:"preview-head"},d.default.createElement("div",{className:"preview-head-left",onClick:function(){a.push("/"+j+"/"+g+"/wiki")}},d.default.createElement("i",{className:"iconfont icon-wendangyulan_icon mr3"}),d.default.createElement("span",{className:"ml10"},_)),d.default.createElement("div",{className:"preview-head-right"},d.default.createElement("span",{className:"copy-desc"},"克隆地址"),P.wiki_clone_link&&d.default.createElement(w,{className:"copy-url",compact:!0},d.default.createElement(l.default,{dropdownClassName:"wiki-url-type",defaultValue:"HTTPS",onChange:function(e){console.log(e),U(e)}},d.default.createElement(h,{value:"HTTPS"},"HTTPS"),d.default.createElement(h,{value:"SSH"},"SSH")),d.default.createElement(u.default,{id:"wikiUrl",value:"HTTPS"===D?P.wiki_clone_link.https:P.wiki_clone_link.ssh}),d.default.createElement(f.default,{className:"copy-wiki",inputId:"wikiUrl"})),d.default.createElement(r.default,{overlay:F},d.default.createElement(n.default,{className:"ml10"},"导出",d.default.createElement(o.default,{type:"caret-down"}))))),d.default.createElement("div",{className:"wiki-body"},d.default.createElement("div",{className:"wiki-nav"},W.map((function(e){return d.default.createElement("div",{className:(e.name===P.name?"active":"")+" wiki-nav-title",key:e.name,onClick:function(){S(e)}},d.default.createElement("span",{className:"nav-title-left"},d.default.createElement("i",{className:"iconfont icon-wenjianjia2 mr3"}),d.default.createElement("span",{className:"nav-title-left-text"},e.name)))}))),d.default.createElement("div",{className:"wiki-content"},d.default.createElement("div",{className:"wiki-content-head"},d.default.createElement("h3",null,P.name),E&&d.default.createElement(n.default,{type:"primary",onClick:function(){a.push("/"+j+"/"+g+"/wiki/edit/"+P.name)}},"编辑")),d.default.createElement("div",{className:"wiki-content-detail editor-content-panel markdown-body",dangerouslySetInnerHTML:{__html:O&&O.simple_content}}))))}}}]); |