All Downloads are FREE. Search and download functionalities are using the official Maven repository.

static.assets.Api.b23d5bdf.js Maven / Gradle / Ivy

The newest version!
import{p as e,a,a6 as l,i as t,r as s,a7 as u,a8 as n,d as i,e as o,y as r,w as d,j as v,a3 as p,g as m,n as c,a4 as f,a5 as y,B as g,A as h,Q as _,z as b,P as k,a9 as x,L as w,f as C,x as z,v as S,aa as J,W as O,t as D,O as N,Y as j,ab as q,ac as Y,ad as U,N as R,ae as T,s as I,q as V,af as B,M,ag as H,ah as P,ai as L,V as E,aj as $,ak as G,b as A,al as F,h as Q,am as W,an as K}from"./vendor.55fdba86.js";import{C as X,a as Z}from"./index.c7a5d8a0.js";e("data-v-7b58027f");const ee=w("thead",null,[w("tr",null,[w("th",null,"参数名称"),w("th",null,"参数说明"),w("th",null,"请求类型"),w("th",null,"是否必须"),w("th",null,"数据类型")])],-1),ae={key:0},le={key:1},te={key:2},se={key:3},ue=h("格式化"),ne=h("折叠"),ie=h("缩小"),oe=h("放大"),re=h("关闭从本地请求用例选择"),de=h("开启从本地请求用例选择"),ve=h("发送"),pe=h(" 保存请求用例 "),me=h("保存请求用例"),ce=w("thead",null,[w("tr",null,[w("th",null,"是否启用"),w("th",null,"参数类型"),w("th",null,"参数名称"),w("th",null,"参数值")])],-1),fe={key:0},ye=h("格式化"),ge=h("折叠"),he=h("缩小"),_e=h("放大"),be=h("等待数据响应中.."),ke={style:{display:"flex"}},xe=h("格式化 "),we=h("折叠 "),Ce=h("缩小"),ze=h("放大"),Se={key:0,style:{display:"flex","justify-content":"flex-end","margin-left":"auto"}},Je={style:{"font-size":"16px"}},Oe={style:{"font-size":"16px"}},De=w("div",{style:{width:"120px",height:"40px","line-height":"40px","text-align":"center","font-size":"16px"}}," 回到顶部 ",-1);a();const Ne={setup(e){const a=l();let Ne=t("g"),je=s(!1),qe=s(""),Ye=s(!0),Ue=s("application/json"),Re=s([]),Te=s(""),Ie=s("success"),Ve=s([]),Be=s(""),Me=s([]),He=e=>A("div",{style:{display:"flex",alignItems:"center"}},[A("div",{style:{marginLeft:"12px",padding:"4px 0"}},[A("div",{style:{"font-size":"16px"}},[e.label]),A(F,{style:{"margin-top":"5px"},size:"small",type:"成功"==e.status?"success":"失败"==e.status?"error":"warning"},{default:()=>e.status})])]),Pe=({option:e})=>A("div",{style:{display:"flex",alignItems:"center"}},[A("div",{style:{"font-size":"16px"}},[e.label])]);Ve.value=X.radioConsts,Re.value=[{label:"application/json",value:"application/json"},{label:"x-www-form-urlencoded",value:"x-www-form-urlencoded"},{label:"form-data",value:"form-data"}];let Le=()=>{const e="lucky_"+na.value+"_"+oa.value;let a=localStorage.getItem(e);if(null!=a){JSON.parse(a).forEach((e=>{let a=Ve.value.find((a=>a.value==e.status));Me.value.push({time:Q().format("YYYY-MM-DD HH:mm:ss"),label:e.title,value:e.title,params:e.param,body:e.body,status:a.label})}))}},Ee=s(""),$e=s(!1),Ge=()=>{$e.value=!0},Ae=()=>{""==Ee.value&&a.error("请求用例标题不能为空");const e="lucky_"+na.value+"_"+oa.value;let l=localStorage.getItem(e);if(l){const t=JSON.parse(l);if(-1!=t.findIndex((e=>e.title==Ee.value)))return void a.error("该用例名称已被使用,请更改后重试");let s={};s.param=pa.value,s.time=Q().format("YYYY-MM-DD HH:mm:ss"),s.body=qe.value,s.title=Ee.value,s.status=Ie.value,t.push(s),localStorage.setItem(e,JSON.stringify(t))}else{let a=[],l={};l.param=pa.value,l.time=Q().format("YYYY-MM-DD HH:mm:ss"),l.body=qe.value,l.title=Ee.value,l.status=Ie.value,a.push(l),localStorage.setItem(e,JSON.stringify(a))}a.success("保存成功"),$e.value=!1,Le()},Fe=s({});Fe.value=Ne.value.theme;const Qe=Ne.value.data,We="这似乎不是一个JSON吧 朋友?";let Ke=()=>{try{qe.value=JSON.stringify(JSON.parse(qe.value),null,2)}catch(e){a.warning(We)}},Xe=()=>{try{qe.value=JSON.stringify(JSON.parse(qe.value),null,0)}catch(e){a.warning(We)}},Ze=()=>{try{Te.value=JSON.stringify(JSON.parse(Te.value),null,2)}catch(e){}},ea=()=>{try{Te.value=JSON.stringify(JSON.parse(Te.value),null,0)}catch(e){}},aa=()=>{Sa.value<=12?a.warning("不能再缩小了"):Sa.value=Sa.value-1},la=()=>{Sa.value>=20?a.warning("不能再放大了"):Sa.value=Sa.value+1},ta=u();n((()=>Ne.value.theme),(()=>{setTimeout((()=>{Ye.vlaue=!1,Fe.value=Ne.value.theme,Ye.vlaue=!0}),160)}));let sa=s("doc"),ua=e=>{sa.value=e},na=s(""),ia=s(""),oa=s(""),ra=s(""),da=s(""),va=s("Params"),pa=s([]),ma=s({}),ca=s([]),fa=e=>e.name,ya=(e,a)=>-1!=e.name.search("id")||-1!=e.name.search("Id")?"too-old":null,ga=[{title:"字段名",key:"name"},{title:"类型",key:"type",render:e=>A(F,{style:{marginRight:"6px"},round:!0,type:"warning"},{default:()=>null==e.type?"object":e.type})},{title:"描述",key:"description"},{title:"是否必须",key:"required",render:e=>A(F,{style:{marginRight:"6px"},round:!0,type:e.required?"error":"info"},{default:()=>e.required?"True":"False"})},{title:"快速复制字段名",key:"actions",render:e=>A(D,{size:"small",round:!0,type:"success",quaternary:!0,onClick:()=>ha(e)},{default:()=>"Copy"})}],ha=e=>{const l=document.createElement("input");l.value=e.name,document.body.appendChild(l),l.select(),document.execCommand("Copy"),document.body.removeChild(l),a.success("已复制")},_a=(e,a,l)=>X.deep(e,a,l),ba=e=>{va.value=e},ka=s(!1),xa=()=>{va.value="ResponseBody",ka.value=!0;let e={"Content-Type":Ue.value},a={};if(pa.value.forEach((l=>{l.active&&("header"==l.in?e[l.name]=l.value:"query"==l.in&&(a[l.name]=l.value))})),"get"==oa.value.toLowerCase()){Z({url:ia.value,method:oa.value.toLowerCase(),data:a,config:{headers:e}}).then((e=>{da.value=new Date-e.config.startTime,ra.value=e.status,Te.value=JSON.stringify(e.data),Ze(),ka.value=!1,Na()})).catch((e=>{ra.value=e.response.status,da.value=new Date-e.response.config.startTime,Te.value=Ca(e.response),Ze(),ka.value=!1}))}else{Z({url:ia.value,method:oa.value.toLowerCase(),data:qe.value,config:{headers:e,params:a}}).then((e=>{Te.value=JSON.stringify(e.data),ra.value=e.status,da.value=new Date-e.config.startTime,Ze(),ka.value=!1,Na()})).catch((e=>{ra.value=e.response.status,da.value=new Date-e.response.config.startTime,Te.value=Ca(e.response),Ze(),ka.value=!1}))}},wa=(e,l)=>{pa.value=l.params,qe.value=l.body,a.success("参数已经覆盖")},Ca=e=>{let a={};return a.timestamp=Q().format("YYYY-MM-DD HH:mm:ss"),a.code=e.data.status,a.error=e.data.error,a.path=e.data.path,JSON.stringify(a)},za=!1,Sa=s(12),Ja=s(""),Oa=s([]),Da=s([]),Na=()=>{sessionStorage.removeItem(ia.value+oa.value.toLowerCase());let e={};e.editJson=qe.value,e.reqBody=ma.value,e.reqParams=pa.value,e.isBody=je.value,e.tabValue=sa.value,e.responseJson=Te.value,e.rescode=ra.value,e.restime=da.value,e.openSelect=Be.value,e.switchResponse=va.value,e.radio=Ue.value,e.responseTreeData=Oa.value,e.bodyTreeData=Da.value,e.jsonData=Ja.value,sessionStorage.setItem(ia.value+oa.value.toLowerCase(),JSON.stringify(e))};return n((()=>ta.params),(()=>{var e,a;X.setRefObj(Qe);const l=ta.params.data;if(Me.value=[],l&&"identity"!=l){const t=JSON.parse(l);na.value=t.summary,ia.value=t.url,oa.value=t.method.toUpperCase(),Oa.value=[],Da.value=[],ma.value={},qe.value="",va.value="Params",ra.value="",da.value="",Te.value="",ca.value=[],Ja.value="";let u=sessionStorage.getItem(t.url+t.method);if(u){let e=JSON.parse(u);return qe.value=e.editJson,ma.value=e.reqBody,pa.value=e.reqParams,je.value=e.isBody,sa.value=e.tabValue,Te.value=e.responseJson,ra.value=e.rescode,da.value=e.restime,Be.value=e.openSelect,va.value=e.switchResponse,Ue.value=e.radio,Oa.value=e.responseTreeData,Ja.value=e.jsonData,void(Da.value=e.bodyTreeData)}pa.value=[];for(let e in t.parameters)"body"!=t.parameters[e].in?(t.parameters[e].active=!0,t.parameters[e].value=s(""),pa.value.push(t.parameters[e])):ma.value=t.parameters[e];if("GET"==oa.value)je.value=!1;else{je.value=!0;let l=null==(a=null==(e=ma.value)?void 0:e.schema)?void 0:a.$ref;if(l){let e=Qe.definitions[l.replace("#/definitions/","")],a=Object.keys(e.properties),t={};a.forEach((a=>{e.properties[a].key=a,t[a]=_a(e.properties[a],a,Da.value)})),qe.value=JSON.stringify(t)}}let n=t.responses[200].schema,i={};if(n){if("items"in n&&"$ref"in n.items)i=Qe.definitions[n.items.$ref.replace("#/definitions/","")];else if("$ref"in n&&null!=n.$ref)i=Qe.definitions[n.$ref.replace("#/definitions/","")];else if("items"in n){let e={};e[""]={type:n.items.type,description:n.items.type,key:""},i.properties=e}else i=n;ca.value=i.properties;let e=Object.keys(null==i.properties?[]:i.properties),a={};e.forEach((e=>{i.properties[e].key=e,a[e]=_a(i.properties[e],e,Oa.value)})),Ja.value=a,qe.value&&Ke(),Le()}Na()}}),{immediate:!0}),(e,a)=>{const l=i("b-ace-editor"),t=i("json-viewer");return o(),r(v(p),{style:{margin:"10px"},key:(new Date).getTime()},{default:d((()=>[m(v(c),{"default-value":"doc",size:"large",value:v(sa),"on-update:value":v(ua)},{default:d((()=>[m(v(b),{name:"doc",tab:"文档"},{default:d((()=>[m(v(p),{title:"Documentation",style:{margin:"10px"}},{default:d((()=>[m(v(f),{"x-gap":50,"y-gap":10,cols:3},{default:d((()=>[m(v(y),null,{default:d((()=>[m(v(p),{title:"接口地址",hoverable:""},{default:d((()=>[m(v(g),{id:"titleDoc"},{default:d((()=>[h(_(v(ia)),1)])),_:1})])),_:1})])),_:1}),m(v(y),null,{default:d((()=>[m(v(p),{title:"请求方式",hoverable:""},{default:d((()=>[m(v(g),{id:"titleDoc"},{default:d((()=>[h(_(v(oa)),1)])),_:1})])),_:1})])),_:1}),m(v(y),null,{default:d((()=>[m(v(p),{title:"接口描述",hoverable:""},{default:d((()=>[m(v(g),{id:"titleDoc"},{default:d((()=>[h(_(v(na)),1)])),_:1})])),_:1})])),_:1})])),_:1})])),_:1}),m(v(p),{style:{margin:"10px"}},{default:d((()=>[m(v(c),{"default-value":"request"},{default:d((()=>[m(v(b),{name:"request",tab:"请求参数"},{default:d((()=>[m(v(k),{vertical:"",size:12},{default:d((()=>[m(v(p),null,{default:d((()=>[m(v(x),{"single-line":!1},{default:d((()=>[ee,w("tbody",null,[(o(!0),C(S,null,z(v(pa),(e=>(o(),C("tr",{key:e.name},[w("td",null,_(e.name),1),w("td",null,_(e.description),1),"header"==e.in?(o(),C("td",ae,[m(v(F),{type:"success",size:"medium",round:""},{default:d((()=>[h(_(e.in),1)])),_:2},1024)])):(o(),C("td",le,[m(v(F),{type:"info",size:"medium",round:""},{default:d((()=>[h(_(e.in),1)])),_:2},1024)])),e.required?(o(),C("td",te,[m(v(F),{type:"error",size:"medium",round:""},{default:d((()=>[h(_(e.required),1)])),_:2},1024)])):(o(),C("td",se,[m(v(F),{type:"info",size:"medium",round:""},{default:d((()=>[h(_(e.required),1)])),_:2},1024)])),w("td",null,_(e.type),1)])))),128))])])),_:1})])),_:1}),v(je)&&v(Ye)?(o(),r(v(p),{key:0,title:"RequestBody"},{default:d((()=>[m(v(J),{ref:(e,a)=>{a.table=e},columns:v(ga),data:v(Da),"row-key":v(fa),"row-class-name":v(ya)},null,8,["columns","data","row-key","row-class-name"])])),_:1})):O("",!0),v(je)&&v(Ye)?(o(),r(v(p),{key:1},{default:d((()=>[m(v(D),{type:"success",style:{"margin-bottom":"10px"},onClick:v(Ke),size:"small"},{default:d((()=>[ue])),_:1},8,["onClick"]),m(v(D),{type:"success",style:{"margin-bottom":"10px","margin-left":"10px"},onClick:v(Xe),size:"small"},{default:d((()=>[ne])),_:1},8,["onClick"]),m(v(D),{type:"success",style:{"margin-bottom":"10px","margin-left":"10px"},onClick:v(aa),size:"small"},{default:d((()=>[ie])),_:1},8,["onClick"]),m(v(D),{type:"success",style:{"margin-bottom":"10px","margin-left":"10px"},onClick:v(la),size:"small"},{default:d((()=>[oe])),_:1},8,["onClick"]),m(l,{style:{"border-style":"none"},modelValue:v(qe),"onUpdate:modelValue":a[0]||(a[0]=e=>N(qe)?qe.value=e:qe=e),lang:"json",width:"100%",height:"600",theme:0==v(Fe)?"vibrant_ink":"github",readonly:v(za),"font-size":v(Sa)},null,8,["modelValue","theme","readonly","font-size"])])),_:1})):O("",!0)])),_:1})])),_:1}),m(v(b),{name:"signup",tab:"返回值"},{default:d((()=>[m(v(J),{ref:(e,a)=>{a.table=e},columns:v(ga),data:v(Oa),"row-key":v(fa),"row-class-name":v(ya)},null,8,["columns","data","row-key","row-class-name"])])),_:1}),m(v(b),{name:"show",tab:"返回值示例"},{default:d((()=>[m(t,{theme:v(j),value:v(Ja),style:{"font-size":"16px"},copyable:"","expand-depth":"2"},null,8,["theme","value"])])),_:1})])),_:1})])),_:1})])),_:1}),m(v(b),{name:"run",tab:"运行"},{default:d((()=>[m(v(p),{title:"Send Request",size:"large"},{default:d((()=>[m(v(k),{vertical:"",size:22},{default:d((()=>[m(v(q),{value:v(Be),"onUpdate:value":a[1]||(a[1]=e=>N(Be)?Be.value=e:Be=e)},{checked:d((()=>[re])),unchecked:d((()=>[de])),_:1},8,["value"]),m(v(Y),{size:"large"},{default:d((()=>[m(v(U),null,{default:d((()=>[m(v(R),{type:"success"},{default:d((()=>[h(_(v(oa)),1)])),_:1})])),_:1}),m(v(T),{disabled:!0,style:{width:"50%"},value:v(ia),"onUpdate:value":a[2]||(a[2]=e=>N(ia)?ia.value=e:ia=e)},null,8,["value"]),m(v(D),{onClick:v(xa),type:"success",ghost:""},{default:d((()=>[ve])),_:1},8,["onClick"]),m(v(I),{trigger:"hover"},{trigger:d((()=>[m(v(D),{round:"",style:{"font-size":"26px"},onClick:v(Ge)},{default:d((()=>[m(v(V),null,{default:d((()=>[m(v(B))])),_:1})])),_:1},8,["onClick"])])),default:d((()=>[pe])),_:1})])),_:1}),v(Be)?(o(),r(v(M),{key:0,options:v(Me),"render-label":v(He),"render-tag":v(Pe),"on-update:value":v(wa),placeholder:"选择一个请求用例,覆盖当前的参数.",style:{width:"50%"}},null,8,["options","render-label","render-tag","on-update:value"])):O("",!0),m(v(H),{show:v($e),"onUpdate:show":a[5]||(a[5]=e=>N($e)?$e.value=e:$e=e),width:502},{default:d((()=>[m(v(P),{title:"保存请求用例",closable:""},{footer:d((()=>[m(v(D),{size:"large",onClick:v(Ae)},{default:d((()=>[me])),_:1},8,["onClick"])])),default:d((()=>[m(v(k),{vertical:""},{default:d((()=>[m(v(p),{title:"起一个名字吧"},{default:d((()=>[m(v(T),{size:"large",placeholder:"写点什么..",value:v(Ee),"onUpdate:value":a[3]||(a[3]=e=>N(Ee)?Ee.value=e:Ee=e)},null,8,["value"])])),_:1}),m(v(p),{title:"选一种状态吧"},{default:d((()=>[m(v(L),{value:v(Ie),"onUpdate:value":a[4]||(a[4]=e=>N(Ie)?Ie.value=e:Ie=e),name:"statusGroup",size:"large"},{default:d((()=>[(o(!0),C(S,null,z(v(Ve),(e=>(o(),r(v(W),{key:e.value,value:e.value},{default:d((()=>[m(v(k),{justify:"space-around",size:"large"},{default:d((()=>[h(_(e.label),1)])),_:2},1024)])),_:2},1032,["value"])))),128))])),_:1},8,["value"])])),_:1})])),_:1})])),_:1})])),_:1},8,["show"]),m(v(L),{value:v(Ue),"onUpdate:value":a[6]||(a[6]=e=>N(Ue)?Ue.value=e:Ue=e),name:"radiobuttongroup1"},{default:d((()=>[(o(!0),C(S,null,z(v(Re),(e=>(o(),r(v(K),{key:e.value,value:e.value},{default:d((()=>[h(_(e.label),1)])),_:2},1032,["value"])))),128))])),_:1},8,["value"]),m(v(c),{"default-value":"Params",value:v(va),"on-update:value":v(ba)},{default:d((()=>[m(v(b),{name:"Params",tab:"Params"},{default:d((()=>[m(v(x),{bordered:!1,"single-line":!1},{default:d((()=>[ce,w("tbody",null,[(o(!0),C(S,null,z(v(pa),(e=>(o(),C("tr",{key:e.name},[w("td",null,[m(v(q),{value:e.active,"onUpdate:value":a=>e.active=a},null,8,["value","onUpdate:value"])]),w("td",null,[m(v(F),{type:"success"},{default:d((()=>[h(_(e.type)+"("+_(e.in)+")",1)])),_:2},1024)]),w("td",null,[m(v(F),{type:"info"},{default:d((()=>[h(_(e.name),1)])),_:2},1024)]),w("td",null,[m(v(T),{value:e.value,"onUpdate:value":a=>e.value=a,type:"text",size:"medium",placeholder:"请填写"+e.name,disabled:!e.active,round:"",clearable:""},null,8,["value","onUpdate:value","placeholder","disabled"])])])))),128))])])),_:1})])),_:1}),m(v(b),{name:"RequestBody",tab:"RequestBody"},{default:d((()=>[v(Ye)?(o(),C("div",fe,[m(v(D),{type:"success",style:{"margin-bottom":"10px"},onClick:v(Ke),size:"small"},{default:d((()=>[ye])),_:1},8,["onClick"]),m(v(D),{type:"success",style:{"margin-bottom":"10px","margin-left":"10px"},onClick:v(Xe),size:"small"},{default:d((()=>[ge])),_:1},8,["onClick"]),m(v(D),{type:"success",style:{"margin-bottom":"10px","margin-left":"10px"},onClick:v(aa),size:"small"},{default:d((()=>[he])),_:1},8,["onClick"]),m(v(D),{type:"success",style:{"margin-bottom":"10px","margin-left":"10px"},onClick:v(la),size:"small"},{default:d((()=>[_e])),_:1},8,["onClick"]),m(l,{style:{"border-style":"none"},modelValue:v(qe),"onUpdate:modelValue":a[7]||(a[7]=e=>N(qe)?qe.value=e:qe=e),lang:"json",width:"100%",height:"600",theme:0==v(Fe)?"vibrant_ink":"github",readonly:v(za),"font-size":v(Sa)},null,8,["modelValue","theme","readonly","font-size"])])):O("",!0)])),_:1}),m(v(b),{name:"ResponseBody",tab:"ResponseBody"},{default:d((()=>[m(v(p),{title:"Response"},{default:d((()=>[m(v(E),{show:v(ka)},{description:d((()=>[be])),default:d((()=>[w("div",ke,[m(v(D),{type:"success",style:{"margin-bottom":"10px"},onClick:v(Ze),size:"small"},{default:d((()=>[xe])),_:1},8,["onClick"]),m(v(D),{type:"success",style:{"margin-bottom":"10px","margin-left":"10px"},onClick:v(ea),size:"small"},{default:d((()=>[we])),_:1},8,["onClick"]),m(v(D),{type:"success",style:{"margin-bottom":"10px","margin-left":"10px"},onClick:v(aa),size:"small"},{default:d((()=>[Ce])),_:1},8,["onClick"]),m(v(D),{type:"success",style:{"margin-bottom":"10px","margin-left":"10px"},onClick:v(la),size:"small"},{default:d((()=>[ze])),_:1},8,["onClick"]),""!=v(ra)?(o(),C("span",Se,[w("span",Je,"状态码: "+_(v(ra)),1),m(v($),{vertical:""}),w("span",Oe,"耗时: "+_(v(da))+"ms ",1)])):O("",!0)]),m(l,{style:{"border-style":"none"},modelValue:v(Te),"onUpdate:modelValue":a[8]||(a[8]=e=>N(Te)?Te.value=e:Te=e),lang:"json",width:"100%",height:"600",theme:0==v(Fe)?"vibrant_ink":"github",readonly:v(za),"font-size":v(Sa)},null,8,["modelValue","theme","readonly","font-size"])])),_:1},8,["show"])])),_:1})])),_:1})])),_:1},8,["value","on-update:value"])])),_:1})])),_:1})])),_:1})])),_:1},8,["value","on-update:value"]),m(v(G),{right:40,bottom:50},{default:d((()=>[De])),_:1})])),_:1})}},__scopeId:"data-v-7b58027f"};export{Ne as default};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy