import{i as e}from"./main-ce25b28f.js";import{i as l}from"./ipcRenderer-5e19eaee.js";import{a as s}from"./index-9a8e575f.js";import{_ as o,r as a,o as t,b as n,g as i,a as r,w as c,e as d,p,f as u}from"./index-265ac112.js";const k={data:()=>({type:1,serverUrl:""}),methods:{info(){l.invoke(e.crossInfo,{}).then((e=>{console.log("res:",e)}))},getUrl(){l.invoke(e.getCrossUrl,{name:"goapp"}).then((e=>{this.serverUrl=e,this.$message.info(`服务地址: ${e}`)}))},kill(){l.invoke(e.killCrossServer,{type:"one",name:"goapp"})},killAll(){l.invoke(e.killCrossServer,{type:"all",name:"goapp"})},create(){l.invoke(e.createCrossServer,{program:"go"})},request(o){if(1!=o||""!=this.serverUrl)if(1==o){const e=this.serverUrl+"/api/hello";s({method:"get",url:e,params:{id:"111"},timeout:1e3}).then((e=>{console.log("res:",e);const l=e.data.data||null;this.$message.info(`服务返回: ${l}`)}))}else l.invoke(e.requestApi,{name:"goapp",urlPath:"/api/hello"}).then((e=>{console.log("res:",e);const l=e.data||null;this.$message.info(`服务返回: ${l}`)}));else this.$message.info("请先获取服务地址")}}},f=e=>(p("data-v-e1875343"),e=e(),u(),e),v={id:"app-cross-go"},m=f((()=>i("div",{class:"one-block-1"},[i("span",null," 1. 基础控制 ")],-1))),g={class:"one-block-2"},h=f((()=>i("div",{class:"one-block-1"},[i("span",null," 2. 发送http请求 ")],-1))),_={class:"one-block-2"},C=f((()=>i("div",{class:"one-block-1"},[i("span",null," 3. 多个服务 ")],-1))),b={class:"one-block-2"};const U=o(k,[["render",function(e,l,s,o,p,u){const k=a("a-button"),f=a("a-space");return t(),n("div",v,[m,i("div",g,[r(f,null,{default:c((()=>[r(k,{onClick:l[0]||(l[0]=e=>u.create())},{default:c((()=>[d(" 启动 ")])),_:1}),r(k,{onClick:l[1]||(l[1]=e=>u.getUrl())},{default:c((()=>[d(" 获取地址 ")])),_:1}),r(k,{onClick:l[2]||(l[2]=e=>u.kill())},{default:c((()=>[d(" kill ")])),_:1}),r(k,{onClick:l[3]||(l[3]=e=>u.info())},{default:c((()=>[d(" test ")])),_:1})])),_:1})]),h,i("div",_,[r(f,null,{default:c((()=>[r(k,{onClick:l[4]||(l[4]=e=>u.request(1))},{default:c((()=>[d(" 前端发送 ")])),_:1}),r(k,{onClick:l[5]||(l[5]=e=>u.request(2))},{default:c((()=>[d(" 主进程发送 ")])),_:1})])),_:1})]),C,i("div",b,[r(f,null,{default:c((()=>[r(k,{onClick:l[6]||(l[6]=e=>u.create())},{default:c((()=>[d(" 启动 ")])),_:1}),r(k,{onClick:l[7]||(l[7]=e=>u.killAll())},{default:c((()=>[d(" kill所有 ")])),_:1})])),_:1})])])}],["__scopeId","data-v-e1875343"]]);export{U as default};
