Files
zyplayer-doc/zyplayer-doc-api/src/main/resources/dist/assets/DocView.288779b4.js

5 lines
25 KiB
JavaScript
Raw Normal View History

2021-11-29 23:20:51 +08:00
import{r as b,T as be,o as u,c as R,w as r,a as l,m as d,t as L,H as U,e as O,b as w,F as q,k as D,X as ue,Y as Se,y as m,E as we,Z as xe,_ as ke,u as me,J as F,d as Le,B as ce,v as Oe,G as Ie}from"./vendor.d3f949c4.js";import{l as N}from"./logUtil.5b305c4e.js";import{m as Te}from"./index.ea6b273d.js";import{_ as X}from"./main.d3c4ff0f.js";import{P as fe,a as ye,b as Re,u as Ce,x as De}from"./unitConvert.3de44ccf.js";import{g as qe,z as Ne}from"./custom.914a01ae.js";let te=["file","string","integer","long","double","object","number","boolean","ref"];var he={getRequestParamList(t,n){if(!t)return[];let c=1,e=[];for(let h=0;h<t.length;h++){let o=t[h],s=o.description||"",i=o.type,f=o.format,g=o["x-example"],p,y,a;i==="array"?this.isSchemaRef(o.items)?(p=this.getSchemaRef(o.items),y=this.getParamDefinitions(p,n,c,{},0)):o.schema?this.isSchemaRef(o.schema.items)?(p=this.getSchemaRef(o.schema.items),y=this.getParamDefinitions(p,n,c,{},0)):o.schema.type&&(p=o.schema.type):o.items&&o.items.type?p=o.items.type:N.logMessage("001",i,o):i?te.indexOf(i)>=0||N.logMessage("003",i,o):o.schema?this.isSchemaRef(o.schema)?(i=this.getSchemaRef(o.schema),y=this.getParamDefinitions(i,n,c,{},0)):o.schema.type?(i=o.schema.type,o.schema.additionalProperties?(a={},y=this.getAdditionalProperties(o.schema.additionalProperties,a,n,c,{},0),f=a.type):o.schema.items?this.isSchemaRef(o.schema.items)?(p=this.getSchemaRef(o.schema.items),y=this.getParamDefinitions(p,n,c,{},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?(a={},y=this.getAdditionalProperties(o.items.additionalProperties,a,n,c,{},0),f=a.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:c,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:a,children:y}),c++}return e},getResponseParamList(t,n){let c=[],e=1;return Object.keys(t).forEach(h=>{let o=t[h],s,i;this.isSchemaRef(o.schema)&&(s=this.getSchemaRef(o.schema),i=this.getParamDefinitions(s,n,e,{},0)),c.push({code:h,type:s,key:e,desc:o.description,schemas:i}),e++}),c},isSchemaRef(t){return!!(t&&t.$ref)},getSchemaRef(t){return t.$ref&&t.$ref.indexOf("#/definitions/")===0?t.$ref.replace("#/definitions/",""):(N.logMessage("9467","",t),"")},getParamDefinitions(t,n,c,e,h){let o=n[t];if(h>=10||!o||(e[t]=(e[t]||0)+1,e[t]>2))return;let s=[],i=o.type,f=o.properties,g=1;if(i==="object"&&f){let p={};Object.keys(f).forEach(y=>{let a=f[y],_=a.type,x=a.format,v=a.description||"",C=a.example||a["x-example"],I,k,V,E=c+"_"+g,K;Object.keys(p).forEach(j=>{e[j]=void 0}),_==="array"?this.isSchemaRef(a.items)?(I=this.getSchemaRef(a.items),K=this.getParamDefinitions(I,n,E,e,h+1)):a.items&&a.items.type?I=a.items.type:N.logMessage("004",_,a):_==="object"?a.additionalProperties?(k={},K=this.getAdditionalProperties(a.additionalProperties,k,n,E,e,h+1),x=k.type):N.log("0041",_,a):_?te.indexOf(_)>=0||N.logMessage("006",_,a):this.isSchemaRef(a)?(_=this.getSchemaRef(a),K=this.getParamDefinitions(_,n,E,e,h+1)):N.logMessage("005",_,a),C&&(v=v?v+"\uFF0C":"",v+="\u4F8B\uFF1A"+C),a.items&&a.items.enum&&a.items.enum.length>0&&(V=a.items.enum,v=v||"\u679A\u4E3E\u7C7B\u578B",v+="\uFF0C\u53EF\u9009\u503C\uFF1A"+a.items.enum.join("\u3001")),s.push({type:_,name:y,key:E,subType:I,format:x,description:v,enum:V,additional:k,example:C,children:K}),g++,p[_]=1})}return s.length>0?s:void 0},getAdditionalProperties(t,n,c,e,h,o){if(this.isSchemaRef(t))return n.type=this.getSchemaRef(t),n.children=this.getParamDefinitions(n.type,c,e,h,o+1),n.additional;if(t.additionalProperties)return n.type=t.type,n.additional={},this.getAdditionalProperties(t.additionalProperties,n.additional,c,e,h,o+1);if(t.type==="array")if(n.type=t.type,this.isSchemaRef(t.items)){let s=this.getSchemaRef(t.items
// \u8BF7\u6C42\u5931\u8D25\uFF0C\u4EE5\u4E0B\u4E3A\u5C01\u88C5\u7684\u8FD4\u56DE\u503C\u5BF9\u8C61\uFF0C\u4EC5\u4F9B\u53C2\u8003
`;f.value=v+JSON.stringify(t.result.data),g.value=v+JSON.stringify(t.result.data,null,4)}a()}};return _(),we(n,()=>_()),{activePage:c,bodyShowType:e,bodyShowTypeChange:a,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=d("\u683C\u5F0F\u5316"),ea=d("\u539F\u59CB\u503C"),aa=d("\u9884\u89C8"),ta=d("JSON"),oa=d("HTML"),na=d("XML"),ra=d("JavaScript"),la=d("TEXT"),sa={key:2},ia={key:0,ref:"previewHtmlRef",width:"100%",height:"570px",style:{border:"0"}},da={class:"status-info-box"},ua=d(" \u72B6\u6001\u7801\uFF1A"),ma=d(" \u8017\u65F6\uFF1A"),ca=d(" \u5927\u5C0F\uFF1A"),fa={key:1},ya={style:{color:"#f00"}},ha={class:"status-info-box"},_a=d(" \u8017\u65F6\uFF1A"),pa={key:1,style:{"margin-top":"20px"}},ga={key:2,style:{"margin-top":"20px",color:"#aaa"}};function va(t,n,c,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"),a=b("a-table"),_=b("a-divider"),x=b("a-tabs"),v=b("a-skeleton"),C=b("a-spin"),I=b("a-empty");return c.result.data?(u(),w("div",Ye,[c.result.data.data||c.result.data.status===200?(u(),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"?(u(),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"?(u(),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"?(u(),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"?(u(),w("div",sa,[e.bodyShowFormatPreview==="html"?(u(),w("iframe",ia,null,512)):(u(),w(q,{key:1},[d(L(e.resultDataContentOrigin),1)],64))])):D("",!0)]),_:1}),l(y,{tab:"Headers",key:"headers",forceRender:""},{default:r(()=>[l(a,{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(a,{dataSource:e.resultCookies,