import{_ as a,r as e,bx as l,by as d,b as o,c as t,d as r,e as s,f as i,g as p,i as m,h as u,w as c,j as n,k as f,n as b,m as v,E as j,q as g,p as _,t as h,v as x}from"./index.286e9b79.js";import{v as V}from"./loading.c49775a6.js";import{E as y,a as q}from"./form.ad10dcd5.js";import{E as k,a as w}from"./tab-pane.1cc0f769.js";import{E}from"./image-viewer.b538fe01.js";import{E as U}from"./progress.27d0e11c.js";import"./form-item.9355e6dc.js";import{E as A}from"./input.31de1b37.js";import{_ as C}from"./material.90ee622d.js";import{_ as I}from"./page-header.29890ed0.js";import{g as S,p as D}from"./http.f588794f.js";import"./_initCloneObject.fb8fbaea.js";import"./strings.8c60bfae.js";import"./event.776e7e11.js";import"./debounce.caafe00b.js";import"./index.ed3ed02e.js";import"./position.1bd00850.js";import"./scroll.a50153b5.js";import"./cloneDeep.15b627aa.js";import"./isEqual.57d72c4a.js";import"./pagination.22bb50f6.js";import"./select.297a82d5.js";import"./index.27150c7e.js";import"./token.34cb8214.js";import"./_baseIteratee.9ead53a1.js";/* empty css            */import"./dialog.ec9503d2.js";import"./overlay.2c1583ac.js";import"./message-box.6a8eb828.js";import"./validator.18338d56.js";import"./divider.948c4b18.js";const z={class:"editor-card"},B={class:"editor-card-box"},F=(a=>(h("data-v-54aea608"),a=a(),x(),a))((()=>u("div",{class:"form-item-tips"},"小程序：开发->开发管理->开发设置->业务域名->下载域名验证文件->上传验证文件",-1))),O={class:"avatar-uploader"},P={class:"image-slot"},R={class:"tool"},T={class:"tool-box"},G=a({__name:"index",setup(a){let h=e(!1),x=e(!1),G=e("0"),H=e(),J=e(!1),K=e(l.base_url+"/addons.miniprogram/upload"),L=e({Authorization:"Bearer "+d().getToken()}),M=o({data:{name:"",appid:"",appsecret:"",token:"",enaeskey:"",ip:"",url:"",file:"",qrcode:""}});const N=o({appid:[{required:!0,message:"请输入appid",trigger:"blur"}],appsecret:[{required:!0,message:"请输入AppSecret",trigger:"blur"}]});x.value=!0,S("addons.miniprogram/index").then((a=>{x.value=!1,a.code&&(M.data=a.data)}));const Q=async()=>{H.value&&await H.value.validate(((a,e)=>{x.value=!1,a?(x.value=!0,D("addons.miniprogram/index",M.data).then((a=>{x.value=!1,a.code?j.success("操作成功"):j.error(a.msg)})).catch((a=>{j.error(a)}))):j.error("请完善内容")}))},W=a=>{J.value=!0},X=(a,e)=>{J.value=!1,1==a.code?M.data.file=a.data:j.error(a.msg)},Y=(a,e,l)=>{J.value=!1},Z=e(!1),$=()=>{Z.value=!0},aa=a=>{Z.value=!1,M.data.qrcode=a[0].photo},ea=()=>{};return(a,e)=>{const l=I,d=C,o=A,j=y,S=g,D=U,la=E,da=t("Plus"),oa=_,ta=k,ra=w,sa=q,ia=V;return r(),s("div",null,[i(l,{title:"基础设置"}),i(d,{modelValue:p(Z),"onUpdate:modelValue":e[0]||(e[0]=a=>m(Z)?Z.value=a:null),limit:1,onChange:aa,onClose:ea},null,8,["modelValue"]),u("div",z,[c((r(),n(sa,{model:p(M).data,rules:p(N),ref_key:"ruleFormRef",ref:H},{default:f((()=>[u("div",B,[i(ra,{modelValue:p(G),"onUpdate:modelValue":e[5]||(e[5]=a=>m(G)?G.value=a:G=a)},{default:f((()=>[i(ta,{label:"基本信息",name:"0"},{default:f((()=>[i(j,{label:"名称","label-width":"100px"},{default:f((()=>[i(o,{modelValue:p(M).data.name,"onUpdate:modelValue":e[1]||(e[1]=a=>p(M).data.name=a),placeholder:"请输入名称"},null,8,["modelValue"])])),_:1}),i(j,{label:"AppID",prop:"appid",required:!0,"label-width":"100px"},{default:f((()=>[i(o,{modelValue:p(M).data.appid,"onUpdate:modelValue":e[2]||(e[2]=a=>p(M).data.appid=a),placeholder:"请输入appid"},null,8,["modelValue"])])),_:1}),i(j,{label:"AppSecret",prop:"appsecret",required:!0,"label-width":"100px"},{default:f((()=>[i(o,{modelValue:p(M).data.appsecret,"onUpdate:modelValue":e[3]||(e[3]=a=>p(M).data.appsecret=a),placeholder:"请输入AppSecret"},null,8,["modelValue"])])),_:1}),i(j,{label:"验证文件",required:!1,"label-width":"100px"},{default:f((()=>[i(o,{modelValue:p(M).data.file,"onUpdate:modelValue":e[4]||(e[4]=a=>p(M).data.file=a),placeholder:"请上传验证文件",readonly:!0,style:{width:"400px"}},{append:f((()=>[i(D,{disabled:p(J),headers:p(L),action:p(K),accept:".txt","show-file-list":!1,"on-success":X,"on-error":Y,"before-upload":W},{default:f((()=>[i(S,null,{default:f((()=>[b("选择文件")])),_:1})])),_:1},8,["disabled","headers","action"])])),_:1},8,["modelValue"]),F])),_:1}),i(j,{label:"小程序码","label-width":"100px",style:{"align-items":"center"}},{default:f((()=>[u("div",O,[u("div",{class:"avatar-uploader-box",onClick:$},[p(M).data.qrcode?(r(),n(la,{key:0,src:p(M).data.qrcode,fit:"contain",class:"avatar"},{error:f((()=>[u("div",P,[(r(),n(v("icon-picture")))])])),_:1},8,["src"])):(r(),n(oa,{key:1,class:"avatar-uploader-icon"},{default:f((()=>[i(da)])),_:1}))])])])),_:1})])),_:1})])),_:1},8,["modelValue"])])])),_:1},8,["model","rules"])),[[ia,p(h)]])]),u("div",R,[u("div",T,[i(S,{type:"primary",loading:p(x),onClick:Q},{default:f((()=>[b("保存")])),_:1},8,["loading"])])])])}}},[["__scopeId","data-v-54aea608"]]);export{G as default};
