2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
import{S as StarOutlined,p as SettingOutlined,C as CarryOutOutlined,q as FileTextOutlined,s as DashboardOutlined,I as InfoCircleOutlined,r as resolveComponent,o as openBlock,b as createElementBlock,F as Fragment,c as createBlock,w as withCtx,k as createCommentVNode,e as createBaseVNode,t as toDisplayString,d as renderList,a as createVNode,u as useStore,v as useRoute,x as useRouter,y as ref,B as message,E as nextTick,m as createTextVNode,H as onMounted,J as withDirectives,L as vShow,M as BarChartOutlined,N as MenuFoldOutlined,O as MenuUnfoldOutlined,Q as pushScopeId,R as popScopeId}from"./vendor.948fa90f.js";import{_ as _export_sfc}from"./main.92a9e84b.js";import{z as zyplayerApi}from"./custom.6a6c45c1.js";import{a as analysisSwaggerData,g as getTreeDataForTag,b as analysisOpenApiData,c as getTreeDataForTag$1,L as LeftResize,_ as _imports_0}from"./api-logo.828bc7b1.js";const _sfc_main$4={name:"MenuLayoutChildren",props:{menuItem:Object},data(){return{}},components:{StarOutlined,SettingOutlined,CarryOutOutlined,FileTextOutlined,DashboardOutlined,InfoCircleOutlined},methods:{haveShowChildren(n){return n.filter(o=>!o.meta||!o.meta.hidden).length>0}}};function _sfc_render$4(n,o,t,a,l,d){const r=resolveComponent("SettingOutlined"),m=resolveComponent("FileTextOutlined"),p=resolveComponent("MenuLayoutChildren"),i=resolveComponent("a-sub-menu"),s=resolveComponent("DashboardOutlined"),c=resolveComponent("InfoCircleOutlined"),_=resolveComponent("router-link"),u=resolveComponent("a-menu-item");return!t.menuItem.meta||!t.menuItem.meta.hidden?(openBlock(),createElementBlock(Fragment,{key:0},[t.menuItem.children?(openBlock(),createElementBlock(Fragment,{key:0},[d.haveShowChildren(t.menuItem.children)?(openBlock(),createBlock(i,{key:t.menuItem.path},{title:withCtx(()=>[t.menuItem.meta?(openBlock(),createElementBlock(Fragment,{key:0},[t.menuItem.meta.icon==="SettingOutlined"?(openBlock(),createBlock(r,{key:0})):createCommentVNode("",!0),t.menuItem.meta.icon==="FileTextOutlined"?(openBlock(),createBlock(m,{key:1})):createCommentVNode("",!0)],64)):createCommentVNode("",!0),createBaseVNode("span",null,toDisplayString(t.menuItem.name),1)]),default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(t.menuItem.children,y=>(openBlock(),createBlock(p,{menuItem:y},null,8,["menuItem"]))),256))]),_:1})):createCommentVNode("",!0)],64)):(openBlock(),createBlock(u,{key:t.menuItem.path},{default:withCtx(()=>[createVNode(_,{to:{path:t.menuItem.path,query:t.menuItem.query}},{default:withCtx(()=>[t.menuItem.meta?(openBlock(),createElementBlock(Fragment,{key:0},[t.menuItem.meta.icon==="DashboardOutlined"?(openBlock(),createBlock(s,{key:0})):createCommentVNode("",!0),t.menuItem.meta.icon==="FileTextOutlined"?(openBlock(),createBlock(m,{key:1})):createCommentVNode("",!0),t.menuItem.meta.icon==="InfoCircleOutlined"?(openBlock(),createBlock(c,{key:2})):createCommentVNode("",!0)],64)):createCommentVNode("",!0),createBaseVNode("span",null,toDisplayString(t.menuItem.name),1)]),_:1},8,["to"])]),_:1}))],64)):createCommentVNode("",!0)}var MenuChildrenLayout=_export_sfc(_sfc_main$4,[["render",_sfc_render$4]]),Swagger_vue_vue_type_style_index_0_lang="";const _sfc_main$3={setup(){const store=useStore();useRoute();const router=useRouter();let tagPathMap=ref({}),swaggerDoc=ref({}),treeData=ref([]),expandedKeys=ref([]),choiceDocId=ref("");const docChecked=(n,o)=>{if(o.node.isLeaf){let t=o.node.dataRef;router.push({path:"/share/swagger/view",query:t.query})}},loadDoc=(n,o,t)=>{choiceDocId.value=n,zyplayerApi.apiShareDocApisDetail({shareUuid:n}).then(a=>{let l=toJsonObj(a.data);if(typeof l!="object"||!l.swagger){t(!1),message.error("\u83B7\u53D6\u6587\u6863\u6570\u636E\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6587\u6863\u662F\u5426\u4E3A\u6807\u51C6\u7684Swagger\u6587\u6863\u683C\u5F0F");return}swaggerDoc.value=l,store.commit("setSwaggerDoc",l);let d=analysisSwaggerData(l);store.commit("setSwaggerUrlMethodMap",d.urlMethodMap),store.commit("setSwaggerMethodStatistic",d.methodStatistic),tagPathMap.value=d.tagPathMap,loadTreeData(o),t(!0)}).catch(()=>{t(!1)})},loadTreeData=async n=>{let o={uuid:choiceDocId.value};treeData.value=getTreeDataForTag(swaggerDoc.value,tagPathMap.value,n,o),await nextTick(),expandedKeys.value=["main"]},toJsonObj=value=>{if(typeof value!="string")return value;try{return JSON.parse(value)}catch(e){try{return eval("("+value+")")}catch(n){return value||void 0}}};return{expandedKeys,docChecked,loadDoc,loadTreeData,treeData}}},_hoisted_1$3=createTextVNode("get"),_hoisted_2$2=createTextVNode("post"),_hoisted_3$2=createTextVNode("put"),_hoisted_4$1=createTextVNode("head"),_hoisted_5$1=createTextVNode("patch"),_hoisted_6$1=createTextVNode("delete"),_hoisted_7$1=createTextVNode("options"),_hoisted_8$1=createTextVNode("trace"),_hoisted_9$1={style:{margin:"0 6px 0 3px"}};function _sfc_render$3(n,o,t,a,l,d){const r=resolveComponent("a-tag"),m=resolveComponent("a-badge"),p=resolveComponent("a-directory-tree");return openBlock(),createBlock(p,{showIcon:!1,"tree-data":a.treeData,expandedKeys:a.expandedKeys,"onUpdate:expandedKeys":o[0]||(o[0]=i=>a.expandedKeys=i),onSelect:a.docChecked},{title:withCtx(({title:i,isLeaf:s,method:c,children:_,key:u})=>[s?(openBlock(),createElementBlock(Fragment,{key:0},[c==="get"?(openBlock(),createBlock(r,{key:0,color:"pink"},{default:withCtx(()=>[_hoisted_1$3]),_:1})):c==="post"?(openBlock(),createBlock(r,{key:1,color:"red"},{default:withCtx(()=>[_hoisted_2$2]),_:1})):c==="put"?(openBlock(),createBlock(r,{key:2,color:"orange"},{default:withCtx(()=>[_hoisted_3$2]),_:1})):c==="head"?(openBlock(),createBlock(r,{key:3,color:"green"},{default:withCtx(()=>[_hoisted_4$1]),_:1})):c==="patch"?(openBlock(),createBlock(r,{key:4,color:"cyan"},{default:withCtx(()=>[_hoisted_5$1]),_:1})):c==="delete"?(openBlock(),createBlock(r,{key:5,color:"blue"},{default:withCtx(()=>[_hoisted_6$1]),_:1})):c==="options"?(openBlock(),createBlock(r,{key:6,color:"purple"},{default:withCtx(()=>[_hoisted_7$1]),_:1})):c==="trace"?(openBlock(),createBlock(r,{key:7,color:"purple"},{default:withCtx(()=>[_hoisted_8$1]),_:1})):createCommentVNode("",!0)],64)):createCommentVNode("",!0),createBaseVNode("span",_hoisted_9$1,toDisplayString(i),1),_?(openBlock(),createBlock(m,{key:1,count:_.length,"number-style":{backgroundColor:"#fff",color:"#999",boxShadow:"0 0 0 1px #d9d9d9 inset"}},null,8,["count"])):createCommentVNode("",!0)]),_:1},8,["tree-data","expandedKeys","onSelect"])}var DocTreeSwagger=_export_sfc(_sfc_main$3,[["render",_sfc_render$3]]),OpenApi_vue_vue_type_style_index_0_lang="";const _sfc_main$2={setup(){const store=useStore();useRoute();const router=useRouter();let tagPathMap=ref({}),openApiDoc=ref({}),treeData=ref([]),expandedKeys=ref([]),choiceDocId=ref("");const docChecked=(n,o)=>{if(o.node.isLeaf){let t=o.node.dataRef;router.push({path:"/share/openapi/view",query:t.query})}},loadDoc=(n,o,t)=>{choiceDocId.value=n,zyplayerApi.apiShareDocApisDetail({shareUuid:n}).then(a=>{let l=toJsonObj(a.data);if(typeof l!="object"||!l.openapi){t(!1),message.error("\u83B7\u53D6\u6587\u6863\u6570\u636E\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6587\u6863\u662F\u5426\u4E3A\u6807\u51C6\u7684OpenApi\u6587\u6863\u683C\u5F0F");return}openApiDoc.value=l,store.commit("setOpenApiDoc",l);let d=analysisOpenApiData(l);store.commit("setOpenApiUrlMethodMap",d.urlMethodMap),store.commit("setOpenApiMethodStatistic",d.methodStatistic),tagPathMap.value=d.tagPathMap,loadTreeData(o),t(!0)}).catch(()=>{t(!1)})},loadTreeData=async n=>{let o={uuid:choiceDocId.value};treeData.value=getTreeDataForTag$1(openApiDoc.value,tagPathMap.value,n,o),await nextTick(),expandedKeys.value=["main"]},toJsonObj=value=>{if(typeof value!="string")return value;try{return JSON.parse(value)}catch(e){try{return eval("("+value+")")}catch(n){return value||void 0}}};return{expandedKeys,docChecked,loadDoc,loadTreeData,treeData}}},_hoisted_1$2=createTextVNode("get"),_hoisted_2$1=createTextVNode("post"),_hoisted_3$1=createTextVNode("put"),_hoisted_4=createTextVNode("head"),_hoisted_5=createTextVNode("patch"),_hoisted_6=createTextVNode("delete"),_hoisted_7=createTextVNode("options"),_hoisted_8=createTextVNode("trace"),_hoisted_9={style:{margin:"0 6px 0 3px"}};function _sfc_render$2(n,o,t,a,l,d){const r=resolveComponent("a-tag"),m=resolveComponent("a-badge"),p=resolveComponent("a-directory-tree");return openBlock(),createBlock(p,{showIcon:!1,"tree-data":a.treeData,expandedKeys:a.expandedKeys,"onUpdate:expandedKeys":o[0]||(o[0]=i=>a.expandedKeys=i),onSelect:a.docChecked},{title:withCtx(({title:i,isLeaf:s,method:c,children:_,key:u})=>[s?(openBlock(),createElementBlock(Fragment,{key:0},[c==="get"?(openBlock(),createBlock(r,{key:0,color:"pink"},{default:withCtx(()=>[_hoisted_1$2]),_:1})):c==="post"?(openBlock(),createBlock(r,{key:1,color:"red"},{default:withCtx(()=>[_hoisted_2$1]),_:1})):c==="put"?(openBlock(),createBlock(r,{key:2,color:"orange"},{default:withCtx(()=>[_hoisted_3$1]),_:1})):c==="head"?(openBlock(),createBlock(r,{key:3,color:"green"},{default:withCtx(()=>[_hoisted_4]),_:1})):c==="patch"?(openBlock(),createBlock(r,{key:4,color:"cyan"},{default:withCtx(()=>[_hoisted_5]),_:1})):c==="delete"?(openBlock(),createBlock(r,{key:5,color:"blue"},{default:withCtx(()=>[_hoisted_6]),_:1})):c==="options"?(openBlock(),createBlock(r,{key:6,color:"purple"},{default:withCtx(()=>[_hoisted_7]),_:1})):c==="trace"?(openBlock(),createBlock(r,{key:7,color:"purple"},{default:withCtx(()=>[_hoisted_8]),_:1})):createCommentVNode("",!0)],64)):createCommentVNode("",!0),createBaseVNode("span",_hoisted_9,toDisplayString(i),1),_?(openBlock(),createBlock(m,{key:1,count:_.length,"number-style":{backgroundColor:"#fff",color:"#999",boxShadow:"0 0 0 1px #d9d9d9 inset"}},null,8,["count"])):createCommentVNode("",!0)]),_:1},8,["tree-data","expandedKeys","onSelect"])}var DocTreeOpenApi=_export_sfc(_sfc_main$2,[["render",_sfc_render$2]]),MenuLayout_vue_vue_type_style_index_0_lang="";const _sfc_main$1={props:{collapsed:{type:Boolean,default:!1}},components:{MenuChildrenLayout,DocTreeSwagger,DocTreeOpenApi},setup(n){const o=useStore(),t=useRoute();useRouter();let a=ref([]),l=ref([]),d=ref([]),r=ref(!1),m=ref([]),p=ref(),i=ref(""),s=ref({});const c=()=>{zyplayerApi.apiShareDocDetail({shareUuid:p.value}).then(h=>{s.value=h.data||{},o.commit("setApiDoc",s.value),y()})};let _=ref(),u=ref();const y=async()=>{r.value=!0,await nextTick();const h=()=>{r.value=!1};s.value.docType===1||s.value.docType===2?_.value&&_.value.loadDoc(p.value,i.value,h):(s.value.docType===3||s.value.docType===4)&&u.value&&u.value.loadDoc(p.value,i.value,h)},v=()=>{s.value.docType===1||s.value.docType===2?_.value&&_.value.loadTreeData(i.value):(s.value.docType===3||s.value.docType===4)&&u.value&&u.value.loadTreeData(i.value)};return onMounted(()=>{if(p.value=t.query.uuid,!p.value){message.error("\u8BBF\u95EE\u7684\u5F00\u653E\u6587\u6863\u53C2\u6570\u9519\u8BEF");return}a.value=[{path:"/share/home",name:"\u5F00\u653E\u6587\u6863\u4F7F\u7528\u8BF4\u660E",meta:{icon:"FileTextOutlined"},query:{uuid:p.value}}];let h=t.meta||{},f=t.path;h.parentPath&&(f=h.parentPath),l.value=[f];let k=t.matched;k.length>=1&&(d.value=[k[1].path]),c()}),{menuData:a,selectedKeys:l,openKeys:d,treeDataLoading:r,docResourceList:m,docChoiceId:p,searchKeywords:i,swaggerRef:_,openApiRef:u,docChoice:s,docSearch:v}}},_hoisted_1$1={class:"menu-layout"},_hoisted_2={class:"doc-tree"},_hoisted_3={style:{"margin-bottom":"10px"}};function _sfc_render$1(n,o,t,a,l,d){const r=resolveComponent("menu-children-layout"),m=resolveComponent("a-menu"),p=resolveComponent("a-divider"),i=resolveComponent("a-input-search"),s=resolveComponent("DocTreeSwagger"),c=resolveComponent("DocTreeOpenApi"),_=resolveComponent("a-spin");return openBlock(),createElementBlock("div",_hoisted_1$1,[createVNode(m,{theme:"light",mode:"inline","inline-collapsed":!1,openKeys:a.openKeys,"onUpdate:openKeys":o[0]||(o[0]=u=>a.openKeys=u),selectedKeys:a.selectedKeys,"onUpdate:selectedKeys":o[1]||(o[1]=u=>a.selectedKeys=u)},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(a.menuData,u=>(openBlock(),createBlock(r,{menuItem:u},null,8,["menuItem"]))),256))]),_:1},8,["openKeys","selectedKeys"]),createVNode(p,{style:{margin:"6px 0"}}),withDirectives(createBaseVNode("div",_hoisted_2,[createVNode(_,{tip:"\u52A0\u8F7D\u4E2D...",spinning:a.treeDataLoading},{default:withCtx(()=>[createBaseVNode("div",_hoisted_3,[createVNode(i,{value:a.searchKeywords,"onUpdate:value":o[2]||(o[2]=u=>a.searchKeywords=u),placeholder:"\u641C\u7D22\u6587\u6863\u5185\u5BB9",style:{width:"100%","margin-top":"10px"},onSearch:a.docSearch},null,8,["value","onSearch"])]),a.docChoice&&a.docChoice.docType?(openBlock(),createElementBlock(Fragment,{key:0},[a.docChoice.docType===1||a.docChoice.docType===2?(openBlock(),createBlock(s,{key:0,ref:"swaggerRef"},null,512)):createCommentVNode("",!0),a.docChoice.docType===3||a.docChoice.docType===4?(openBlock(),createBlock(c,{key:1,ref:"openApiRef"},null,512)):createCommentVNode("",!0)],64)):createCommentVNode("",!0)]),_:1},8,["spinning"])],512),[[vShow,!t.collapsed]])])}var MenuLayout=_export_sfc(_sfc_main$1,[["render",_sfc_render$1]]),GlobalLayout_vue_vue_type_style_index_0_scoped_true_lang="";const minHeight=window.innerHeight-64-122,_sfc_main={components:{MenuLayout,LeftResize,BarChartOutlined,MenuFoldOutlined,MenuUnfoldOutlined},data(){return{minHeight:minHeight+"px",appMenuCollapsed:!1,leftAsideWidth:300}},computed:{},mounted(){},methods:{turnLeftCollapse(){this.appMenuCollapsed=!this.appMenuCollapsed,setTimeout(()=>{this.appMenuCollapsed?this.leftAsideWidthChange(this.leftAsideWidth+1):this.leftAsideWidthChange(1)},100)},leftAsideWidthChange(n){this.$store.commit("setLeftAsideWidth",n)}}},_withScopeId=n=>(pushScopeId("data-v-7eee487f"),n=n(),popScopeId(),n),_hoisted_1=_withScopeId(()=>createBaseVNode("div",{class:"header-border logo"},[createBaseVNode("img",{src:_imports_0}),createBaseVNode("h1",null,"API\u5F00\u653E\u6587\u6863")],-1));function _sfc_render(n,o,t,a,l,d){const r=resolveComponent("menu-layout"),m=resolveComponent("a-layout-sider"),p=resolveComponent("LeftResize"),i=resolveComponent("MenuUnfoldOutlined"),s=resolveComponent("MenuFoldOutlined"),c=resolveComponent("a-col"),_=resolveComponent("a-row"),u=resolveComponent("a-layout-header"),y=resolveComponent("router-view"),v=resolveComponent("a-layout-content"),h=resolveComponent("a-layout");return openBlock(),createBlock(h,{class:"api-menu-trigger"},{default:withCtx(()=>[createVNode(m,{theme:"light",trigger:null,collapsible:"",collapsed:l.appMenuCollapsed,"onUpdate:collapsed":o[0]||(o[0]=f=>l.appMenuCollapsed=f),width:l.leftAsideWidth,style:{height:"100vh",overflow:"auto"}},{default:withCtx(()=>[_hoisted_1,createVNode(r,{collapsed:l.appMenuCollapsed},null,8,["collapsed"])]),_:1},8,["collapsed","width"]),withDirectives(createVNode(p,{value:l.leftAsideWidth,"onUpdate:value":o[1]||(o[1]=f=>l.leftAsideWidth=f),onChange:d.leftAsideWidthChange},null,8,["value","onChange"]),[[vShow,!l.appMenuCollapsed]]),createVNode(h,null,{default:withCtx(()=>[createVNode(u,{class:"header-border"},{default:withCtx(()=>[createVNode(_,{type:"flex"},{default:withCtx(()=>[createVNode(c,{flex:"auto"},{default:withCtx(()=>[l.appMenuCollapsed?(openBlock(),createBlock(i,{key:0,class:"trigger",onClick:d.turnLeftCollapse},null,8,["onClick"])):(openBlock(),createBlock(s,{key:1,class:"trigger",onClick:d.turnLeftCollapse},null,8,["onClick"]))]),_:1}),createVNode(c,{flex:"400px",style:{"text-align":"right","padding-right":"20px"}})]),_:1})]),_:1}),createVNode(v,{style:{height:"calc(100vh - 80px)",overflow:"auto",background:"#fff"}},{default:withCtx(()=>[createVNode(y)]),_:1})]),_:1})]),_:1})}var GlobalLayout=_export_sfc(_sfc_main,[["render",_sfc_render],["__scopeId","data-v-7eee487f"]]);export{GlobalLayout as default};
|