2021-11-26 23:51:14 +08:00
|
|
|
import{B as te,r as b,T as be,o as m,c as R,w as r,a as l,m as u,t as L,H as U,e as O,b as w,F as q,k as D,X as me,Y as Se,y as c,E as we,Z as xe,_ as ke,u as ce,J as F,d as Le,v as Oe,G as Ie}from"./vendor.d3f949c4.js";import{m as Te}from"./index.ea6b273d.js";import{_ as X}from"./main.c59b3205.js";import{P as fe,a as ye,b as Re,u as Ce,x as De}from"./unitConvert.5da9e201.js";import{g as qe,z as Ne}from"./custom.914a01ae.js";var N={log(a,n,d){console.log(a+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+n,d)},logMessage(a,n,d){console.log(a+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+n,d),te.error(a+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+n)}};let oe=["file","string","integer","long","double","object","number","boolean","ref"];var he={getRequestParamList(a,n){if(!a)return[];let d=1,e=[];for(let h=0;h<a.length;h++){let o=a[h],s=o.description||"",i=o.type,f=o.format,g=o["x-example"],p,y,t;i==="array"?this.isSchemaRef(o.items)?(p=this.getSchemaRef(o.items),y=this.getParamDefinitions(p,n,d,{},0)):o.schema?this.isSchemaRef(o.schema.items)?(p=this.getSchemaRef(o.schema.items),y=this.getParamDefinitions(p,n,d,{},0)):o.schema.type&&(p=o.schema.type):o.items&&o.items.type?p=o.items.type:N.logMessage("001",i,o):i?oe.indexOf(i)>=0||N.logMessage("003",i,o):o.schema?this.isSchemaRef(o.schema)?(i=this.getSchemaRef(o.schema),y=this.getParamDefinitions(i,n,d,{},0)):o.schema.type?(i=o.schema.type,o.schema.additionalProperties?(t={},y=this.getAdditionalProperties(o.schema.additionalProperties,t,n,d,{},0),f=t.type):o.schema.items?this.isSchemaRef(o.schema.items)?(p=this.getSchemaRef(o.schema.items),y=this.getParamDefinitions(p,n,d,{},0)):o.schema.items.type?p=o.schema.items.type:N.log("0014",i,o):N.log("0011",i,o)):N.logMessage("0013",i,o):o.items&&o.items.type?(i=o.items.type,o.items.additionalProperties?(t={},y=this.getAdditionalProperties(o.items.additionalProperties,t,n,d,{},0),f=t.type):N.logMessage("0012",i,o)):N.logMessage("002",i,o),g&&(s=s?s+"\uFF0C":"",s+="\u4F8B\uFF1A"+g),o.enum&&o.enum.length>0&&(s=s||"\u679A\u4E3E\u7C7B\u578B",s+="\uFF0C\u53EF\u9009\u503C\uFF1A"+o.enum.join("\u3001")),e.push({type:i,key:d,in:o.in,name:o.name,subType:p,required:o.required?"\u662F":"\u5426",format:f,enum:o.enum,example:g,collectionFormat:o.collectionFormat,description:s,additional:t,children:y}),d++}return e},getResponseParamList(a,n){let d=[],e=1;return Object.keys(a).forEach(h=>{let o=a[h],s,i;this.isSchemaRef(o.schema)&&(s=this.getSchemaRef(o.schema),i=this.getParamDefinitions(s,n,e,{},0)),d.push({code:h,type:s,key:e,desc:o.description,schemas:i}),e++}),d},isSchemaRef(a){return!!(a&&a.$ref)},getSchemaRef(a){return a.$ref&&a.$ref.indexOf("#/definitions/")===0?a.$ref.replace("#/definitions/",""):(N.logMessage("9467","",a),"")},getParamDefinitions(a,n,d,e,h){let o=n[a];if(h>=10||!o||(e[a]=(e[a]||0)+1,e[a]>2))return;let s=[],i=o.type,f=o.properties,g=1;if(i==="object"&&f){let p={};Object.keys(f).forEach(y=>{let t=f[y],_=t.type,x=t.format,v=t.description||"",C=t.example||t["x-example"],I,k,M,E=d+"_"+g,K;Object.keys(p).forEach(j=>{e[j]=void 0}),_==="array"?this.isSchemaRef(t.items)?(I=this.getSchemaRef(t.items),K=this.getParamDefinitions(I,n,E,e,h+1)):t.items&&t.items.type?I=t.items.type:N.logMessage("004",_,t):_==="object"?t.additionalProperties?(k={},K=this.getAdditionalProperties(t.additionalProperties,k,n,E,e,h+1),x=k.type):N.log("0041",_,t):_?oe.indexOf(_)>=0||N.logMessage("006",_,t):this.isSchemaRef(t)?(_=this.getSchemaRef(t),K=this.getParamDefinitions(_,n,E,e,h+1)):N.logMessage("005",_,t),C&&(v=v?v+"\uFF0C":"",v+="\u4F8B\uFF1A"+C),t.items&&t.items.enum&&t.items.enum.length>0&&(M=t.items.enum,v=v||"\u679A\u4E3E\u7C7B\u578B",v+="\uFF0C\u53EF\u9009\u503C\uFF1A"+t.items.enum.join("\u3001")),s.push({type:_,name:y,key:E,subType:I,format:x,description:v,enum:M,additional:k,example:C,children:K}),g++,p[_]=1})}return s.length>0?s:v
|
2021-11-26 23:51:14 +08:00
|
|
|
`;f.value=v+JSON.stringify(a.result.data),g.value=v+JSON.stringify(a.result.data,null,4)}t()}};return _(),we(n,()=>_()),{activePage:d,bodyShowType:e,bodyShowTypeChange:t,unitConvert:Ce,bodyShowFormatType:h,bodyShowFormatPreview:o,previewHtmlRef:y,resultData:p,resultHeaders:s,resultCookies:i,resultHeadersColumns:[{title:"KEY",dataIndex:"name"},{title:"VALUE",dataIndex:"value"}],resultCookiesColumns:[{title:"KEY",dataIndex:"name"},{title:"VALUE",dataIndex:"value"}],resultDataInit:v=>{v.setFontSize(16)},resultDataContentOrigin:f,resultDataContentFormat:g,resultDataConfig:{wrap:!0,readOnly:!0,autoScrollEditorIntoView:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0,minLines:30,maxLines:30}}}},Ye={key:0,style:{"margin-bottom":"30px"}},Ze={key:0,style:{"margin-bottom":"30px"}},We={style:{"margin-bottom":"10px"}},$e=u("\u683C\u5F0F\u5316"),ea=u("\u539F\u59CB\u503C"),aa=u("\u9884\u89C8"),ta=u("JSON"),oa=u("HTML"),na=u("XML"),ra=u("JavaScript"),la=u("TEXT"),sa={key:2},ia={key:0,ref:"previewHtmlRef",width:"100%",height:"570px",style:{border:"0"}},da={class:"status-info-box"},ua=u(" \u72B6\u6001\u7801\uFF1A"),ma=u(" \u8017\u65F6\uFF1A"),ca=u(" \u5927\u5C0F\uFF1A"),fa={key:1},ya={style:{color:"#f00"}},ha={class:"status-info-box"},_a=u(" \u8017\u65F6\uFF1A"),pa={key:1,style:{"margin-top":"20px"}},ga={key:2,style:{"margin-top":"20px",color:"#aaa"}};function va(a,n,d,e,h,o){const s=b("a-radio-button"),i=b("a-radio-group"),f=b("a-select-option"),g=b("a-select"),p=b("ace-editor"),y=b("a-tab-pane"),t=b("a-table"),_=b("a-divider"),x=b("a-tabs"),v=b("a-skeleton"),C=b("a-spin"),I=b("a-empty");return d.result.data?(m(),w("div",Ye,[d.result.data.data||d.result.data.status===200?(m(),w("div",Ze,[l(x,{activeKey:e.activePage,"onUpdate:activeKey":n[4]||(n[4]=k=>e.activePage=k),onTabClick:n[5]||(n[5]=()=>{}),style:{padding:"5px 10px 0"}},{rightExtra:r(()=>[O("span",da,[ua,O("span",null,L(e.resultData.status||"200"),1),l(_,{type:"vertical"}),ma,O("span",null,L(e.unitConvert.formatSeconds(e.resultData.useTime||0)),1),l(_,{type:"vertical"}),ca,O("span",null,L(e.unitConvert.formatFileSize(e.resultData.contentLength||0)),1)])]),default:r(()=>[l(y,{tab:"Body",key:"body",forceRender:""},{default:r(()=>[O("div",We,[l(i,{value:e.bodyShowType,"onUpdate:value":n[0]||(n[0]=k=>e.bodyShowType=k),onChange:e.bodyShowTypeChange,size:"small"},{default:r(()=>[l(s,{value:"format"},{default:r(()=>[$e]),_:1}),l(s,{value:"row"},{default:r(()=>[ea]),_:1}),l(s,{value:"preview"},{default:r(()=>[aa]),_:1})]),_:1},8,["value","onChange"]),e.bodyShowType==="format"?(m(),R(g,{key:0,value:e.bodyShowFormatType,"onUpdate:value":n[1]||(n[1]=k=>e.bodyShowFormatType=k),size:"small",style:{"margin-left":"10px",width:"100px"}},{default:r(()=>[l(f,{value:"json"},{default:r(()=>[ta]),_:1}),l(f,{value:"html"},{default:r(()=>[oa]),_:1}),l(f,{value:"xml"},{default:r(()=>[na]),_:1}),l(f,{value:"javascript"},{default:r(()=>[ra]),_:1}),l(f,{value:"text"},{default:r(()=>[la]),_:1})]),_:1},8,["value"])):D("",!0)]),e.bodyShowType==="format"?(m(),R(p,{key:0,value:e.resultDataContentFormat,"onUpdate:value":n[2]||(n[2]=k=>e.resultDataContentFormat=k),onInit:e.resultDataInit,lang:e.bodyShowFormatType,theme:"monokai",width:"100%",height:"100",options:e.resultDataConfig},null,8,["value","onInit","lang","options"])):e.bodyShowType==="row"?(m(),R(p,{key:1,value:e.resultDataContentOrigin,"onUpdate:value":n[3]||(n[3]=k=>e.resultDataContentOrigin=k),onInit:e.resultDataInit,lang:"text",theme:"chrome",width:"100%",height:"100",options:e.resultDataConfig},null,8,["value","onInit","options"])):e.bodyShowType==="preview"?(m(),w("div",sa,[e.bodyShowFormatPreview==="html"?(m(),w("iframe",ia,null,512)):(m(),w(q,{key:1},[u(L(e.resultDataContentOrigin),1)],64))])):D("",!0)]),_:1}),l(y,{tab:"Headers",key:"headers",forceRender:""},{default:r(()=>[l(t,{dataSource:e.resultHeaders,columns:e.resultHeadersColumns,size:"small",pagination:!1,scroll:{y:"300px"}},null,8,["dataSource","columns"])]),_:1}),l(y,{tab:"Cookies",key:"cookies",forceRender:""},{default:r(()=>[l(t,{dataSource:e.resultCookies,
|