Files
zyplayer-doc/zyplayer-doc-api/src/main/resources/dist/assets/ApiRequest.ca1b27ca.js

5 lines
13 KiB
JavaScript
Raw Normal View History

import{as as Q,at as se,y as l,G as de,r as s,o as f,b as w,a,w as t,e as _,t as D,c as O,k as j,F as M,m as n,au as ue,av as me,v as ce,u as fe,B as ve,d as _e,J as E,L as U}from"./vendor.f364ea47.js";import"./index.71e18790.js";import{P as X,a as Y,u as ye,x as pe}from"./unitConvert.1c95fd02.js";import{z as he}from"./custom.0432982f.js";import{a as Pe}from"./index.337f28d0.js";import{_ as W}from"./main.14315fab.js";const ge={props:{result:{type:Object,required:!0},loading:{type:Boolean,required:!0}},components:{CloseOutlined:Q,ParamTable:X,ParamBody:Y,aceEditor:Pe},setup(v){const{result:o}=se(v);let L=l("body"),e=l("format"),y=l("json"),T=l(""),m=l([]),k=l([]),d=l(""),p=l(""),h=l({}),P=l();const g=()=>{e.value==="preview"&&setTimeout(()=>{P.value&&P.value.contentDocument.write(d.value)},0)},S=()=>{if(d.value="",p.value="",v.result.data){if(h.value=v.result.data,v.result.data.headers){m.value=v.result.data.headers;let u=m.value.find(C=>C.name==="Content-Type");u&&u.value&&(u.value.indexOf("text/html")>=0?y.value="html":u.value.indexOf("text/plain")>=0?y.value="text":u.value.indexOf("application/json")>=0?y.value="json":u.value.indexOf("application/xml")>=0||u.value.indexOf("text/xml")>=0?y.value="xml":u.value.indexOf("application/javascript")>=0&&(y.value="javascript"),T.value=y.value)}if(v.result.data.cookies&&(k.value=v.result.data.cookies),v.result.data.data){d.value=v.result.data.data,p.value=v.result.data.data;try{y.value==="xml"?p.value=pe(d.value):y.value==="json"?p.value=JSON.stringify(JSON.parse(d.value),null,4):y.value==="javascript"&&(p.value=JSON.stringify(d.value,null,4))}catch{p.value=v.result.data.data}}else{let u=`
2021-11-21 00:07:42 +08:00
// \u8BF7\u6C42\u5931\u8D25\uFF0C\u4EE5\u4E0B\u4E3A\u5C01\u88C5\u7684\u8FD4\u56DE\u503C\u5BF9\u8C61\uFF0C\u4EC5\u4F9B\u53C2\u8003
`;d.value=u+JSON.stringify(v.result.data),p.value=u+JSON.stringify(v.result.data,null,4)}g()}};return S(),de(o,()=>S()),{activePage:L,bodyShowType:e,bodyShowTypeChange:g,unitConvert:ye,bodyShowFormatType:y,bodyShowFormatPreview:T,previewHtmlRef:P,resultData:h,resultHeaders:m,resultCookies:k,resultHeadersColumns:[{title:"KEY",dataIndex:"name"},{title:"VALUE",dataIndex:"value"}],resultCookiesColumns:[{title:"KEY",dataIndex:"name"},{title:"VALUE",dataIndex:"value"}],resultDataInit:u=>{u.setFontSize(16)},resultDataContentOrigin:d,resultDataContentFormat:p,resultDataConfig:{wrap:!0,readOnly:!0,autoScrollEditorIntoView:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0,minLines:30,maxLines:30}}}},be={key:0,style:{"margin-bottom":"30px"}},xe={key:0,style:{"margin-bottom":"30px"}},ke={style:{"margin-bottom":"10px"}},Se=n("\u683C\u5F0F\u5316"),we=n("\u539F\u59CB\u503C"),Le=n("\u9884\u89C8"),Te=n("JSON"),Re=n("HTML"),Ce=n("XML"),Oe=n("JavaScript"),De=n("TEXT"),Ee={key:2},Ue={key:0,ref:"previewHtmlRef",width:"100%",height:"570px",style:{border:"0"}},qe={class:"status-info-box"},Ne=n(" \u72B6\u6001\u7801\uFF1A"),je=n(" \u8017\u65F6\uFF1A"),Je=n(" \u5927\u5C0F\uFF1A"),Ie={key:1},Ve={style:{color:"#f00"}},Ae={class:"status-info-box"},Ke=n(" \u8017\u65F6\uFF1A"),Be={key:1,style:{"margin-top":"20px"}},Fe={key:2,style:{"margin-top":"20px",color:"#aaa"}};function He(v,o,L,e,y,T){const m=s("a-radio-button"),k=s("a-radio-group"),d=s("a-select-option"),p=s("a-select"),h=s("ace-editor"),P=s("a-tab-pane"),g=s("a-table"),S=s("a-divider"),R=s("a-tabs"),u=s("a-skeleton"),C=s("a-spin"),c=s("a-empty");return L.result.data?(f(),w("div",be,[L.result.data.data?(f(),w("div",xe,[a(R,{activeKey:e.activePage,"onUpdate:activeKey":o[4]||(o[4]=x=>e.activePage=x),onTabClick:o[5]||(o[5]=()=>{}),style:{padding:"5px 10px 0"}},{rightExtra:t(()=>[_("span",qe,[Ne,_("span",null,D(e.resultData.status||"200"),1),a(S,{type:"vertical"}),je,_("span",null,D(e.unitConvert.formatSeconds(e.resultData.useTime||0)),1),a(S,{type:"vertical"}),Je,_("span",null,D(e.unitConvert.formatFileSize(e.resultData.contentLength||0)),1)])]),default:t(()=>[a(P,{tab:"Body",key:"body",forceRender:""},{default:t(()=>[_("div",ke,[a(k,{value:e.bodyShowType,"onUpdate:value":o[0]||(o[0]=x=>e.bodyShowType=x),onChange:e.bodyShowTypeChange,size:"small"},{default:t(()=>[a(m,{value:"format"},{default:t(()=>[Se]),_:1}),a(m,{value:"row"},{default:t(()=>[we]),_:1}),a(m,{value:"preview"},{default:t(()=>[Le]),_:1})]),_:1},8,["value","onChange"]),e.bodyShowType==="format"?(f(),O(p,{key:0,value:e.bodyShowFormatType,"onUpdate:value":o[1]||(o[1]=x=>e.bodyShowFormatType=x),size:"small",style:{"margin-left":"10px",width:"100px"}},{default:t(()=>[a(d,{value:"json"},{default:t(()=>[Te]),_:1}),a(d,{value:"html"},{default:t(()=>[Re]),_:1}),a(d,{value:"xml"},{default:t(()=>[Ce]),_:1}),a(d,{value:"javascript"},{default:t(()=>[Oe]),_:1}),a(d,{value:"text"},{default:t(()=>[De]),_:1})]),_:1},8,["value"])):j("",!0)]),e.bodyShowType==="format"?(f(),O(h,{key:0,value:e.resultDataContentFormat,"onUpdate:value":o[2]||(o[2]=x=>e.resultDataContentFormat=x),onInit:e.resultDataInit,lang:e.bodyShowFormatType,theme:"monokai",width:"100%",height:"100",options:e.resultDataConfig},null,8,["value","onInit","lang","options"])):e.bodyShowType==="row"?(f(),O(h,{key:1,value:e.resultDataContentOrigin,"onUpdate:value":o[3]||(o[3]=x=>e.resultDataContentOrigin=x),onInit:e.resultDataInit,lang:"text",theme:"chrome",width:"100%",height:"100",options:e.resultDataConfig},null,8,["value","onInit","options"])):e.bodyShowType==="preview"?(f(),w("div",Ee,[e.bodyShowFormatPreview==="html"?(f(),w("iframe",Ue,null,512)):(f(),w(M,{key:1},[n(D(e.resultDataContentOrigin),1)],64))])):j("",!0)]),_:1}),a(P,{tab:"Headers",key:"headers",forceRender:""},{default:t(()=>[a(g,{dataSource:e.resultHeaders,columns:e.resultHeadersColumns,size:"small",pagination:!1,scroll:{y:"300px"}},null,8,["dataSource","columns"])]),_:1}),a(P,{tab:"Cookies",key:"cookies",forceRender:""},{default:t(()=>[a(g,{dataSource:e.resultCookies,columns:e.resultCookiesColum