import{e as s,E as e,f as a,g as r,h as o,w as t,z as l,o as d,i,j as n,a as u,aT as p,x as _,aU as c,O as f,a1 as m,aV as g,H as v}from"./index-WeUkftbp.js";import{_ as y}from"./uni-easyinput.D5FSIQIk.js";import{_ as b,a as j}from"./uni-forms.CCONsUgM.js";import{_ as h}from"./login-bg.DI0uwli1.js";import{_ as x}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./uni-icons.B3nCnuXe.js";/* empty css                                                                  *//* empty css                                                                      */import"./uni-forms.vue_vue_type_style_index_0_scoped_a2a9907e_lang.DijPs27m.js";const C=x({__name:"config",setup(x){let C=s({address:"",isDefault:0});const z=s({serverConfig:[],address:""}),A=e("serverConfigInfo")||[],V=p((()=>{if(!/^(https?:\/\/)?((([a-zA-Z0-9]|(?:[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]))\.)+([a-zA-Z]{2,}))|((\d{1,3}\.){3}\d{1,3})(:\d+)?$/.test(C.address))return _.error("请检查域名是否正确"),!1;((s,e)=>{let a,r;if(a=A.some((s=>s.address===C.address)),a)return _.error("您已配置该企业,无需重复配置");r=e||C.address,g({method:"GET",url:r+"/api/uni/common/server_config",data:{},success:e=>{const a=e.data.status;if(200===parseInt(a)){const a=e.data.data;z.address=a.address,s||v("chooseApiUrl",C.address),a.isDefault=!0,v("chooseEnterprise",a),A.push(a),v("serverConfigInfo",A),_.success("添加成功"),setTimeout((function(){c({url:"/pages/users/login/index?type=1"})}),500)}else _.error(e.data.message)},fail:()=>{_.error("配置失败，请填写正确的服务域名")}})})()}),500),Z=()=>{c({url:"/pages/users/login/index"})};return(s,e)=>{const p=f,_=l,c=a(r("uni-easyinput"),y),g=a(r("uni-forms-item"),b),v=a(r("uni-forms"),j),x=m;return d(),o(_,{class:"content"},{default:t((()=>[i(p,{class:"login-image",src:h}),i(_,{class:"nav-bar"},{default:t((()=>[i(_,{class:"iconfont icon-fanhui bar-return",onClick:Z}),i(_,null,{default:t((()=>[n("添加服务配置")])),_:1}),i(_)])),_:1}),i(_,{class:"corporate"},{default:t((()=>[i(_,{class:"title"},{default:t((()=>[n("企业信息绑定")])),_:1}),i(v,{ref:"forms",modelValue:u(C),"label-position":"top"},{default:t((()=>[i(g,{label:"服务域名"},{default:t((()=>[i(c,{modelValue:u(C).address,"onUpdate:modelValue":e[0]||(e[0]=s=>u(C).address=s),styles:{borderColor:"transparent"},clearable:!1,placeholder:"请输入服务域名"},null,8,["modelValue"]),i(_,{class:"tips"},{default:t((()=>[n("服务域名示例：https://demo.tuoluojiang.com")])),_:1})])),_:1})])),_:1},8,["modelValue"]),i(x,{class:"preserve",type:"primary",disabled:!u(C).address,onClick:u(V)},{default:t((()=>[n("保 存")])),_:1},8,["disabled","onClick"])])),_:1})])),_:1})}}},[["__scopeId","data-v-3a59d927"]]);export{C as default};
