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