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

5 lines
18 KiB
JavaScript
Raw Normal View History

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